=encoding utf8

=head1 NAME

perl5419delta - what is new for perl v5.41.9

=head1 DESCRIPTION

This document describes differences between the 5.41.8 release and the 5.41.9
release.

If you are upgrading from an earlier release such as 5.41.7, first read
L<perl5418delta>, which describes differences between 5.41.7 and 5.41.8.

=head1 Core Enhancements

=head2 Lexical method declaration using C<my method>

Like C<sub> since Perl version 5.18, C<method> can now be prefixed with the
C<my> keyword.  This declares a subroutine that has lexical, rather than
package visibility.  See L<perlclass> for more detail.

=head2 Lexical method invocation operator C<< ->& >>

Along with the ability to declare methods lexically, this release also permits
invoking a lexical subroutine as if it were a method, bypassing the usual
name-based method resolution by name.

Combined with lexical method declaration, these two new abilities create the
effect of having private methods.

=head1 Incompatible Changes

=head2 Switch and Smart Match operator reinstated

The "switch" feature and the smartmatch operator, C<~~>, were introduced in
v5.10.  Their behavior was significantly changed in v5.10.1.  When the
"experiment" system was added in v5.18.0, switch and smartmatch were
retroactively declared experimental.  Over the years, proposals to fix or
supplement the features have come and gone.

They were deprecated in Perl v5.38.0 and scheduled for removal in Perl
5.42.0, and entirely removed in Perl 5.41.3.

After some discussion these have been re-instated.

Using them no longer produces a deprecation warning.

Switch itself still requires the C<switch> feature, which is enabled
by default for feature bundles from v5.9.5 through to v5.34.  Switch
remains disabled in feature bundles 5.35 and later, but can be
separately enabled:

  # no switch here
  use v5.10;
  # switch here
  use v5.36;
  # no switch here
  use feature "switch";
  # switch here

Smart match now requires the C<smartmatch> feature, which is enabled
by default and included in all feature bundles up to 5.40.  It is
disabled for the 5.41 feature bundle and later, but can be separately
enabled:

  # smartmatch here
  use v5.41;
  # no smartmatch here
  use feature "smartmatch";
  # smartmatch here

[L<GH #22752|https://github.com/Perl/perl5/issues/22752>]

=head1 Performance Enhancements

=over 4

=item *

The stringification of integers by L<perlfunc/print> and L<perlfunc/say>,
when coming from an C<SVt_IV>, is now more efficient.
[L<GH #22927|https://github.com/Perl/perl5/issues/22927>]

=item *

Subroutines in packages no longer need to be stored in typeglobs:
declaring a subroutine will now put a simple sub reference directly in the
stash if possible, saving memory.  The typeglob still notionally exists,
so accessing it will cause the stash entry to be upgraded to a typeglob
(i.e. this is just an internal implementation detail).
This optimization does not currently apply to XSUBs or exported
subroutines, and method calls will undo it, since they cache things in
typeglobs. 
[L<GH #23001|https://github.com/Perl/perl5/issues/23001>]

(This optimization was originally announced in L<perl5220delta>, but due to a
bug it only worked for subroutines in package C<main>, not in modules.)

=back

=head1 Modules and Pragmata

=head2 Updated Modules and Pragmata

=over 4

=item *

L<B::Deparse> has been upgraded from version 1.82 to 1.83.

=item *

L<Exporter> has been upgraded from version 5.78 to 5.79.

=item *

L<feature> has been upgraded from version 1.93 to 1.94.

=item *

L<Math::BigInt> has been upgraded from version 2.003003 to 2.003004.

=item *

L<Module::CoreList> has been upgraded from version 5.20250120 to 5.20250220.

=item *

L<ODBM_File> has been upgraded from version 1.19 to 1.20.

=item *

L<Opcode> has been upgraded from version 1.68 to 1.69.

=item *

L<overload> has been upgraded from version 1.39 to 1.40.

=item *

L<Safe> has been upgraded from version 2.47 to 2.46.

=item *

L<Test::Simple> has been upgraded from version 1.302207 to 1.302209.

=item *

L<Unicode::UCD> has been upgraded from version 0.78 to 0.79.

=item *

L<warnings> has been upgraded from version 1.72 to 1.73.

=back

=head1 Diagnostics

The following additions or changes have been made to diagnostic output,
including warnings and fatal error messages. For the complete list of
diagnostic messages, see L<perldiag>.

=head2 New Diagnostics

=head3 New Errors

=over 4

=item *

L<Undefined subroutine &%s called, close to label '%s'|perldiag/"Undefined subroutine &%s called, close to label '%s'">

(F) The subroutine indicated hasn't been defined, or if it was, it has
since been undefined.

This error could also indicate a mistyped package separator, when a
single colon was typed instead of two colons. For example, C<Foo:bar()>
would be parsed as the label C<Foo> followed by an unqualified function
name: C<foo: bar()>. [L<GH #22860|https://github.com/Perl/perl5/issues/22860>]

=back

=head2 Changes to Existing Diagnostics

=over 4

=item *

L<Possible precedence problem between ! and %s|perldiag/"Possible precedence problem between ! and %s">

This warning no longer triggers for code like C<!!$x == $y>, i.e. where double
negation (C<!!>) is used as a convert-to-boolean operator.
[L<GH #22954|https://github.com/Perl/perl5/issues/22954>]

=item *

L<Useless use of %s in void context|perldiag/"Useless use of %s in void context">

This warning now triggers for use of a chained comparison like C<< 0 < $x < 1 >>.
[L<GH #22969|https://github.com/Perl/perl5/issues/22969>]

=back

=head1 Internal Changes

=over 4

=item *

Two new API functions are introduced to convert strings encoded in
native bytes format to UTF-8.  These return the string unchanged if its
UTF-8 representation is the same as the original.  Otherwise, new memory
is allocated to contain the converted string.  This is in contrast to
the existing L<perlapi/C<bytes_to_utf8>> which always allocates new
memory.  The new functions are L<perlapi/C<bytes_to_utf8_free_me>> and
L<perlapi/C<bytes_to_utf8_temp_pv>>.
L<perlapi/C<bytes_to_utf8_temp_pv>> arranges for the new memory to
automatically be freed.  With C<bytes_to_utf8_free_me>, you are
responsible for freeing any newly allocated memory.

=item *

The way that subroutine signatures are parsed by the parser grammar has been
changed.

Previously, when parsing individual signature parameters, the parser would
accumulate an C<OP_ARGELEM> optree fragment for each parameter on the parser
stack, collecting them in an C<OP_LIST> sequence, before finally building the
complete argument handling optree itself, in a large action block defined
directly in F<perly.y>.

In the new approach, all the optree generation is handled by newly-defined
functions in F<op.c> which are called by the action blocks in the parser.
These do not keep state on the parser stack, but instead in a dedicated memory
structure referenced by the main C<PL_parser> structure.  This is intended to
be largely opaque to other code, and accessed only via the new functions.

This new arrangement is intended to allow more flexible code generation and
additional features to be developed in future.

=back

=head1 Selected Bug Fixes

=over 4

=item *

The C<$SIG{__DIE__}> and C<$SIG{__WARN__}> handlers can no longer be invoked
recursively, either deliberately or by accident, as described in
L<perlvar/%SIG>. That is, when an exception (or warning) triggers a call to a
C<$SIG{__DIE__}> (or C<$SIG{__WARN__}>) handler, further exceptions (or
warnings) are processed directly, ignoring C<%SIG> until the original
C<$SIG{__DIE__}> (or C<$SIG{__WARN__}>) handler call returns.
[L<GH #14527|https://github.com/Perl/perl5/issues/14527>], [L<GH #22984|https://github.com/Perl/perl5/issues/22984>], [L<GH #22987|https://github.com/Perl/perl5/issues/22987>]

=item *

The C<ObjectFIELDS()> for an object and C<xhv_class_fields> for the
object's stash weren't always NULL or not-NULL, confusing C<sv_dump()>
(and hence Devel::Peek's C<Dump()>) into crashing on an object with no
defined fields in some cases.  [L<GH #22959|https://github.com/Perl/perl5/issues/22959>]

=item *

When comparing strings when using a UTF-8 locale, the behavior was
previously undefined if either or both contained an above-Unicode code
point, such as 0x110000.  Now all such code points will collate the same
as the highest Unicode code point, U+10FFFF. [L<GH #22989|https://github.com/Perl/perl5/issues/22989>]

=back

=head1 Acknowledgements

Perl 5.41.9 represents approximately 5 weeks of development since Perl
5.41.8 and contains approximately 17,000 lines of changes across 380 files
from 23 authors.

Excluding auto-generated files, documentation and release tools, there were
approximately 9,700 lines of changes to 300 .pm, .t, .c and .h files.

Perl continues to flourish into its fourth decade thanks to a vibrant
community of users and developers. The following people are known to have
contributed the improvements that became Perl 5.41.9:

Andrew Ruthven, Antanas Vaitkus, Aristotle Pagaltzis, Chris 'BinGOs'
Williams, Dan Book, Dan Jacobson, David Mitchell, Eric Herman, hbmaclean,
James E Keenan, Karl Williamson, Leon Timmermans, Lukas Mai, Paul Evans,
Peter John Acklam, Reini Urban, Richard Leach, Scott Baker, Steve Hay, TAKAI
Kousuke, Thibault Duponchelle, Tony Cook, Yves Orton.

The list above is almost certainly incomplete as it is automatically
generated from version control history. In particular, it does not include
the names of the (very much appreciated) contributors who reported issues to
the Perl bug tracker.

Many of the changes included in this version originated in the CPAN modules
included in Perl's core. We're grateful to the entire CPAN community for
helping Perl to flourish.

For a more complete list of all of Perl's historical contributors, please
see the F<AUTHORS> file in the Perl source distribution.

=head1 Reporting Bugs

If you find what you think is a bug, you might check the perl bug database
at L<https://github.com/Perl/perl5/issues>. There may also be information at
L<https://www.perl.org/>, the Perl Home Page.

If you believe you have an unreported bug, please open an issue at
L<https://github.com/Perl/perl5/issues>. Be sure to trim your bug down to a
tiny but sufficient test case.

If the bug you are reporting has security implications which make it
inappropriate to send to a public issue tracker, then see
L<perlsec/SECURITY VULNERABILITY CONTACT INFORMATION>
for details of how to report the issue.

=head1 Give Thanks

If you wish to thank the Perl 5 Porters for the work we had done in Perl 5,
you can do so by running the C<perlthanks> program:

    perlthanks

This will send an email to the Perl 5 Porters list with your show of thanks.

=head1 SEE ALSO

The F<Changes> file for an explanation of how to view exhaustive details on
what changed.

The F<INSTALL> file for how to build Perl.

The F<README> file for general stuff.

The F<Artistic> and F<Copying> files for copyright information.

=cut
