=encoding utf8 =head1 NAME perldelta - 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, which describes differences between 5.41.7 and 5.41.8. =head1 Core Enhancements =head2 Lexical method declaration using C Like C since Perl version 5.18, C can now be prefixed with the C keyword. This declares a subroutine that has lexical, rather than package visibility. See L 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 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 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] =head1 Performance Enhancements =over 4 =item * The stringification of integers by L and L, when coming from an C, is now more efficient. [L] =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] (This optimization was originally announced in L, but due to a bug it only worked for subroutines in package C
, not in modules.) =back =head1 Modules and Pragmata =head2 Updated Modules and Pragmata =over 4 =item * L has been upgraded from version 1.82 to 1.83. =item * L has been upgraded from version 5.78 to 5.79. =item * L has been upgraded from version 1.93 to 1.94. =item * L has been upgraded from version 2.003003 to 2.003004. =item * L has been upgraded from version 5.20250120 to 5.20250220. =item * L has been upgraded from version 1.19 to 1.20. =item * L has been upgraded from version 1.68 to 1.69. =item * L has been upgraded from version 1.39 to 1.40. =item * L has been upgraded from version 2.47 to 2.46. =item * L has been upgraded from version 1.302207 to 1.302209. =item * L has been upgraded from version 0.78 to 0.79. =item * L 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. =head2 New Diagnostics =head3 New Errors =over 4 =item * L (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 would be parsed as the label C followed by an unqualified function name: C. [L] =back =head2 Changes to Existing Diagnostics =over 4 =item * L This warning no longer triggers for code like C, i.e. where double negation (C) is used as a convert-to-boolean operator. [L] =item * L This warning now triggers for use of a chained comparison like C<< 0 < $x < 1 >>. [L] =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> which always allocates new memory. The new functions are L> and L>. L> arranges for the new memory to automatically be freed. With C, 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 optree fragment for each parameter on the parser stack, collecting them in an C sequence, before finally building the complete argument handling optree itself, in a large action block defined directly in F. In the new approach, all the optree generation is handled by newly-defined functions in F 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 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. 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], [L], [L] =item * The C for an object and C for the object's stash weren't always NULL or not-NULL, confusing C (and hence Devel::Peek's C) into crashing on an object with no defined fields in some cases. [L] =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] =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 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. There may also be information at L, the Perl Home Page. If you believe you have an unreported bug, please open an issue at L. 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 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 program: perlthanks This will send an email to the Perl 5 Porters list with your show of thanks. =head1 SEE ALSO The F file for an explanation of how to view exhaustive details on what changed. The F file for how to build Perl. The F file for general stuff. The F and F files for copyright information. =cut