PERL5400DELTA(1perl)
π PERL5400DELTA β the 5.40.0 glow-up π
okay bestie, heads up: this is the perl5400delta page, and it's a LONG one (six whole parts, we're doing a series β¨). Buckle in.
π NAME
perl5400delta β what's new for perl v5.40.0
π DESCRIPTION
This document spills the tea on all the differences between the 5.38.0 release and the 5.40.0 release.
π Core Enhancements
π The New __CLASS__ Keyword
When you're working with the new class feature, code inside a method, an ADJUST block, or a field initializer expression is now allowed to use the shiny new __CLASS__ keyword. It hands you a class name β kind of like __PACKAGE__, but here's the plot twist π: __PACKAGE__ gives you the compile-time package where the code appears, while __CLASS__ is aware of the actual run-time class that the object instance is a member of. So it's genuinely useful for method dispatch on that class, especially during constructors, where you're not allowed to access $self.
For more info, see "__CLASS__" in perlfunc.
πΈ :reader attribute for field variables
When you're using the class feature, field variables can now take a :reader attribute. This asks perl to automatically create an accessor method that just returns the value of the field variable from the given instance.
field $name :reader;
Is equivalent to
field $name;
method name () { return $name; }
You can also supply an alternative name:
field $name :reader(get_name);
For more detail, see ":reader" in perlclass.
π Permit a space in -M command-line option
When processing command-line options, perl now allows a space between the -M switch and the name of the module after it. Iconic behaviour honestly.
$ perl -M Data::Dumper=Dumper -E 'say Dumper [1,2,3]'
This matches the existing behaviour of the -I option.
β οΈ Restrictions to use VERSION declarations
Back in Perl 5.36, a deprecation warning showed up when you downgraded a use VERSION declaration from one above version 5.11, to below. That is now a fatal error, no cap π«’.
Also, it is now a fatal error to issue a subsequent use VERSION declaration when another is in scope, when either version is 5.39 or above. This is to avoid complications surrounding imported lexical functions from builtin. A deprecation warning has also been added for any other subsequent use VERSION declaration below version 5.39, to warn that it will no longer be permitted in Perl version 5.44.
β¨ New builtin::inf and builtin::nan functions (experimental)
Two new functions, inf and nan, have been added to the builtin namespace. They act like constants that yield the floating-point infinity and Not-a-Number value respectively.
π₯ New ^^ logical xor operator
Perl has always had three low-precedence logical operators and, or and xor, as well as three high-precedence bitwise versions &, ^ and |. Until this release, while the medium-precedence logical operators of && and || were also present, there was no exclusive-or equivalent. This release of Perl adds the final ^^ operator, completing the set. The collection is complete, periodt π
.
$x ^^ $y and say "One of x or y is true, but not both";
π try/catch feature is no longer experimental
Prior to this release, the try/catch feature for handling errors was considered experimental. Introduced in Perl version 5.34.0, this is now considered a stable language feature and its use no longer prints a warning. It still must be enabled with the 'try' feature.
See "Try Catch Exception Handling" in perlsyn.
π¦ for iterating over multiple values at a time is no longer experimental
Prior to this release, iterating over multiple values at a time with for was considered experimental. Introduced in Perl version 5.36.0, this is now considered a stable language feature and its use no longer prints a warning. See "Compound Statements" in perlsyn.
π builtin module is no longer experimental
Prior to this release, the builtin module and all of its functions were considered experimental. Introduced in Perl version 5.36.0, this module is now considered stable and its use no longer prints a warning. However, several of its functions are still considered experimental.
π The :5.40 feature bundle adds try
The latest version feature bundle now contains the recently-stablized feature try. As this feature bundle is used by the -E commandline switch, these are immediately available in -E scripts.
β use v5.40; imports builtin functions
In addition to importing a feature bundle, use v5.40; (or later versions) imports the corresponding builtin version bundle.
π Security
π CVE-2023-47038 β Write past buffer end via illegal user-defined Unicode property
This vulnerability was reported directly to the Perl security team by Nathan Mills the.true.nathan.mills@gmail.com.
A crafted regular expression when compiled by perl 5.30.0 through 5.38.0 can cause a one-byte attacker controlled buffer overflow in a heap allocated buffer.
π CVE-2023-47039 β Perl for Windows binary hijacking vulnerability
This vulnerability was reported to the Intel Product Security Incident Response Team (PSIRT) by GitHub user ycdxsb https://github.com/ycdxsb/WindowsPrivilegeEscalation. PSIRT then reported it to the Perl security team.
Perl for Windows relies on the system path environment variable to find the shell (cmd.exe). When running an executable which uses Windows Perl interpreter, Perl attempts to find and execute cmd.exe within the operating system. However, due to path search order issues, Perl initially looks for cmd.exe in the current working directory.
An attacker with limited privileges can exploit this behavior by placing cmd.exe in locations with weak permissions, such as C:\ProgramData. By doing so, when an administrator attempts to use this executable from these compromised locations, arbitrary code can be executed.
π¨ Incompatible Changes
π reset EXPR now calls set-magic on scalars
Previously reset EXPR did not call set magic when clearing scalar variables. This meant that changes did not propagate to the underlying internal state where needed, such as for $^W, and did not result in an exception where the underlying magic would normally throw an exception, such as for $1.
This means code that had no effect before may now actually have an effect, including possibly throwing an exception. π
reset EXPR already called set magic when modifying arrays and hashes.
This has no effect on plain reset used to reset one-match searches as with m?pattern?.
[GH #20763 β https://github.com/Perl/perl5/issues/20763]
π¬ Calling the import method of an unknown package produces a warning
Historically, it has been possible to call the import or unimport method of any class, including ones which have not been defined, with an argument and not experience an error. For instance, this code will not throw an error in Perl 5.38:
Class::That::Does::Not::Exist->import("foo");
However, as of Perl 5.39.1 this is deprecated and will issue a warning. Note that calling these methods with no arguments continues to silently succeed and do nothing. For instance,
Class::That::Does::Not::Exist->import();
will continue to not throw an error. This is because every class implicitly inherits from the class UNIVERSAL which now defines an import method. In older perls there was no such method defined, and instead the method calls for import and unimport were special cased to not throw errors if there was no such method defined.
This change has been added because it makes it easier to detect case typos in use statements when running on case-insensitive file systems. For instance, on Windows or other platforms with case-insensitive file systems on older perls the following code
use STRICT 'refs';
would silently do nothing as the module is actually called strict.pm, not STRICT.pm, so it would be loaded but its import method would never be called. It will also detect cases where a user passes an argument when using a package that does not provide its own import, for instance most "pure" class definitions do not define an import method.
π return no longer allows an indirect object
The return operator syntax now rejects indirect objects. In most cases this would compile and even run, but wasn't documented and could produce confusing results, for example:
# note that sum hasn't been defined
sub sum_positive {
return sum grep $_ > 0, @_;
# unexpectedly parsed as:
# return *sum, grep $_ > 0, @_;
# ... with the bareword acting like an extra (typeglob) argument
}
say for sum_positive(-1, 2, 3)
produced:
*main::sum
2
3
[GH #21716 β https://github.com/Perl/perl5/issues/21716]
π§ Class barewords no longer resolved as file handles in method calls under no feature "bareword_filehandles"
Under no feature "bareword_filehandles" bareword file handles continued to be resolved in method calls:
open FH, "<", $somefile or die;
no feature 'bareword_filehandles';
FH->binmode;
This has been fixed, so the:
FH->binmode;
will attempt to resolve FH as a class, typically resulting in a runtime error.
The standard file handles such as STDOUT continue to be resolved as a handle:
no feature 'bareword_filehandles';
STDOUT->flush; # continues to work
Note that once perl resolves a bareword name as a class it will continue to do so:
package SomeClass {
sub somemethod{}
}
open SomeClass, "<", "somefile" or die;
# SomeClass resolved as a handle
SomeClass->binmode;
{
no feature "bareword_filehandles";
SomeClass->somemethod;
}
# SomeClass resolved as a class
SomeClass->binmode;
[GH #19426 β https://github.com/Perl/perl5/issues/19426]
π«οΈ Deprecations
- Using
gototo jump from an outer scope into an inner scope is deprecated and will be removed completely in Perl 5.42. [GH #21601 βhttps://github.com/Perl/perl5/issues/21601]
β‘ Performance Enhancements
- The negation OPs have been modified to support the generic
TARGMYoptimization. [GH #21442 βhttps://github.com/Perl/perl5/issues/21442]
π Modules and Pragmata π
ok so this is the part where perl's whole friend group gets a glow-up. new members joined the core, and literally everyone else got a version bump. let's get into it bestie π
β¨ New Modules and Pragmata β¨
so like, two new kids showed up to the party and they're both iconic:
Term::Table0.018 has been added to the Perl core. π«Ά
this one is a dependency of Test2::Suite, so it's here to hold its bestie's hand, lowkey.
Test2::Suite0.000162 has been added to the Perl core. π
this distribution is a whole comprehensive set of test tools for writing unit tests. it's the successor to Test::More and similar modules (so like, the new gen stepping up, periodt). and the fact that it's in the core now?? means CPAN module tests can be written using this suite of tools without extra dependencies β no extra baggage, she's self-sufficient, we love that π¦
π Updated Modules and Pragmata π
okay so here's the entire list, no skipping, no summarizing β every single one, in order, because we do not do our faves dirty:
Archive::Tarhas been upgraded from version2.40to3.02_001.attributeshas been upgraded from version0.35to0.36.autodiehas been upgraded from version2.36to2.37.Bhas been upgraded from version1.88to1.89.B::Deparsehas been upgraded from version1.74to1.76.Benchmarkhas been upgraded from version1.24to1.25.bignumhas been upgraded from version0.66to0.67.builtinhas been upgraded from version0.008to0.014.
okay so builtin now accepts a version bundle as an input argument, which asks it to import all of the functions that are considered a stable part of the module at the given Perl version. for example:
use builtin ':5.40';
also added the load_module() builtin function as per PPC 0006 <https://github.com/Perl/PPCs/blob/main/ppcs/ppc0006-load-module.md>. that's giving "we're doing the PPC and we're doing it right" β¨
byteshas been upgraded from version1.08to1.09.Compress::Raw::Bzip2has been upgraded from version2.204_001to2.212.Compress::Raw::Zlibhas been upgraded from version2.204_001to2.212.CPAN::Meta::Requirementshas been upgraded from version2.140to2.143.Data::Dumperhas been upgraded from version2.188to2.189.DB_Filehas been upgraded from version1.858to1.859.Devel::Peekhas been upgraded from version1.33to1.34.Devel::PPPorthas been upgraded from version3.71to3.72.diagnosticshas been upgraded from version1.39to1.40.DynaLoaderhas been upgraded from version1.54to1.56.Encodehas been upgraded from version3.19to3.21.Errnohas been upgraded from version1.37to1.38.
the "osvers" and "archname" baked into the module β the ones that keep Errno being loaded by the perl that built it β are now more comprehensively escaped. [GH #21135 <https://github.com/Perl/perl5/issues/21135>] π§
experimentalhas been upgraded from version0.031to0.032.Exporterhas been upgraded from version5.77to5.78.ExtUtils::CBuilderhas been upgraded from version0.280238to0.280240.ExtUtils::Manifesthas been upgraded from version1.73to1.75.ExtUtils::Miniperlhas been upgraded from version1.13to1.14.Fcntlhas been upgraded from version1.15to1.18.
the old module documentation stub has been greatly expanded and revised (glow-up fr fr π).
it also adds support for the "O_TMPFILE" flag on Linux. π₯
featurehas been upgraded from version1.82to1.89.
it now documents the ":all" feature bundle, and suggests a reason why you may not wish to use it. (it's giving "here's the tea, but also, be careful bestie") π
fieldshas been upgraded from version2.24to2.25.File::Comparehas been upgraded from version1.1007to1.1008.File::Findhas been upgraded from version1.43to1.44.File::Globhas been upgraded from version1.40to1.42.File::Spechas been upgraded from version3.89to3.90.File::stathas been upgraded from version1.13to1.14.FindBinhas been upgraded from version1.53to1.54.Getopt::Longhas been upgraded from version2.54to2.57.Getopt::Stdhas been upgraded from version1.13to1.14.
documentation and test improvements only; no change in functionality. (so like, new outfit, same girl π )
Hash::Utilhas been upgraded from version0.30to0.32.Hash::Util::FieldHashhas been upgraded from version1.26to1.27.HTTP::Tinyhas been upgraded from version0.086to0.088.I18N::Langinfohas been upgraded from version0.22to0.24.
it now handles the additional locale categories that Linux defines beyond the ones in the POSIX Standard. π
this fixes what is returned for the "ALT_DIGITS" item, which has never before worked properly in Perl. (not me learning this just now π she's finally fixed!!)
IOhas been upgraded from version1.52to1.55.
fixed "IO::Handle/blocking" on Windows, which has been non-functional since IO 1.32. [GH #17455 <https://github.com/Perl/perl5/issues/17455>] β a whole bug squashed, we're so proud π«Ά
IO-Compresshas been upgraded from version2.204to2.212.IO::Socket::IPhas been upgraded from version0.41_01to0.42.IO::Zlibhas been upgraded from version1.14to1.15.localehas been upgraded from version1.10to1.12.Math::BigInthas been upgraded from version1.999837to2.003002.Math::BigInt::FastCalchas been upgraded from version0.5013to0.5018.Module::CoreListhas been upgraded from version5.20230520to5.20240609.Module::Metadatahas been upgraded from version1.000037to1.000038.mrohas been upgraded from version1.28to1.29.NDBM_Filehas been upgraded from version1.16to1.17.Opcodehas been upgraded from version1.64to1.65.perl5db.plhas been upgraded from version1.77to1.78.
made parsing of the "l" command arguments saner. [GH #21350 <https://github.com/Perl/perl5/issues/21350>] (the debugger said "let me be less chaotic" and honestly?? growth π±)
perlfaqhas been upgraded from version5.20210520to5.20240218.PerlIO::encodinghas been upgraded from version0.30to0.31.PerlIO::scalarhas been upgraded from version0.31to0.32.PerlIO::viahas been upgraded from version0.18to0.19.Pod::Checkerhas been upgraded from version1.75to1.77.Pod::Htmlhas been upgraded from version1.34to1.35.Pod::Simplehas been upgraded from version3.43to3.45.podlatorshas been upgraded from version5.01to5.01_02.POSIXhas been upgraded from version2.13to2.20.
the "mktime" function now works correctly on 32-bit platforms even if the platform's "time_t" type is larger than 32 bits. [GH #21551 <https://github.com/Perl/perl5/issues/21551>] β¨
the "T_SIGNO" and "T_FD" typemap entries have been fixed so they work with any variable name, rather than just the hardcoded "sig" and "fd". (no more favoritism, equality fr fr βοΈ)
the mappings for "Mode_t", "pid_t", "Uid_t", "Gid_t" and "Time_t" have been updated to be integer types; previously they were "NV" floating-point. πΈ
adjusted the signbit() on NaN test to handle the unusual bit pattern returned for NaN by Oracle Developer Studio's compiler. [GH #21533 <https://github.com/Perl/perl5/issues/21533>]
rehas been upgraded from version0.44to0.47.Safehas been upgraded from version2.44to2.46.SelfLoaderhas been upgraded from version1.26to1.27.Sockethas been upgraded from version2.036to2.038.stricthas been upgraded from version1.12to1.13.Test::Harnesshas been upgraded from version3.44to3.48.Test::Simplehas been upgraded from version1.302194to1.302199.Text::Tabshas been upgraded from version2021.0814to2024.001.Text::Wraphas been upgraded from version2021.0814to2024.001.threadshas been upgraded from version2.36to2.40.
an internal error has been made slightly more verbose ("Out of memory in perl:threads:ithread_create"). (when it breaks, at least it tells you exactly where, bestie π)
threads::sharedhas been upgraded from version1.68to1.69.Tie::Filehas been upgraded from version1.07to1.09.
old compatibility code for perl 5.005 that was no longer functional has been removed. (decluttering era, we love to see it π§Ήβ¨)
Time::gmtimehas been upgraded from version1.04to1.05.Time::HiReshas been upgraded from version1.9775to1.9777.Time::Localhas been upgraded from version1.30to1.35.Time::localtimehas been upgraded from version1.03to1.04.Time::tmhas been upgraded from version1.00to1.01.UNIVERSALhas been upgraded from version1.15to1.17.User::grenthas been upgraded from version1.04to1.05.User::pwenthas been upgraded from version1.02to1.03.versionhas been upgraded from version0.9929to0.9930.warningshas been upgraded from version1.65to1.69.XS::APItesthas been upgraded from version1.32to1.36.XS::Typemaphas been upgraded from version0.19to0.20.
and that's the whole roll call β everybody accounted for, nobody left on read ππ¦
π Documentation π
π Changes to Existing Documentation π
So like, we tried to update the docs to match everything in this document. If you find one we missed, please open an issue at https://github.com/Perl/perl5/issues. π«Ά
And also, these selected changes happened:
perlapi
- Corrected the docs for
Perl_form,form_nocontext, andvform, which had claimed that any later call to one of them will destroy the previous returns from any of them. That has not been true since 5.6.0 β except it does remain true if these are called during global destruction. With that caveat noted, the return of each of these is a fresh string in a temporary that will automatically be freed by a call toFREETMPSin perlapi, or at places such as statement boundaries. - Several internal functions now have documentation β the various
newSUBfunctions,newANONLIST(),newANONHASH(),newSVREF()and similar. π
perlclass
- Added a list of known bugs in the experimental
classfeature. (It's experimental bestie, we're being honest about it. π)
perlfunc
- The documentation for
local,my,our, andstatehas been updated to include examples and descriptions of their effects within a statement.
perlguts
- A new section has been added which describes the experimental reference-counted argument stack build option (
PERL_RC_STACK).
perlclib
- Extensive guidance has been added for interfacing with the standard C library, including many more functions to avoid, and how to cope with locales and threads.
perlhacktips
- Document we can't use compound literals or array designators due to C++ compatibility. [GH #21073 β
https://github.com/Perl/perl5/issues/21073] - Document new functions
sv_mark_arenas()andsv_sweep_arenas()(which only exist onDEBUGGINGbuilds). - Added brief documentation for some tools useful when developing perl itself on Windows or Cygwin.
perllol
- Removed indirect object syntax in the
Dumpvalueexample.
perlre
- Removed statement suggesting
/pis a no-op.
perlref
- Documented ref assignment in list context (as part of the
refaliasingfeature).
perlop
- The section on the empty pattern
//has been amended to mention that the current dynamic scope is used to find the last successful match.
perlport
- The
-Sfile test has been meaningful on Win32 since 5.37.6. - The
-lfile test is now meaningful on Win32. - Some strange behaviour with
.at the end of names under Windows has been documented.
perlvar
- Added documentation for an alternative to
${^CAPTURE}.
π©Ί 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
Cannot use __CLASS__ outside of a method or field initializer expressionβ (F) A__CLASS__expression yields the class name of the object instance executing the current method, and therefore it can only be placed inside an actual method (or method-like expression, such as a field initializer expression). No sneaking it in anywhere else, periodt.get_layers: unknown argument '%s'β (F) You calledPerlIO::get_layers()with an unknown argument. Legal arguments are provided in key/value pairs, with the keys being one ofinput,outputordetail, followed by a boolean.UNIVERSAL does not export anythingβ (F) You asked UNIVERSAL to export something, but UNIVERSAL is the base class for all classes and contains no exportable symbols. Like, it literally has nothing to give you. πBuiltin version bundle "%s" is not supported by Perlβ (F) You attempted touse builtin :verfor a version number that is either older than 5.39 (when the ability was added), or newer than the current perl version.Invalid version bundle "%s"β (F) A version number that is used to specify an import bundle during ause builtin ...statement must be formatted as:MAJOR.MINORwith an optional third component, which is ignored. Each component must be a number of 1 to 3 digits. No other characters are permitted. The value that was specified does not conform to these rules.Missing comma after first argument to returnβ (F) While certain operators allow you to specify a filehandle or an "indirect object" before the argument list,returnisn't one of them. Sorry bestie, no special treatment. πOut of memory during vec in lvalue contextβ (F) An attempt was made to extend a string beyond the largest possible memory allocation by assigning tovec()called with a large second argument.
(This case used to throw a generic Out of memory! error.)
Cannot create an object of incomplete class "%s"β (F) An attempt was made to create an object of a class where the start of the class definition has been seen, but the class has not been completed.
This can happen for a failed eval, or if you attempt to create an object at compile time before the class is complete:
eval "class Foo {"; Foo->new; # error
class Bar { BEGIN { Bar->new } }; # error
Previously perl would assert or crash. [GH #22159 β https://github.com/Perl/perl5/issues/22159]
New Warnings
Forked open '%s' not meaningful in <>β (S inplace) You had|-or-|in @ARGV and tried to use<>to read from it.
Previously this would fork and produce a confusing error message. [GH #21176 β https://github.com/Perl/perl5/issues/21176]
Attempt to call undefined %s method with arguments ("%s"%s) via package "%s" (Perhaps you forgot to load the package?)β (D deprecated::missing_import_called_with_args) You called the import() or unimport() method of a class that has no import method defined in its inheritance graph, and passed an argument to the method. This is very often the sign of a misspelled package name in a use or require statement that has silently succeeded due to a case insensitive file system. π
Another common reason this may happen is when mistakenly attempting to import or unimport a symbol from a class definition or package which does not use Exporter or otherwise define its own import or unimport method.
π§ Changes to Existing Diagnostics π§
Name "%s::%s" used only once: possible typo
This warning now honors being marked as fatal. [GH #13814 β https://github.com/Perl/perl5/issues/13814]
Out of memory in perl:%s
There used to be several places in the perl core that would print a generic Out of memory! message and abort when memory allocation failed, giving no indication which program it was that ran out of memory. These have been modified to include the word perl and the general area of the allocation failure, e.g. Out of memory in perl:util:safesysrealloc. [GH #21672 β https://github.com/Perl/perl5/issues/21672]
Possible precedence issue with control flow operator (%s)
This warning now mentions the name of the control flow operator that triggered the diagnostic (e.g. return, exit, die, etc).
It also covers more cases: Previously, the warning was only triggered if a low-precedence logical operator (like and, or, xor) was involved. Now it is also shown for misleading code like this:
exit $x ? 0 : 1; # actually parses as: exit($x) ? 0 : 1;
exit $x == 0; # actually parses as: exit($x) == 0;
Use of uninitialized value%s
This warning is now slightly more accurate in cases involving length, pop, shift, or splice:
my $x;
length($x) == 0
# Before:
# Use of uninitialized value $x in numeric eq (==) at ...
# Now:
# Use of uninitialized value length($x) in numeric eq (==) at ...
That is, the warning no longer implies that $x was used directly as an operand of ==, which it wasn't.
Similarly:
my @xs;
shift @xs == 0
# Before:
# Use of uninitialized value within @xs in numeric eq (==) at ...
# Now:
# Use of uninitialized value shift(@xs) in numeric eq (==) at ...
This is more accurate because there never was an undef within @xs as the warning implied. (The warning for pop works analogously.)
Finally:
my @xs = (1, 2, 3);
splice(@xs, 0, 0) == 0
# Before:
# Use of uninitialized value within @xs in numeric eq (==) at ...
# Now:
# Use of uninitialized value in numeric eq (==) at ...
That is, in cases where splice returns undef, it no longer unconditionally blames its first argument. This was misleading because splice can return undef even if none of its arguments contain undef.
[GH #21930 β https://github.com/Perl/perl5/issues/21930]
Old package separator "'" deprecated
Prevent this warning appearing spuriously when checking the heuristic for the You need to quote "%s" warning. [GH #22145 β https://github.com/Perl/perl5/issues/22145]
βοΈ Configuration and Compilation βοΈ
microperl, long broken and of unclear present purpose, has been removed as promised in Perl 5.18. Bye bestie, you will not be missed. π- Fix here-doc used for code to probe
LC_ALLsyntax for disparate locales introduced in 5.39.2. [GH #21451 βhttps://github.com/Perl/perl5/issues/21451] - You can now separately enable high water mark checks for non-DEBUGGING or disable them for DEBUGGING builds with
-Accflags=-DPERL_USE_HWMor-Accflags=-DPERL_NO_HWMrespectively. The default remains the same. [GH #16607 βhttps://github.com/Perl/perl5/issues/16607]
π Testing π
So like, tests got added and changed to match all the other glow-ups in this release, obvi. But also, these specific iconique changes happened:
- Update
nmoutput parsing for Darwin int/porting/libperl.t, because Darwin'snmdecided to switch up its whole vibe and the parsing had to keep up.[GH #21117]https://github.com/Perl/perl5/issues/21117 t/op/magic.twas literally failing wheneverpswas the BusyBox implementation, because BusyBox'spsdoes NOT do the-pflag and just, like, ignores a process id on the command-line entirely. Rude. This caused TEST failures on BusyBox systems such as Alpine Linux.[GH #17542]https://github.com/Perl/perl5/issues/17542porting/globvar.tnow uses the way more portablenm -P ...to fetch the names defined in an object file. And the parsing of the names found in the object is now separated from processing them, so it can handle the duplication between local and global definitions on AIX.[GH #21637]https://github.com/Perl/perl5/issues/21637- A test got added to
lib/locale_threads.tthat extensively stress tests locale handling. And bestie, plot twist: it turns out thelibcimplementations on various platforms have bugs in this regard π« β including Linux, Windows, *BSD derivatives including Darwin, and others. Experimental versions of this test have been used in the past few years to find bugs in the Perl implementation AND in those platforms, plus to develop workarounds in the Perl implementation, where feasible, for the platform bugs. Multiple bug report tickets have been filed against platforms, and some have been fixed. The test checks that platforms that purport to support thread-safe locale handling actually do so (and that perl works properly on those that do; the read-only variable${^SAFE_LOCALES}is set to 1 if perl thinks the platform can handle this, whatever the platform's documentation says β no cap).
Also tested for is if the various locale categories can indeed be set independently to disparate locales. (An example of where you might want to do this is if you are a Western Canadian living and working in Holland. You likely will want to have the LC_MONETARY locale be set to where you are living, but have the other parts of your locale retain your native English values. Later, as you get a bit more comfortable with Dutch, and in order to communicate better with your colleagues, you might want to change LC_TIME and LC_NUMERIC to Dutch, while leaving LC_CTYPE and LC_COLLATE set to English indefinitely. ππ³π± iconic honestly)
- The test
t/porting/libperl.twill no longer run in maint releases. This test is sensitive to changes in the output ofnmon various platforms, and tarballs aren't updated as we update this test in blead.[GH #21677]https://github.com/Perl/perl5/issues/21677
π Platform Support π
π¦ New Platforms π¦
π Serenity OS π
Out of the box support for Serenity OS was added. Slay. β¨
πΈ Platform-Specific Notes πΈ
πͺ Windows πͺ
- Eliminated several header build warnings under MSVC with
/W4to reduce noise for embedders.[GH #21031]https://github.com/Perl/perl5/issues/21031 - Work around a bug in most 32-bit Mingw builds, where the generated code β including the code in the gcc support library β assumes 16-byte stack alignment, which 32-bit Windows does not preserve.
[GH #21313]https://github.com/Perl/perl5/issues/21313 - Enable
copysign,signbit,acosh,asinh,atanh,exp2,tgammain the bundled configuration used for MSVC.[GH #21610]https://github.com/Perl/perl5/issues/21610 - The build process no longer supports Visual Studio 2013. It was failing to build at a very basic level and there have been no reports of such failures.
[GH #21624]https://github.com/Perl/perl5/issues/21624
π§ Linux π§
The hints file has been updated to handle the Intel oneAPI DPC++/C++ compiler. β¨
π MacOS/Darwin π
Don't set MACOSX_DEPLOYMENT_TARGET when building on OS X 10.5. [GH #21367] https://github.com/Perl/perl5/issues/21367
π VMS π
Fixed the configure installation prefix prompt to accept a string rather than yes/no.
Fixed compilation by defining proper value for perl_lc_all_category_positions_init.
Increased buffer size when reading config_H.SH to fix compilation under clang.
π Oracle Developer Studio (Solaris, Oracle Linux) π
Due to an apparent code generation bug, the default optimization level for the Oracle Developer Studio (formerly Sun Workshop) compiler is now -xO1. [GH #21535] https://github.com/Perl/perl5/issues/21535
π§ Internal Changes π§
PERL_RC_STACKbuild option added.
This new build option is highly experimental and is not enabled by default. Perl can be built with it by using the Configure option -Accflags='-DPERL_RC_STACK'.
It makes the argument stack bump the reference count of SVs pushed onto it. It is mostly functional, but currently slow and incomplete.
It is intended in the long term that this build option will become the default option, and then finally the only option; but this will be many releases away.
In particular, there is currently no support within XS code for using these new features. So under this build option, all XS functions are called via a backwards-compatibility wrapper which slows down such calls.
In future releases, better support for XS code is intended to be added. It is expected that straightforward XS code will eventually be able to make use of a reference-counted stack without modification, with any heavy lifting being handled by the XS compiler (xsubpp) and the macros which it outputs. But code which implements PP() functions will eventually have to be modified to use a new PP API: rpp_foo() rather than PUSHs() etc. But this new API is not yet stable, nor has it yet been back-ported via Devel::PPPort.
See perlguts for more details.
- A new API function has been added that simplifies C (or XS) code that creates
LISTOPoptree fragments.newLISTOPn()is a variadic function that takes aNULL-terminated list of child op pointers, and constructs a new checkedLISTOPto contain them all. This is simpler than creating a new plainOP_LIST, adding each child individually, and finally callingop_convert_list()in most code fragments. - The
eval_sv()API now accepts theG_USEHINTSflag, which uses the hints such as strict and features fromPL_curcopinstead of the default, which is to use default hints, e.g. nouse vX.XX;, no strict, default features.
Beware if you use this flag in XS code: your evaluated code will need to support whatever strictness or features are in effect at the point your XS function is called.
[GH #21415] https://github.com/Perl/perl5/issues/21415
PERL_VERSION_LEhas been fixed to properly check for less than or equal rather than less than. πdAX,dITEMSand hencedXSARGSnow declareAXanditemsasStack_off_trather thanSSize_t. This reverts back to compatibility with pre-64-bit stack support for default builds of perl whereStack_off_tisI32.[GH #21782]https://github.com/Perl/perl5/issues/21782- A new function is now available to
XScode,sv_langinfoin perlapi. This provides the same information as the existingPerl_langinfo8in perlapi, but returns an SV instead of achar *, so that programmers don't have to concern themselves with the UTF-8ness of the result. This new function is now the preferred interface forXScode to thenl_langinfo(3)libcfunction. From Perl space, this information continues to be provided by theI18N::Langinfomodule. - glibc has an undocumented equivalent function to
querylocale(), which our experience indicates is reliable. When this is function is used, it removes the need for perl to keep its own records, hence is more efficient and guaranteed to be accurate. Use of this function can be disabled by defining theNO_NL_LOCALE_NAMEbuild option - The
SYRIAC COLON SKEWED LEFT/RIGHTdelimiter pair got un-invited from the ones thatextra_paired_delimitersrecognizes (peep"Quote and Quote-like Operators"in perlop for the lore). Why? Because bestie, those characters are normally written right-to-left, and that was giving visual confusion vibes πͺοΈ [GH #22228]. Lowkey the actual change was to forbid any right-to-left delimiters, but this pair is the only current instance that meets that criterion. And by policy, that meansextra_paired_delimiterscan't be considered to have been stable long enough for its experimental status to be removed. So it stays experimental, periodt π use 5.36;or later was NOT enabling the post parse reporting ofName "%s::%s" used only once: possible typowarnings when you enable warnings π [GH #21271]. Fixed!- Fixed a crash or assertion when cleaning up a closure that refers to an outside
oursub π [GH #21067]. - Fixed a whole bunch of issues where
I32was used as a string offset or size instead ofSSize_torSTRLEN/size_t[GH #21012]. It's giving "wrong type bestie" energy. ~$strwhen$strwas more than 2GB in size would do literally nothing or produce an incomplete result π. Not anymore.- String repeat,
$str x $count, didn't handle$strover 2GB in size and just threw an error π« . Now those strings get repeated properly, slay. - Complex substitution after the 2GB point in a string could access incorrect or invalid offsets in the string. Yikes. Fixed β¨
sv_utf8_decode()would truncate the SV'spos()value. Ngl this wasn't even visible throughutf8::decode()π- When compiling a constant folded hash key, the length was getting truncated when creating the shared SV. Since hash keys over 2GB are not supported, it now throws a compilation error instead π«
msgrcv()incorrectly called get magic on the buffer SV and failed to call set magic on completion [GH #21012].msgrcv()used the size parameter to resize the buffer before validating it [GH #21012]. Rude. Fixed.- Inheriting from a class that was hierarchically an ancestor of the new class, eg.
class A::B :isa(A) { ... }, would not attempt to load the parent class [GH #21332]. Now it does π - Declared references can now be used with
statevariables [GH #21351] π - Trailing elements in an
unshifted and resized array will now always be initialized [GH #21265]. - Make
use 5.036respect the -X flag π
perl's -X flag disables all warnings globally, but Β«use 5.036Β» didn't respect that until now [GH #21431].
- Fixed an OP leak when an error was produced for initializer for a class field [GH #20812].
- Fixed a leak of the return value when smartmatching against a code reference π«Ά
- Fixed a slowdown in repeated substitution replacements using special variables, such as
s/....x$1/g. Fr fr it actually makes all string concatenations involving such "magic" variables less slow, but the slowdown was more noticeable on repeated substitutions because of extra memory usage that was only freed after the last iteration. The slowdown started in perl 5.28.0 β which generally sped up string concatenation but slowed down when using special variables π€ [GH #21360] - Lexical names from the enclosing scope in a lexical sub or closure weren't visible to code executed by calling
eval EXPR;from theDBpackage π. This was introduced in 5.18 in an attempt to prevent subs from retaining a reference to their outer scope, but it broke the special behaviour ofeval EXPR;in package DB.
This incidentally fixed a TODO test for B::Deparse π [GH #19370]
- Optionally support an argument stack over
2**32entries on 64-bit platforms. Heads up tho β this requires 32GB of memory just for the argument stack pointers itself, so you will require a significantly more memory to take advantage of this π³
To enable this add -Accflags=-DPERL_STACK_OFFSET_SSIZET or equivalent to the Configure command-line.
[GH #20917] [GH #21523]
- Fixed various problems with
join()where modifications to the separator could be handled inconsistently, or could access released memory π¬. Changes to the separator from magic or overloading for values in theLISTno longer have an effect on the resulting joined string [GH #21458]. - Don't clear the integer flag
IOKfrom lines in the@{"_<$sourcefile"}array when adbstateop is removed for that line. This was broken when fixing [GH #19198] π [GH #21564] - Many bug fixes have been made for using locales under threads and in embedded perls. And workarounds for libc bugs have been added π οΈ. As a result thread-safe locale handling is now the default under OpenBSD, and MingW when compiled with UCRT β¨
However, testing has shown that Darwin's implementation of thread-safe locale handling has bugs. So now Perl doesn't attempt to use the thread-safe operations when compiled on Darwin π
As before, you can check to see if your program is running with thread-safe locales by checking if the value of ${^SAFE_LOCALES} is 1.
- Various bugs have been fixed when perl is configured with
-Accflags=-DNO_LOCALE_NUMERICor any other locale category (or categories) π - Not all locale categories need be set to the same locale. Perl now works around bugs in the libc implementations of locale handling on some platforms that previously could result in mojibake π΅βπ«
LC_ALLis represented in one of two ways when not all locale categories are set to the same locale. On some platforms, such as Linux and Windows, the representation is of the form of a series ofcategory=locale-namepairs. On other platforms, such as *BSD, the representation is positional likename1 / name2 / ....name1is always for a particular category as defined by the platform, as are the other names. The sequence that separates the names (the/above) also varies by platform. Previously, perl had problems with platforms that used the positional notation. This is now fixed π- A bug has been fixed in the regexp engine with an optimisation that applies to the
+quantifier where it was followed by a(*SKIP)pattern π¦ [GH #21534] - The tmps (mortal) stack now grows exponentially π. Previously it grew linearly, so if it was growing incrementally, such as through many calls to
sv_2mortal(), on a system whererealloc()isO(size), the performance would beO(n*n). With exponential growth this changes to amortizedO(n)[GH #21654]. Math ate, honestly. - Lexical subs now have a new stub in the pad for each recursive call into the containing function. This fixes two problems:
- If the lexical sub called the containing function, a
Can't undef active subroutineerror would be thrown π. For example:
- If the lexical sub called the containing function, a
use v5.36.0;
sub outer($oc) {
my sub inner ($c) {
outer($c-1) if $c; # Can't undef active subroutine
}
inner($oc);
}
outer(2);
[GH #18606]
- If the lexical sub was called from a recursive call into the containing function, this would overwrite the bindings to the closed over variables in the lexical sub, so calls into the lexical sub from the outer recursive call would have access to the variables from the inner recursive call π:
use v5.36.0;
sub outer ($x) {
my sub inner ($label) {
say "$label $x";
}
inner("first");
outer("inner") if $x eq "outer";
# this call to inner() sees the wrong $x
inner("second");
}
outer("outer");
[GH #21987]
prepare_export_lexical()was separately savingPL_comppadandPL_curpad, this could result inPL_curpadbeing restored to a no longer valid value, resulting in a panic when importing lexicals in some cases π± [GH #21981]- A string
eval()operation in the scope of ause VERSIONdeclaration would sometimes emit spuriousDowngrading a use VERSION declarationwarnings due to an inconsistency in the way the version number was stored. This is now fixed π [GH #22121]
π KNOWN PROBLEMS π
- perlivp is missing streamzip on Windows π
The streamzip utility does not get installed on Windows but should get installed. It's giving unfinished business.
π ERRATA FROM PREVIOUS RELEASES π
perl5300deltahas been updated to include the removal of thearybasemodule that happened at the same time as the removal of$[π«‘
π ACKNOWLEDGEMENTS π
Okay bestie, sit down, because this part is the awards show of the whole page. Perl 5.40.0 is roughly 11 months of development on top of Perl 5.38.0, and it packs about 160,000 lines of changes across 1,500 files from 75 authors. Iconic behaviour, honestly. π
And if we don't count auto-generated files, documentation and release tools? Still about 110,000 lines of changes touching 1,200 .pm, .t, .c and .h files. The dedication. The grind. periodt. β¨
Perl keeps flourishing into its fourth decade thanks to a vibrant community of users and developers, and these are the people known to have contributed the improvements that became Perl 5.40.0 β roll call, no cap:
- Abe Timmerman
- Alexander Kanavin
- Amory Meltzer
- Aristotle Pagaltzis
- Arne Johannessen
- Beckett Normington
- Bernard Quatermass
- Bernd
- Bruno Meneguele
- Chad Granum
- Chris 'BinGOs' Williams
- Christoph Lamprecht
- Craig A. Berry
- Dagfinn Ilmari MannsΓ₯ker
- Dan Book
- Dan Church
- Daniel BΓΆhmer
- Dan Jacobson
- Dan Kogai
- David Golden
- David Mitchell
- E. Choroba
- Elvin Aslanov
- Erik Huelsmann
- Eugen Konkov
- Gianni Ceccarelli
- Graham Knop
- Greg Kennedy
- guoguangwu
- Hauke D
- H.Merijn Brand
- Hugo van der Sanden
- iabyn
- Jake Hamby
- Jakub Wilk
- James E Keenan
- James Raspass
- Joe McMahon
- Johan Vromans
- John Karr
- Karen Etheridge
- Karl Williamson
- Leon Timmermans
- Lukas Mai
- Marco Fontani
- Marek Rouchal
- Martijn Lievaart
- Mathias Kende
- Matthew Horsfall
- Max Maischein
- Nicolas Mendoza
- Nicolas R
- OpossumPetya
- Paul Evans
- Paul Marquess
- Peter John Acklam
- Philippe Bruhat (BooK)
- Raul E Rangel
- Renee Baecker
- Ricardo Signes
- Richard Leach
- Scott Baker
- Sevan Janiyan
- Sisyphus
- Steve Hay
- TAKAI Kousuke
- Todd Rinaldo
- Tomasz Konojacki
- Tom Hughes
- Tony Cook
- William Lyu
- x-yuri
- Yves Orton
- Zakariyya Mughal
- ΠΠΈΠ»ΡΠ½ ΠΠ°Π»Π°ΡΠ·ΠΎΠ²
Now the honest bit, and I'm saying it with love: that list above is almost certainly incomplete, because it's automatically generated from version control history. Specifically, it does not include the names of the (very much appreciated π«Ά) contributors who reported issues to the Perl bug tracker. They're legends too, fr fr.
Also lowkey important: many of the changes in this version originated in the CPAN modules included in Perl's core, and we're grateful to the entire CPAN community for helping Perl to flourish. π
Want the full, exhaustive, historical contributor lore? Please see the AUTHORS file in the Perl source distribution. π¦
π REPORTING BUGS π
Found something that feels like a bug? First move: go check the perl bug database at <https://github.com/Perl/perl5/issues>. There may also be info at <https://www.perl.org/>, the Perl Home Page. π
If you genuinely believe you've got an unreported bug, please open an issue at <https://github.com/Perl/perl5/issues>. And bestie, please β trim your bug down to a tiny but sufficient test case. Tiny. Sufficient. Chef's kiss. π
Heads up for the serious ones: if the bug you're reporting has security implications which make it inappropriate to send to a public issue tracker, then see"SECURITY VULNERABILITY CONTACT INFORMATION"inperlsecfor details of how to report the issue. Do it that way. Please. π
π GIVE THANKS π
Wanna thank the Perl 5 Porters for the work they did in Perl 5? You can. Just run the perlthanks program:
perlthanks
That sends an email to the Perl 5 Porters list with your show of thanks. Go be sweet, you'll make someone's whole day. π₯ΉπΈ
π SEE ALSO π
- The
Changesfile β for an explanation of how to view exhaustive details on what changed. - The
INSTALLfile β for how to build Perl. - The
READMEfile β for general stuff. - The
ArtisticandCopyingfiles β for copyright information.
And that's a wrap on the whole page, bestie. π This one's from perl v5.44.0, dated 2026-10-17, filed as PERL5400DELTA(1perl) β so go read your deltas, go run perlthanks, and go be the main character of your own changelog. slay π
β¨π
π¦ where this page comes from
- arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms