perl5419delta - what is new for perl v5.41.9
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 perl5418delta, which describes differences between 5.41.7 and 5.41.8.
my method
Like sub
since Perl version 5.18, method
can now be prefixed with the my
keyword. This declares a subroutine that has lexical, rather than package visibility. See perlclass for more detail.
->&
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.
The "switch" feature and the smartmatch operator, ~~
, 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 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 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
The stringification of integers by "print" in perlfunc and "say" in perlfunc, when coming from an SVt_IV
, is now more efficient. [GH #22927]
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. [GH #23001]
(This optimization was originally announced in perl5220delta, but due to a bug it only worked for subroutines in package main
, not in modules.)
B::Deparse has been upgraded from version 1.82 to 1.83.
Exporter has been upgraded from version 5.78 to 5.79.
feature has been upgraded from version 1.93 to 1.94.
Math::BigInt has been upgraded from version 2.003003 to 2.003004.
Module::CoreList has been upgraded from version 5.20250120 to 5.20250220.
ODBM_File has been upgraded from version 1.19 to 1.20.
Opcode has been upgraded from version 1.68 to 1.69.
overload has been upgraded from version 1.39 to 1.40.
Safe has been upgraded from version 2.47 to 2.46.
Test::Simple has been upgraded from version 1.302207 to 1.302209.
Unicode::UCD has been upgraded from version 0.78 to 0.79.
warnings has been upgraded from version 1.72 to 1.73.
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 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, Foo:bar()
would be parsed as the label Foo
followed by an unqualified function name: foo: bar()
. [GH #22860]
Possible precedence problem between ! and %s
This warning no longer triggers for code like !!$x == $y
, i.e. where double negation (!!
) is used as a convert-to-boolean operator. [GH #22954]
Useless use of %s in void context
This warning now triggers for use of a chained comparison like 0 < $x < 1
. [GH #22969]
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 "bytes_to_utf8
" in perlapi which always allocates new memory. The new functions are "bytes_to_utf8_free_me
" in perlapi and "bytes_to_utf8_temp_pv
" in perlapi. "bytes_to_utf8_temp_pv
" in perlapi arranges for the new memory to automatically be freed. With bytes_to_utf8_free_me
, you are responsible for freeing any newly allocated memory.
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 OP_ARGELEM
optree fragment for each parameter on the parser stack, collecting them in an OP_LIST
sequence, before finally building the complete argument handling optree itself, in a large action block defined directly in perly.y.
In the new approach, all the optree generation is handled by newly-defined functions in 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 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.
The $SIG{__DIE__}
and $SIG{__WARN__}
handlers can no longer be invoked recursively, either deliberately or by accident, as described in "%SIG" in perlvar. That is, when an exception (or warning) triggers a call to a $SIG{__DIE__}
(or $SIG{__WARN__}
) handler, further exceptions (or warnings) are processed directly, ignoring %SIG
until the original $SIG{__DIE__}
(or $SIG{__WARN__}
) handler call returns. [GH #14527], [GH #22984], [GH #22987]
The ObjectFIELDS()
for an object and xhv_class_fields
for the object's stash weren't always NULL or not-NULL, confusing sv_dump()
(and hence Devel::Peek's Dump()
) into crashing on an object with no defined fields in some cases. [GH #22959]
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. [GH #22989]
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 AUTHORS file in the Perl source distribution.
If you find what you think is a bug, you might check the perl bug database at https://github.com/Perl/perl5/issues. There may also be information at https://www.perl.org/, the Perl Home Page.
If you believe you have an unreported bug, please open an issue at 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 "SECURITY VULNERABILITY CONTACT INFORMATION" in perlsec for details of how to report the issue.
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 perlthanks
program:
perlthanks
This will send an email to the Perl 5 Porters list with your show of thanks.
The Changes file for an explanation of how to view exhaustive details on what changed.
The INSTALL file for how to build Perl.
The README file for general stuff.
The Artistic and Copying files for copyright information.