NAME
perl5438delta - what is new for perl v5.43.8
DESCRIPTION
This document describes differences between the 5.43.7 release and the 5.43.8 release.
If you are upgrading from an earlier release such as 5.43.6, first read perl5437delta, which describes differences between 5.43.6 and 5.43.7.
Core Enhancements
Multi-variable foreach can now use aliased references
Perl version 5.22 introduced reference aliases, allowing a foreach loop iteration variable to create new aliases to references. Perl version 5.36 introduced foreach loops with multiple variables, consuming more than one input list item on each iteration. New in this version, the two features may now be used together, allowing multiple iteration variables where any of them are permitted to be reference aliases.
use v5.42;
use feature qw( refaliasing declared_refs );
my %hash = (
one => [1],
two => [2, 2],
);
foreach my ( $key, \@items ) ( %hash ) {
say "The $key array contains: @items";
}
Currently both the refaliasing and declared_refs features remain experimental.
New source of entropy for PRNG seeding
Perl now uses the getentropy() system call to fetch random bytes suitable for seeding the internal PRNG. Previously Perl would read raw bytes from the /dev/urandom device. Perl now seeds itself in this order (and falls through upon failure):
getentropy()on systems that support this call (Linux, BSD, MacOS)/dev/urandom on systems that have it
Hash of internal state variables: Unix time, process ID, and pointer value
Incompatible Changes
Unicode rules are now fully enforced on identifier and regular expression group names.
Before Unicode, Perl accepted any \w character in an identifier or other name, except the first character couldn't be a digit. Later, Unicode created two properties that described this. Even later, they found those properties to be insufficient, and created two new similar properties. These are the ones that perl has intended to use since: \p{XID_Start} and \p{XID_Continue}. (The X stands for "eXtended" and indicates these are the more modern versions.)
(And even later, long after Perl identifier rules were formed using the above properties, Unicode added recommendations to further restrict legal identifier names. These were added to counter cases where, for example, programmers snuck code past reviewers using characters that look like other ones. The two properties are Identifier_Status and Identifier_Type. https://www.unicode.org/reports/tr39/. Perl currently doesn't do anything with these, except to furnish you the ability to use them in regular expressions.)
We soon discovered that there were 14 characters that match XID_Start and XID_Continue that don't also match \w. To avoid breaking code that had long relied on \w, we chose to not add those to the list of acceptable identifier characters.
It turns out that there are about 160 characters that match \w but not the Unicode XID properties. Thus they are illegal according to Unicode. Those are now explicitly forbidden in both Perl identifiers and regular expression group names. Previously, it was likely that their use in identifiers wouldn't work anyway; they could be accepted as initially as legal, but other code would later reject them, but with a message that had nothing to do with the underlying problem. However group names in regular expression patterns could contain illegal continuation characters and have a higher probablility of not being caught. That is now changed.
Only programs that do use utf8 can be affected, and then only characters that appear in the 2nd or later positions of the name. The characters that an identifier name can begin with are unchanged.
130 of the now unacceptable characters are 5 sets of 26 Latin letters that are enclosed by some shape, such as CIRCLED LATIN CAPITAL LETTER N. Another 8 are generic modifiers that add shapes around other characters; 5 are modifiers to Cyrillic numbers; and 16 are Arabic ligatures and isolated forms. The other two are GREEK YPOGEGRAMMENI and VERTICAL TILDE.
Deprecations
m/...[...].../xx has new restrictions
Using an unescaped # or literal vertical space is now deprecated in a regular expression bracketed character class that is compiled with the /xx modifier. These still work, but deprecation warnings will be generated unless turned off or the constructs are cured as follows.
Escape a
#by preceding it with a backslash, like inm/ [ % \# ( ) ] /xxUse constructs like
\ninstead of literal vertical space.
Modules and Pragmata
Updated Modules and Pragmata
B::Concise has been upgraded from version 1.010 to 1.011.
B::Deparse has been upgraded from version 1.88 to 1.89.
Compress::Raw::Bzip2 has been upgraded from version 2.214 to 2.217.
Compress::Raw::Zlib has been upgraded from version 2.214 to 2.218.
Config::Perl::V has been upgraded from version 0.38 to 0.39.
CPAN::Meta has been upgraded from version 2.150010 to 2.150012.
DB_File has been upgraded from version 1.859 to 1.860.
English has been upgraded from version 1.11 to 1.12.
ExtUtils::ParseXS has been upgraded from version 3.62 to 3.63.
ExtUtils::Typemaps has been upgraded from version 3.62 to 3.63.
feature has been upgraded from version 2.00 to 2.01.
IO::Compress has been upgraded from version 2.214 to 2.217.
Module::CoreList has been upgraded from version 5.20260119 to 5.20260220.
threads has been upgraded from version 2.43 to 2.44.
threads::shared has been upgraded from version 1.71 to 1.72.
Time::HiRes has been upgraded from version 1.9779 to 1.9780.
warnings has been upgraded from version 1.76 to 1.77.
XS::APItest has been upgraded from version 1.48 to 1.49.
XS::Typemap has been upgraded from version 0.20 to 0.21.
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 perldiag.
New Diagnostics
New Errors
\x{%X} is a \w char that isn't valid in a name "%s"
In most cases where this message now appears, an error would have occurred anyway, but the text would not have been helpful in finding the problem.
Changes to Existing Diagnostics
Variables whose name started with
^_were incorrectly shown in diagnostics with a literalCtrl-_(which is an invisible ASCII character) in their name.The names of variables whose names begin with a caret and are longer than two characters are now wrapped in braces, just as they have to be in the source code.
Therefore, using an undefined
${^_FOO}will now correctly warn withUse of uninitialized value ${^_FOO}, instead of the earlierUse of uninitialized value $FOO(with a literalCtrl-_after the dollar sign).Calling the
importmethod on a package with noimportmethod now produces a regular warning rather than a deprecation warning or error.Since Perl 5.39.1, calling
importwith arguments on a package without such a method has triggered a deprecation warning. In Perl 5.43.6, this deprecation was promoted into an error. This broke a significant amount of code while providing very little advantage over the warning. This fatal error has been converted back to a warning, with its deprecation status removed. There are no longer any plans to make this fatal in the future. The category for this warning ismissing_importand it is enabled by default.
Configuration and Compilation
It is now possible to pass to Configure the values dealing with POSIX locale categories, overriding its automatic calculation of these. This enables cross-compilation to work. The easiest way to do this is to extract the C program that does the calculation from Configure and then run it on the target machine, and then pass the values it outputs to Configure on the other machine. Porting/Glossary has examples. [GH #22992]
The
PERL_CREATE_GVSVconfiguration macro has been removed. It was almost undocumented and it has been disabled by default since Perl 5.10.0. Its purpose was to force all GVs to initialize their SV slot on creation. [GH #24177]
Testing
Tests were added and changed to reflect the other additions and changes in this release. Furthermore, these significant changes were made:
When testing embedding, add a sanity check to ensure the
libperlwe link against matches the perl we are building. [GH #22125]
Platform Support
Platform-Specific Notes
- OpenBSD
-
When testing embedding, ensure we link against the correct static libperl. [GH #22125]
Internal Changes
Fixed a bug in the "sv_numeq" in perlapi API where values with numeric ("0+") overloading but not equality or numeric comparison overloading would always be compared as floating point values. This could lead to large integers being reported as equal when they weren't.
Fixed a bug in "sv_numeq" in perlapi where the
SV_SKIP_OVERLOADflag would skip operator overloading, but would still honor numeric ("0+") overloading.Added "sv_numne" in perlapi, sv_numle, sv_numlt, sv_numge, sv_numgt and "sv_numcmp" in perlapi APIs that perform numeric comparison in the same way perl does, including overloading. Separate APIs for each comparison are needed to invoke their corresponding overload when needed. Inspired by [GH #23918]
This also extends the sv_numeq API to support
SV_FORCE_OVERLOAD.Added the
AMGf_force_scalarflag to the "amagic_call" in perlapi API to force scalar context for overload calls.Added the
AMGf_force_overloadflag to the "amagic_call" in perlapi API to allow forcing overloading to be honored even in the context ofno overloading;.The
SvFLAGSbits used bySvPCS_IMPORTED()andSvOOK()have now been merged into the same position, thus freeing up a flags bit for possible future purposes. This merge is distinguished by the fact that thePCS_IMPORTEDbehaviour is only used on references (whenSvROKis true), whereas theOOKonly applies to string buffers (whenSvROKis false).This change shouldn't affect any
XSmodule code that is using the test macros correctly, though might cause confusion to code that attempts to analyseSvFLAGSbits directly outside of the helper macros.An upper limit has been applied to the multiplier operand of the repetition operator. Constant folding will not be attempted if the operand is a numerical constant above
PERL_FOLD_REPEAT_LIMIT. See [GH #20586] and [GH #23561] for background.
Selected Bug Fixes
sort() optimizes common comparisons from calling the OP tree for a comparison block into a call to a C function. The C function used for overloaded numeric comparisons did not handle the case where there was no comparison overload but there was a numeric ("0+") overload correctly, losing precision for large overloaded integer arguments that are not exactly representable as a Perl floating point value (NV). [GH #23956]
When a scalar variable used as the target of a filehandle is
undef'ed while being output, garbage bytes would be left in that scalar. [GH #24008]Additionally, there was a case that would expose garbage bytes in the target scalar or even trigger a segmentation fault when that scalar is output on it (as in
open $fh, '>', \$str; print $fh $str;). This is also fixed. [GH #24199]
close(STDOUT)whenSTDOUThas been opened as a pipe will now properly wait for the child to exit on Windows. [GH #4106]Calling an XSUB via goto in scalar context, where the XSUB didn't return exactly one value, could result in the return of the wrong number of items, leading to potential stack corruption. For example:
sub wrap { goto \&an_xsub_which_returns_no_values } $ret = wrap();
Acknowledgements
Perl 5.43.8 represents approximately 5 weeks of development since Perl 5.43.7 and contains approximately 56,000 lines of changes across 320 files from 20 authors.
Excluding auto-generated files, documentation and release tools, there were approximately 48,000 lines of changes to 190 .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.43.8:
Craig A. Berry, David Mitchell, Graham Knop, H.Merijn Brand, James E Keenan, James Raspass, Karl Williamson, Leon Timmermans, Lukas Mai, Max Maischein, Paul Evans, Paul Marquess, Philippe Bruhat (BooK), Ricardo Signes, Richard Leach, Scott Baker, Steve Hay, TAKAI Kousuke, Tomasz Konojacki, Tony Cook.
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.
Reporting Bugs
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.
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 perlthanks program:
perlthanks
This will send an email to the Perl 5 Porters list with your show of thanks.
SEE ALSO
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.