PERL5380DELTA(1perl)
โจ NAME โจ
perl5380delta โ bestie, this is literally what is new for perl v5.38.0. It lives in the Perl Programmers Reference Guide (you'll see it filed as PERL5380DELTA(1perl) up top) ๐
๐ DESCRIPTION ๐
Okay so this page spills all the tea on the differences between the 5.36.0 release and the 5.38.0 release. That's it, that's the whole job. ๐ธ
๐ฅ Core Enhancements ๐ฅ
๐ New "class" Feature ๐
So there's a brand new experimental syntax for defining object classes, where per-instance data lives in field variables that act exactly like lexicals. Iconic behaviour, honestly:
use feature 'class';
class Point
{
field $x;
field $y;
method zero { $x = $y = 0; }
}
The full breakdown lives in perlclass. And if you're the kind of girl who wants the internals, the implementation notes and assorted related details are in perlclassguts. ๐
Heads up bestie: this is still a new and experimental feature, and it is very much still under development. It's gonna get a lot more added to it, refined, and altered in future releases. And because it's experimental, it throws warnings in theexperimental::classcategory. You can shush them with ano warningsstatement:
use feature 'class';
no warnings 'experimental::class';
๐ Unicode 15.0 is supported ๐
Go look at <https://www.unicode.org/versions/Unicode15.0.0/> for the details, bestie. ๐
๐จ Deprecation warnings now have specific subcategories ๐จ
All deprecation warnings now have their own specific deprecation category that you can disable individually. You can see a list of all deprecated features in perldeprecation, and in warnings. This next list is straight outta warnings:
+- deprecated ----+
| |
| +- deprecated::apostrophe_as_package_separator
| |
| +- deprecated::delimiter_will_be_paired
| |
| +- deprecated::dot_in_inc
| |
| +- deprecated::goto_construct
| |
| +- deprecated::smartmatch
| |
| +- deprecated::unicode_property_name
| |
| +- deprecated::version_downgrade
You can still disable all deprecation warnings in one single statement with
no warnings 'deprecated';
but now you get finer grained control. And like it's always been, these warnings are automatically enabled with
use warnings;
๐ช %{^HOOK} API introduced ๐ช
So, for various reasons it can be genuinely difficult to create subroutine wrappers for some of perl's keywords. Any keyword with an undefined prototype simply cannot be wrapped with a subroutine, and some keywords that perl does permit you to wrap are, in practice, extremely tricky to wrap. For example, require is tricky โ it's possible, but doing so changes the stack depth, and the standard methods of exporting assume they'll be exporting to a package at a certain stack depth up the stack, so the wrapper will change where functions get exported to unless it's implemented with a great deal of care. Awkward. Very awkward. ๐ญ
So accordingly, we've introduced a new hash called %{^HOOK} which is meant to make those cases easier. When a keyword supports any kind of special hook, that hook lives in this new hash. Hooks in this hash get named after the function they're called by, followed by two underbars, and then the phase they're executed in โ currently that's either before or after the keyword is executed.
In this initial release we support two hooks: require__before and require__after. They're there to make it easier to do stuff before and after a require statement. ๐ซถ
See perlvar for more details.
๐ฒ PERL_RAND_SEED ๐ฒ
New environment variable just dropped: PERL_RAND_SEED. Use it to make a perl program that calls rand without explicitly calling srand(), or that calls srand() with no arguments, become repeatable. See perlrun. โจ
And if you want this feature gone at compile time, pass this to Configure during the build process:
-Accflags=-DNO_PERL_RAND_SEED
๐ซ Defined-or and logical-or assignment default expressions in signatures ๐ซ
The default expression for a subroutine signature parameter can now be assigned with the //= or ||= operators, so the defaults apply whenever the caller handed over an undefined or false value (respectively) โ not just when the parameter is missing entirely. More detail is in the docs in perlsub. ๐
๐ฆ @INC Hook Enhancements and $INC and INCDIR ๐ฆ
The internals for @INC hooks have been hardened to handle various edge cases, and they should no longer segfault or throw assert failures when hooks modify @INC during a require operation. As part of this, we now make sure that any given hook is executed at most once during a require call, and that any duplicate directories don't trigger extra directory probes. No cap.
To give developers more control over dynamic module lookup, a new hook method INCDIR is now supported. An object supporting this method can be injected into the @INC array, and when it's encountered during the module search process it will be executed โ exactly like how INC hooks are executed โ and its return value gets used as the list of directories to search for the module. Returning an empty list acts as a no-op. ๐
But listen: since any references returned by this hook will be stringified and used as strings, you may not return a hook to be executed later via this API. Periodt.
When an @INC hook (either INC or INCDIR) is called during require, the $INC variable gets localized to be the value of the index of @INC that the hook came from. If the hook wants to override what the "next" index in @INC should be, it may update $INC to be one less than the desired index (undef is equivalent to -1). This lets an @INC hook completely rewrite the @INC array and have perl restart its directory probes from the beginning of @INC. ๐
Blessed CODE references in @INC that don't support the INC or INCDIR methods will no longer trigger an exception โ instead they get treated the same as unblessed coderefs are, and executed as though they were an INC hook. So chill. ๐
๐ Forbidden control flow out of "defer" or "finally" now detected at compile-time ๐
It is forbidden to try to leave a defer or finally block by means of control flow like return or goto. Previous versions of perl could only catch this when it was actually attempted at runtime.
This version of perl adds compile-time detection for lots of cases that can be statically determined. Which means code that compiled successfully on a previous version of perl might now get reported as a compile-time error with this one. But bestie, don't panic โ this only happens in cases where it would have been an error to actually execute the code anyway. The error just shows up at an earlier time. ๐
๐ฎ Optimistic Eval in Patterns ๐ฎ
Using (?{ ... }) and (??{ ... }) in a pattern disables various optimisations globally in that pattern. Which you may or may not want, honestly. This release adds the (*{ ... }) equivalent. The only difference is that it does not โ and never will โ disable any optimisations in the regex engine. โจ
Now, this may make it more unstable in the sense that it may be called more or less times in the future. However, the number of times it executes will truly match how the regex engine functions. For example, certain types of optimisation are disabled when (?{ ... }) is included in a pattern, so patterns that are O(N) in normal use become O(N*N) with a (?{ ... }) pattern in them. Switching to (*{ ... }) means the pattern stays O(N). Slay. ๐
๐ REG_INF has been raised from 65,536 to 2,147,483,647 ๐
Many regex quantifiers used to be limited to U16_MAX in the past, but are now limited to I32_MAX โ so now you can write things like /(?:word){1000000}/. โญ
Warning though: doing that may cause the regex engine to run longer and use more memory. You've been warned, babe. ๐ซ
๐ ๏ธ New API functions optimize_optree and finalize_optree ๐ ๏ธ
There are two new API functions for operating on optree fragments, so you can actually invoke the required parts of the optree-generation process that might otherwise not get invoked (e.g. when creating a custom LOGOP). ๐
To get access to these functions, you first need to set a #define to opt in to using them:
#define PERL_USE_VOLATILE_API
These functions are closely tied to the internals of how the interpreter works, and could be altered or removed at any time if other internal changes make that necessary. Don't get attached. ๐
๐ช Some "goto"s are now permitted in "defer" and "finally" blocks ๐ช
Perl version 5.36.0 added defer blocks, and permitted the finally keyword to add similar behaviour to try/catch syntax. Those did not permit any goto expression within the body, because it could have caused control flow to jump out of the block. But now, some goto expressions are allowed โ if they have a constant target label, and that label is found within the block. ๐
use feature 'defer';
defer {
goto LABEL;
print "This does not execute\n";
LABEL: print "This does\n";
}
๐ง New regexp variable ${^LAST_SUCCESSFUL_PATTERN} ๐ง
This gives you access to the last successful pattern that matched in the current scope. Lots of aspects of the regex engine refer to the "last successful pattern" โ the empty pattern reuses it, and all of the magic regex vars relate to it. This gives you access to its pattern. So this code:
if (m/foo/ || m/bar/) {
s//PQR/;
}
can be rewritten as:
if (m/foo/ || m/bar/) {
s/${^LAST_SUCCESSFUL_PATTERN}/PQR/;
}
and it will do the exactly same thing. Iconic. ๐
๐ Locale category LC_NAME now supported on participating platforms ๐
On platforms that have the GNU extension LC_NAME category, you may now use it as the category parameter to setlocale in POSIX to set and query its locale. Go off. ๐๐ธ
โจ Incompatible Changes โจ
Okay bestie, these are the glow-downs โ stuff that changed and might break your old code. No cap, read carefully. ๐
readline() no longer clears the stream error and eof flags ๐
So readline() โ which you also know and love as <> โ used to be out here clearing the handle's error and eof flags after an error occurred on the stream. Convenient? Rude? Both.
In nearly all cases, that clear is no longer done, so the error and eof flags now properly reflect the status of the stream after readline(). It's giving honest. Periodt.
Since the error flag is no longer cleared, calling close() on the stream may fail, and if the stream wasn't explicitly closed, the implicit close of the stream may produce a warning. ๐ญ
This has resulted in two main types of problems in downstream CPAN modules, and these may also occur in your code:
- If your code reads to end of file, and then rebinds the handle to a new file descriptor, previously โ since the
eofflag wasn't set โ you could continue to read from the stream. You now need to clear theeofflag yourself with$handle->clearerr()to continue reading. Slay, but manually. โจ - If your code encounters an error on the stream while reading with
readline(), you will need to call$handle->clearerrto continue reading. The one case this occurred, the underlying file descriptor was marked non-blocking, so theread()system call was failing withEAGAIN, which resulted in theerrorflag being set on the stream. ๐
The only case where error and eof flags continue to be cleared on error is when reading from the child process for glob() in miniperl. This allows it to correctly report errors from the child process on close(). This is unlikely to be an issue during normal perl development. ๐ซถ
[GH #20060 <https://github.com/Perl/perl5/issues/20060>]
INIT blocks no longer run after an exit() in BEGIN ๐ฆ
INIT blocks will no longer run after an exit() performed inside of a BEGIN. So if you were counting on that, bestie, it's a no.
This means that the combination of the -v option and the -c option no longer executes a compile check as well as showing the perl version. The -v option executes an exit(0) after printing the version information inside of a BEGIN block, and the -c check is implemented by using INIT hooks, resulting in the -v option taking precedence. ๐
[GH #1537 <https://github.com/Perl/perl5/issues/1537>] [GH #20181 <https://github.com/Perl/perl5/issues/20181>]
Syntax errors no longer produce "phantom error messages" ๐
Generally perl will continue parsing the source code even after encountering a compile error. In many cases this is helpful โ for instance with misspelled variable names, it is helpful to show as many examples of the error as possible. But in the case of syntax errors, continuing often produces bizarre error messages and may even cause segmentation faults during the compile process. Not cute. Not iconic.
In this release, the compiler will halt at the first syntax error encountered. This means that any code expecting to see the specific error messages we used to produce will be broken. The error that is emitted will be one of the diagnostics that used to be produced, but in some cases some messages that used to be produced will no longer be displayed. ๐ญ
See "Changes to Existing Diagnostics" for more details.
utf8::upgrade() ๐ฑ
Starting in this release, if the input string is undef, it remains undef. Previously it would be changed into a defined, zero-length string. That's it. That's the tea. ๐ต
Changes to "thread-safe" locales ๐
Perl 5.28 introduced "thread-safe" locales on systems that supported them โ namely modern Windows, and systems supporting POSIX 2008 locale operations. These systems accomplish this by having per-thread locales, while continuing to support the older global locale operations for code that doesn't take the steps necessary to use the newer per-thread ones. It's a whole dual-vibe. โจ
It turns out that some POSIX 2008 platforms have or have had buggy implementations, which forced perl to not use them. The ${^SAFE_LOCALES} scalar variable contains 0 or 1 to indicate whether or not the current platform is considered by perl to have a working thread-safe implementation. Some implementations have been fixed already, but FreeBSD and Cygwin have been newly discovered to be sufficiently buggy that the thread-safe operations are no longer used by perl, starting in this release. Hence, ${^SAFE_LOCALES} is now 0 for them. Older versions of perl can be configured to avoid these buggy implementations by adding the Configure option -DNO_POSIX_2008_LOCALE. ๐ง
And v5.38 fixes a bug in all previous perls that led to locales not being fully thread-safe. The first thread that finishes caused the main thread (named thread0) to revert to the global locale in effect at startup, discarding whatever the thread's locale had been previously set to. If any other thread had switched to the global locale by calling switch_to_global_locale() in XS code, those threads would all share the global locale, and thread0 would not be thread-safe. Big yikes, but fixed now. ๐
Deprecations โ ๏ธ
Use of "'" as a package name separator is deprecated ๐ซ
Using "'" as package separator in a variable named in a double-quoted string has warned since 5.28. It is now deprecated in both string interpolation and non-interpolated contexts, and will be removed in Perl 5.42. So maybe start packing your bags, bestie. ๐งณ
Switch and Smart Match operator ๐
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. We've been through it. ๐ฎโ๐จ
In v5.38.0, we are declaring the experiment a failure. Some future system may take the conceptual place of smartmatch, but it has not yet been designed or built. So don't hold your breath. ๐ซ
These features will be entirely removed from perl in v5.42.0. Periodt. ๐
Performance Enhancements ๐๐ฅ
- Additional optree optimizations for common OP patterns. For example, multiple simple OPs replaced by a single streamlined OP, so as to be more efficient at runtime.
[GH #19943 <https://github.com/Perl/perl5/pull/19943>],[GH #20063 <https://github.com/Perl/perl5/pull/20063>],[GH #20077 <https://github.com/Perl/perl5/pull/20077>]. Slay. โจ - Creating an anonymous sub no longer generates an
srefgenop, the reference generation is now done in theanoncodeoranonconstop, saving runtime.[GH #20290 <https://github.com/Perl/perl5/pull/20290>]๐
โจ Modules and Pragmata โจ
Okay so bestie, this is the glow-up section, and the modules literally ate. ๐ No cap, it's giving upgrade era, fr fr. Letโs get into it. ๐ฆ
๐ Updated Modules and Pragmata ๐
is_tainted()โ okay so they literally added this builtin function, no cap. [GH #19854 https://github.com/Perl/perl5/issues/19854]export_lexically()โ added as a builtin function, as per PPC 0020 https://github.com/Perl/PPCs/blob/main/ppcs/ppc0020-lexical-export.md. [GH #19895 https://github.com/Perl/perl5/issues/19895]- Support for PPC 0018 โ https://github.com/Perl/PPCs/blob/main/ppcs/ppc0018-module-true.md, so like,
use feature "module_true";has been added to the default feature bundle for v5.38 and later. It may also be used explicitly. When enabled inside of a module, the module does not need to return true explicitly, and in fact the return will be forced to a simple true value regardless of what it originally was. Periodt. ๐ Attribute::Handlersโ upgraded from version1.02to1.03. โจattributesโ upgraded from version0.34to0.35.autodieโ upgraded from version2.34to2.36.Bโ upgraded from version1.83to1.88.B::Conciseโ upgraded from version1.006to1.007.B::Deparseโ upgraded from version1.64to1.74.Benchmarkโ upgraded from version1.23to1.24.bignumโ upgraded from version0.65to0.66.Carpโ upgraded from version1.52to1.54.Class::Structโ upgraded from version0.66to0.68.Compress::Raw::Bzip2โ upgraded from version2.103to2.204_001.Compress::Raw::Zlibโ upgraded from version2.105to2.204_001.Config::Perl::Vโ upgraded from version0.33to0.36.CPANโ upgraded from version2.33to2.36.Data::Dumperโ upgraded from version2.184to2.188.DB_Fileโ upgraded from version1.857to1.858.Devel::Peekโ upgraded from version1.32to1.33.Devel::PPPortโ upgraded from version3.68to3.71.Digest::MD5โ upgraded from version2.58to2.58_01.Digest::SHAโ upgraded from version6.02to6.04.DynaLoaderโ upgraded from version1.52to1.54.Encodeโ upgraded from version3.17to3.19.encoding::warningsโ upgraded from version0.13to0.14.Envโ upgraded from version1.05to1.06.Errnoโ upgraded from version1.36to1.37.experimentalโ upgraded from version0.028to0.031.ExtUtils::CBuilderโ upgraded from version0.280236to0.280238.ExtUtils::Installโ upgraded from version2.20to2.22.ExtUtils::MakeMakerโ upgraded from version7.64to7.70.ExtUtils::Miniperlโ upgraded from version1.11to1.13.ExtUtils::ParseXSโ upgraded from version3.45to3.51.ExtUtils::PL2Batโ upgraded from version0.004to0.005.ExtUtils::Typemapsโ upgraded from version3.45to3.51.featureโ upgraded from version1.72to1.82.File::Basenameโ upgraded from version2.85to2.86.File::Copyโ upgraded from version2.39to2.41.File::Findโ upgraded from version1.40to1.43.File::Globโ upgraded from version1.37to1.40.File::Specโ upgraded from version3.84to3.89.File::statโ upgraded from version1.12to1.13.FileHandleโ upgraded from version2.03to2.05.Filter::Util::Callโ upgraded from version1.60to1.64.GDBM_Fileโ upgraded from version1.23to1.24.Getopt::Longโ upgraded from version2.52to2.54.Hash::Utilโ upgraded from version0.28to0.30.HTTP::Tinyโ upgraded from version0.080to0.083.I18N::Langinfoโ upgraded from version0.21to0.22.IOโ upgraded from version1.50to1.52.IO-Compressโ upgraded from version2.106to2.204.IO::Socket::IPโ upgraded from version0.41to0.41_01. ๐- On DragonflyBSD, detect
setsockopt()not actually clearing"IPV6_V6ONLY"even whensetsockopt()returns success. [cpan #148293 https://rt.cpan.org/Ticket/Display.html?id=148293]
- On DragonflyBSD, detect
IO::Zlibโ upgraded from version1.11to1.14.JSON::PPโ upgraded from version4.07to4.16.libnetโ upgraded from version3.14to3.15.Locale::Maketextโ upgraded from version1.31to1.33.Math::BigIntโ upgraded from version1.999830to1.999837.Math::BigInt::FastCalcโ upgraded from version0.5012to0.5013.Math::BigRatโ upgraded from version0.2621to0.2624.Math::Complexโ upgraded from version1.5902to1.62.Memoizeโ upgraded from version1.03_01to1.16.MIME::Base64โ upgraded from version3.16to3.16_01.Module::CoreListโ upgraded from version5.20220520to5.20230520.mroโ upgraded from version1.26to1.28.NDBM_Fileโ upgraded from version1.15to1.16.Net::Pingโ upgraded from version2.74to2.76.ODBM_Fileโ upgraded from version1.17to1.18.Opcodeโ upgraded from version1.57to1.64.overloadโ upgraded from version1.35to1.37.parentโ upgraded from version0.238to0.241.PerlIO::via::QuotedPrintโ upgraded from version0.09to0.10.Pod::Checkerโ upgraded from version1.74to1.75.Pod::Htmlโ upgraded from version1.33to1.34.Pod::Usageโ upgraded from version2.01to2.03.podlatorsโ upgraded from version4.14to5.01.POSIXโ upgraded from version2.03to2.13.reโ upgraded from version0.43to0.44.Safeโ upgraded from version2.43to2.44.Scalar::Utilโ upgraded from version1.62to1.63.SDBM_Fileโ upgraded from version1.15to1.17.Socketโ upgraded from version2.033to2.036.Storableโ upgraded from version3.26to3.32.Sys::Hostnameโ upgraded from version1.24to1.25.Term::Capโ upgraded from version1.17to1.18.Test::Simpleโ upgraded from version1.302190to1.302194.Text::Balancedโ upgraded from version2.04to2.06.threadsโ upgraded from version2.27to2.36.threads::sharedโ upgraded from version1.64to1.68.Tie::Fileโ upgraded from version1.06to1.07.Time::HiResโ upgraded from version1.9770to1.9775.Time::Pieceโ upgraded from version1.3401to1.3401_01.Unicode::Normalizeโ upgraded from version1.31to1.32.UNIVERSALโ upgraded from version1.14to1.15.User::grentโ upgraded from version1.03to1.04.User::pwentโ upgraded from version1.01to1.02.utf8โ upgraded from version1.24to1.25.warningsโ upgraded from version1.58to1.65.XS::APItestโ upgraded from version1.22to1.32.XSLoaderโ upgraded from version0.31to0.32.
โจ Documentation โจ
Okay so the docs got some love too. ๐
๐ New Documentation ๐
perlclassโ describes the new"class"feature. It's giving main character energy. ๐perlclassgutsโ describes the internals of the new"class"feature. The behind-the-scenes tea. โ
๐ Changes to Existing Documentation ๐
We have attempted to update the documentation to reflect the changes listed in this document. If you find any we have missed, open an issue at https://github.com/Perl/perl5/issues. No cap, they want your feedback. ๐
Additionally, the following selected changes have been made:
perlapi
- Documented
"hv_ksplit"๐ - Documented
"hv_name_set"๐ "hv_store"and"hv_stores"documentation have been greatly improved. Slay. โจ- Documented
"gv_autoload_pv" - Documented
"gv_autoload_pvn" - Documented
"gv_autoload_sv" - Documented
"gv_name_set" - Documented
"start_subparse" - Documented
"SV_CHECK_THINKFIRST_COW_DROP" - Documented
"SV_CHECK_THINKFIRST" - Documented
"SvPV_shrink_to_cur" - Documented
"save_aelem" - Documented
"save_aelem_flags" - Documented
"save_helem" - Documented
"save_helem_flags"
perldeprecation
- Added information about unscheduled deprecations and their categories. ๐
- Added category information for existing scheduled deprecations. ๐๏ธ
- Added smartmatch and apostrophe as a package separator deprecation data. ๐
perlintern
- Documented
"save_pushptr" - Documented
"save_scalar_at" - Entries have been added to perlguts for the new
"newAV_alloc_x","newAV_alloc_xz"and*_simplefunctions. ๐ง - References to the now-defunct PrePAN service have been removed from perlcommunity and perlmodstyle. Rip PrePAN. ๐ชฆ
- A section on symbol naming has been added to perlhacktips. โจ
- perlexperiment has been edited to properly reference the warning categories for the defer block modifier and extra paired delimiters for quote-like operators. ๐
perlexperiment
- Smartmatch has been moved from experimental status to deprecated status. Unfortunately the experiment did not work out. ๐ญ It's giving flop era.
perlfunc
- Some wording improvements have been made for the
"ucfirst","push","unshift"and"bless"functions, as well as additional examples added. ๐
perlhacktips
- A new section,
"Writing safer macros"in perlhacktips has been added to discuss pitfalls and solutions to using C macros in C and XS code. ๐ ๏ธ - A new section,
"Choosing good symbol names"in perlhacktips, has been added to discuss unexpected gotchas with names. ๐ค
perlop
- Document the behavior of matching the empty pattern better and specify its relationship to the new
"${^LAST_SUCCESSFUL_PATTERN}"properly. ๐
perlvar
- Added a section on
"Scoping Rules of Regex Variables", and other wording improvements made throughout. ๐ - Added information on the new
"%{^HOOK}"interface, and the new"require__before"and"require__after"hooks which it exposes. ๐ช - Correct information on the regex variables
"${^PREMATCH}","${^MATCH}"and"${^POSTMATCH}", all of which were incorrectly documented due to an oversight. Specifically they only work properly after a regex operation that used the/pmodifier to enable them. ๐ - Added information on the new regex variable
"${^LAST_SUCCESSFUL_PATTERN}", which represents the pattern of the last successful regex match in scope. ๐
DIAGNOSTICS ๐
okay bestie, this whole section is about diagnostic output โ warnings, fatal errors, all the little messages perl yells at you when stuff goes sideways ๐
. 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 ๐จ
- A new syntax error has been added for the error that a
catchblock does not have its required variable declaration. Seecatch block requires a (VAR). Too many nested BEGIN blocks, maximum of %d allowedExecution of %s aborted due to compilation errors.Can't locate object method "INC", nor "INCDIR" nor string overload via package "%s" %s in @INCAttempt to bless into a classโ (F) You are attempting to callblesswith a package name that is a new-styleclass. This is not necessary, as instances created by the constructor are already in the correct class. Instances cannot be created by other means, such asbless.Cannot assign :param(%s) to field %s because that name is already in useโ (F) An attempt was made to apply a parameter name to a field, when the name is already being used by another field in the same class, or one of its parent classes. This would cause a name clash so is not allowed.Cannot create class %s as it already has a non-empty @ISAโ (F) An attempt was made to create a class out of a package that already has an@ISAarray, and the array is not empty. This is not permitted, as it would lead to a class with inconsistent inheritance.Cannot invoke a method of "%s" on an instance of "%s"โ (F) You tried to directly call amethodsubroutine of one class by passing in a value that is an instance of a different class. This is not permitted, as the method would not have access to the correct instance fields.Cannot invoke method on a non-instanceโ (F) You tried to directly call amethodsubroutine of a class by passing in a value that is not an instance of that class. This is not permitted, as the method would not then have access to its instance fields.Cannot '%s' outside of a 'class'โ (F) You attempted to use one of the keywords that only makes sense inside aclassdefinition, at a location that is not inside such a class.Cannot reopen existing class "%s"โ (F) You tried to begin aclassdefinition for a class that already exists. A class may only have one definition block.Can't bless an object referenceโ (F) You attempted to callblesson a value that already refers to a real object instance.can't convert empty pathโ (F) On Cygwin, you called a path conversion function with an empty path. Only non-empty paths are legal.Class already has a superclass, cannot add anotherโ (F) You attempted to specify a second superclass for aclassby using the:isaattribute, when one is already specified. Unlike classes whose instances are created withbless, classes created via theclasskeyword cannot have more than one superclass.Class attribute %s requires a valueโ (F) You specified an attribute for a class that would require a value to be passed in parentheses, but did not provide one. Remember that whitespace is not permitted between the attribute name and its value; you must write this as
class Example::Class :attr(VALUE) ...
Class :isa attribute requires a class but "%s" is not oneโ (F) When creating a subclass using theclass:isaattribute, the named superclass must also be a real class created using theclasskeyword.Field already has a parameter name, cannot add anotherโ (F) A field may have at most one application of the:paramattribute to assign a parameter name to it; once applied a second one is not allowed.Field attribute %s requires a valueโ (F) You specified an attribute for a field that would require a value to be passed in parentheses, but did not provide one. Remember that whitespace is not permitted between the attribute name and its value; you must write this as
field $var :attr(VALUE) ...
Field %s is not accessible outside a methodโ (F) An attempt was made to access a field variable of a class from code that does not appear inside the body of amethodsubroutine. This is not permitted, as only methods will have access to the fields of an instance.Field %s of "%s" is not accessible in a method of "%s"โ (F) An attempt was made to access a field variable of a class, from a method of another class nested inside the one that actually defined it. This is not permitted, as only methods defined by a given class are permitted to access fields of that class.Only scalar fields can take a :param attributeโ (F) You tried to apply the:paramattribute to an array or hash field. Currently this is not permitted.Required parameter '%s' is missing for %s constructorโ (F) You called the constructor for a class that has a required named parameter, but did not pass that parameter at all.Unexpected characters while parsing class :isa attribute: %sโ (F) You tried to specify something other than a single class name with an optional trailing version number as the value for aclass:isaattribute. This confused the parser.Unrecognized class attribute %sโ (F) You attempted to add a named attribute to aclassdefinition, but perl does not recognise the name of the requested attribute.Unrecognized field attribute %sโ (F) You attempted to add a named attribute to afielddefinition, but perl does not recognise the name of the requested attribute.${^HOOK}{%s} may only be a CODE reference or undefAttempt to set unknown hook '%s' in %{^HOOK}Missing or undefined argument to %s via %{^HOOK}{require__before}Too many capture groups (limit is %d) in regex m/%s/
New Warnings โ ๏ธ
Unknown locale category %dโ This is a shortened form of an already existing diagnostic, for use when there is no new locale being switched to. The previous diagnostic was misleading in such circumstances.Locale '%s' is unsupported, and may crash the interpreter.Treating %s::INIT block as BEGIN block as workaroundFilehandle STD%s reopened as %s only for input%s on BEGIN block ignoredADJUST is experimentalโ (S experimental::class) This warning is emitted if you use theADJUSTkeyword ofuse feature 'class'. This keyword is currently experimental and its behaviour may change in future releases of Perl.class is experimentalโ (S experimental::class) This warning is emitted if you use theclasskeyword ofuse feature 'class'. This keyword is currently experimental and its behaviour may change in future releases of Perl.Method %s redefinedโ (W redefine) You redefined a method. To suppress this warning, say
{
no warnings 'redefine';
*name = method { ... };
}
Odd number of elements in hash field initializationโ (W misc) You specified an odd number of elements to initialise a hash field of an object. Hashes are initialised from a list of key/value pairs so there must be a corresponding value to every key. The final missing value will be filled in with undef instead.Old package separator "'" deprecatedโ (W deprecated, syntax) You used the old package separator'in a variable, subroutine or package name. Support for the old package separator will be removed in Perl 5.40.field is experimentalโ (S experimental::class) This warning is emitted if you use thefieldkeyword ofuse feature 'class'. This keyword is currently experimental and its behaviour may change in future releases of Perl.method is experimentalโ (S experimental::class) This warning is emitted if you use themethodkeyword ofuse feature 'class'. This keyword is currently experimental and its behaviour may change in future releases of Perl.Can't call destructor for 0x%p in global destruction
Changes to Existing Diagnostics ๐
- The compiler will now stop parsing on the first syntax error it encounters. Historically, the compiler would try to โskip pastโ the error and continue parsing so it could list multiple errors. For things like undeclared variables under
strict, that makes sense. For syntax errors, though, it has been found that continuing tends to result in a storm of unrelated or bizarre errors that mostly just obscure the true error. In extreme cases it can even lead to segfaults and other incorrect behavior.
Therefore, the continuation logic has been reformed so that the parse will stop after the first seen syntax error. Semantic errors like undeclared variables will not stop the parse, so you may still see multiple errors when compiling code. However, if there is a syntax error it will be the last error message reported by perl and all of the errors that you see will be something that actually needs to be fixed.
- Error messages that output class or package names have been modified to output double quoted strings with various characters escaped so as to make the exact value clear to a reader. The exact rules on which characters are escaped may change over time but currently are that printable ASCII codepoints, with the exception of
"and\, and Unicode word characters whose codepoint is over 255 are output raw, and any other symbols are escaped much asData::Dumpermight escape them, using\nfor newline and\"for double quotes, etc. Codepoints in the range 128-255 are always escaped as they can cause trouble on Unicode terminals when output raw.
In older versions of perl the one liner
$ perl -le'"thing\n"->foo()'
would output the following error message exactly as shown here, with text spread over multiple lines because the \n would be emitted as a raw newline character:
Can't locate object method "foo" via package "thing
" (perhaps you forgot to load "thing
"?) at -e line 1.
As of this release we would output this instead (as one line):
Can't locate object method "foo" via package "thing\n"
(perhaps you forgot to load "thing\n"?) at -e line 1.
Notice the newline in the package name has been quoted and escaped, so the error message comes out as one single line. It's only shown wrapped onto two lines here so you can actually read it ๐ .
- When package or class names in errors are very large, the middle excess portion gets elided from the message. As of this release, error messages show only up to the first 128 characters and the last 128 characters of a package or class name that's in an error message. Like, say you run:
$ perl -le'("Foo" x 1000)->new()'
it'll output the following as one line (wrapped here for readability only):
Can't locate object method "new" via package "FooFooFooFooFooFooFoo
FooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFoo
FooFooFooFooFooFooFooFooFooFooFooFooFooFo"..."oFooFooFooFooFooFooFoo
FooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFoo
FooFooFooFooFooFooFooFooFooFooFooFooFoo" (perhaps you forgot to load
"FooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFoo
FooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFo"...
"oFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFoo
FooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFoo
FooFooFooFooFooFooFooFooFooFooFooFooFoo"?)
at -e line 1.
Notice the "prefix"..."suffix" form of the package name in this case. In previous versions of perl the complete string would've been shown, making the error message over 6k long, and there was literally no upper limit on the length of the error message at all ๐ญ. If you accidentally used a 1MB string as a class name then the error message would be over 2MB long. In this perl the upper limit should be around 2k when eliding and escaping are taken into account.
- Removed
Complex regular subexpression recursion limit (%d) exceeded. The regular expression engine has not used recursion in some time, so this warning no longer makes sense. See GH #19636 โhttps://github.com/Perl/perl5/pull/19636. - Various warnings that used to produce parenthesized hints underneath the main warning message, and after its "location data", were changed to put the hint inline with the main message. For instance:
Bareword found where operator expected at -e line 1, near "foo bar"
(Do you need to predeclare foo?)
will now look like this, but as one line:
Bareword found where operator expected (Do you need to predeclare
foo?) at -e line 1, near "foo bar"
and as a result such warnings will no longer trigger $SIG{__WARN__} twice, and the hint will be visible when fatal warnings is in effect ๐.
- The error message produced when a
requireorusestatement fails has been changed. It used to contain the words@INC contains:, and it used to show the state of@INCafter the require had completed and failed. The error message has been changed to say@INC entries checked:and to reflect the actual directories or hooks that were executed during the require statement. For example:
perl -e'push @INC, sub {@INC=()}; eval "require Frobnitz"
or die $@'
Can't locate Frobnitz.pm in @INC (you may need to install the
Frobnitz module) (@INC contains:) at (eval 1) line 1.
will change to (with some output elided for clarity):
perl -e'push @INC, sub {@INC=()}; eval "require Frobnitz"
or die $@'
Can't locate Frobnitz.pm in @INC (you may need to install the
Frobnitz module) (@INC entries checked:
.../site_perl/5.38.0/x86_64-linux .../site_perl/5.38.0
.../5.38.0/x86_64-linux .../5.38.0 CODE(0x562745e684b8))
at (eval 1) line 1.
thus showing the actual directories checked ๐. Code that checks for @INC contains: in error messages should be hardened against any future wording changes between the @INC and :. For instance, use qr/\@INC[ \w]+:/ instead of using qr/\@INC contains:/ or qr/\@INC entries checked:/ in tests, because that way you get both forward and backward compatibility.
- Old package separator used in string โ this diagnostic is now also part of the
deprecatedcategory. given is deprecatedreplacesgiven is experimental.when is deprecatedreplaceswhen is experimental.Smartmatch is deprecatedreplacesSmartmatch is experimental.
โ๏ธ Configuration and Compilation โจ
make -j6 minitestcould fail due to a build conflict in building$(MINIPERL_EXE)between the main make process and a child process. GH #19829 โhttps://github.com/Perl/perl5/issues/19829- Properly populate osvers on Dragonfly BSD when the hostname isn't set.
- Fix typos for C99 macro name
PRIX64. - Remove ancient and broken GCC for VMS support
- Remove vestigial reference to
/VAXCqualifier - Remove sharedperl option on VMS
- VMS now has mkostemp
Configurenow properly handles quoted elements outputted by gcc. GH #20606 โhttps://github.com/Perl/perl5/issues/20606Configureprobed for the return type of malloc() and free() by testing whether declarations for those functions produced a function type mismatch with the implementation. On Solaris, with a C++ compiler, this check always failed, since Solaris instead imports malloc() and free() fromstd::withusingfor C++ builds. Since the return types of malloc() and free() are well defined by the C standard, skip probing for them.Configurecommand-line arguments and hints can still override these type in the unlikely case that is needed. GH #20806 โhttps://github.com/Perl/perl5/issues/20806
๐งช Testing ๐งช
Tests were added and changed to reflect the other additions and changes in this release. Furthermore, these significant changes were made:
- Unicode normalization tests have been added.
t/test.pl: Add ability to cancel a watchdog timer
๐ Platform Support ๐
๐ Discontinued Platforms ๐
Ultrix
Support code for DEC Ultrix has been removed ๐. Ultrix was the native Unix-like operating system for various Digital Equipment Corporation machines. Its final release was in 1995. Rip bestie ๐ซก.
๐ Platform-Specific Notes ๐
DragonflyBSD
Skip tests to workaround an apparent bug in setproctitle(). GH #19894 โ https://github.com/Perl/perl5/issues/19894
FreeBSD
FreeBSD no longer uses thread-safe locale operations, to avoid a bug in FreeBSD โ https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265950
Replace the first part of archname with uname -p GH #19791 โ https://github.com/Perl/perl5/issues/19791
Solaris
Avoid some compiler and compilation issues on NetBSD/Solaris from regexec.c and regcomp.c.
Synology
Update Synology Readme for DSM 7.
Windows
Fix win32 memory alignment needed for gcc-12 from vmem.h.
utimes() on Win32 would print a message to stderr if it failed to convert a supplied time_t to a FILETIME. GH #19668 โ https://github.com/Perl/perl5/issues/19668
In some cases, timestamps returned by stat() and lstat() failed to take daylight saving time into account. GH #20018 โ https://github.com/Perl/perl5/issues/20018 โ GH #20061 โ https://github.com/Perl/perl5/issues/20061
stat() now works on AF_UNIX socket files. GH #20204 โ https://github.com/Perl/perl5/issues/20204
readlink() now returns the PrintName from a symbolic link reparse point instead of the SubstituteName, which should make it better match the name the link was created with. GH #20271 โ https://github.com/Perl/perl5/pull/20271
lstat() on Windows now returns the length of the link target as the size of the file, as it does on POSIX systems. GH #20476 โ https://github.com/Perl/perl5/issues/20476
symlink() on Windows now replaces any / in the target with \, since Windows does not recognise / in symbolic links. The reverse translation is not done by readlink(). GH #20506 โ https://github.com/Perl/perl5/issues/20506
symlink() where the target was an absolute path to a directory was incorrectly created as a file symbolic link. GH #20533 โ https://github.com/Perl/perl5/issues/20533
POSIX::dup2 no longer creates broken sockets. GH #20920 โ https://github.com/Perl/perl5/issues/20920
Closing a busy pipe could cause Perl to hang. GH #19963 โ https://github.com/Perl/perl5/issues/19963
๐ ๏ธ Internal Changes ๐ ๏ธ
okay bestie, this part is all the nerdy behind-the-scenes glow-up stuff ๐ like nobody's gonna see it from the outside but the whole vibe of the core got retouched. buckle up, it's a long list, let's go ๐ซถ
- so many deprecated C functions got deleted, periodt. they'd been deprecated for forever (like, embarrassingly long, ngl). full list is right here if you wanna scroll:
https://github.com/perl/perl5/commit/7008caa915ad99e650acf2aea40612b5e48b7ba2 get_op_descs,get_op_names,get_opargs,get_no_modifyandget_ppaddrhave been marked deprecated. ๐ it's giving "we still love you but from a distance"hv_free_enthas been marked as internal API.save_pushptr,save_pushptrptr, andsave_pushi32ptrhave been marked as internal API. (yes babe all three, don't try to use them, they're locked in their room ๐ช)- new bool-related functions and macros have been added to complement the new bool type that showed up back in 5.36 โจ the functions are:
newSVbool(const bool bool_val)newSV_true()newSV_false()sv_set_true(SV *sv)sv_set_false(SV *sv)sv_set_bool(SV *sv, const bool bool_val)
and the macros are:
SvIandPOK(sv)SvIandPOK_off(sv)SvIandPOK_on
- Perl is no longer manipulating the
environarray directly. the variablePL_use_safe_putenvhas been removed andPERL_USE_SAFE_PUTENVis always defined. what does that mean for you, bestie? it means XS modules can now callsetenvandputenvwithout causing segfaults ๐ญ๐ iconic behaviour. [perl #19399https://github.com/Perl/perl5/issues/19399] - internal C API functions are now hidden with
__attribute__((hidden))on the platforms that support it. the consequence is real: they are no longer callable from XS modules on those platforms. ๐
ngl those functions have always been hidden on Windows. this change just brought that same energy to everywhere else. not a plot twist, just catching up. [perl #19655 https://github.com/Perl/perl5/pull/19655]
- new formatting symbols were added for printing values declared as
U32orI32:I32dfโ like%dU32ofโ like%oU32ufโ like%uU32xfโ like%xU32Xfโ like%X
you use these the same way as the already-existing similar symbols, like IVdf. see "I/O Formats" in perlapi if you need the receipts ๐งพ
- new
'HvHasAUX'macro โจ regexec.c: add some branch predictions, reorder conds. lowkey just tidying the place up ๐งนlocale: change macro name to be C conformant.- rename the
PADNAMEt_*constants toPADNAMEf_*๐ค - changes all the API macros that retrieve a PV into a call to an inline function, so as to evaluate the parameter just once. efficiency era ๐
regexec.c: multiple code refactors to make the code more readable. it's giving "we cleaned our room and now we can think" ๐๏ธโจperl.h: change macro name to be C conformant (remove leading_fromNOT_IN_NUMERICmacros).regcomp.h: add newBITMAP_BITmacro in addition to the existingBITMAP_BYTEandBITMAP_TESTones. the trio is complete ๐ฅ- create new regnode type
ANYOFH.populate_ANYOF_from_invlistwas renamed topopulate_bitmap_from_invlist. regex: refactor bitmap vs non-bitmap ofqr/[]/๐ฆregcomp.c: add new functions to convert from an inversion list to a bitmap (and vice versa) โpopulate_bitmap_from_invlistandpopulate_invlist_from_bitmap. both directions, we do not play favourites ๐- add
newAVav()to create an AV from an existing AV. addnewAVhv()to create an AV using keys and values from an existing HV. two new besties on the block ๐ซถ - fix definition of
Perl_atof. โ - fix undefined behavior with overflow related
OPTIMIZE_INFTYand delta inregcomp.c. - fix regnode pointer alignment issue in
regcomp.h. - the
CVf_METHODCV flag and the associatedCvMETHODmacro have been renamed toCVf_NOWARN_AMBIGUOUSandCvNOWARN_AMBIGUOUS. why? because the new name closer reflects its actual behaviour (it suppresses a warning that would otherwise be generated about ambiguous names), so it's way less confusing next toCvIsMETHOD, which actually indicates a CV is a"method"subroutine relating to the"class"feature. names matter babes ๐ - the
OPf_SPECIALflag is no longer set on theOP_ENTERSUBop constructed to call theVERSION,importandunimportmethods as part of ausestatement and attribute application, nor when assigning to an:lvaluesubroutine. - a new CV flag
CVf_REFCOUNTED_ANYSVhas been added. it indicates the CV is an XSUB and stores an SV pointer in theCvXSUBANY.any_svunion field. Perl core operations like cloning or destroying the CV will maintain the reference count of the pointed-to SV, destroying it when required. responsible memory management is the moment ๐ - a new API function,
"Perl_localeconv"in perlapi, is added. it's the same asPOSIX::localeconv(returning a hash of thelocaleconv()fields), but directly callable from XS code. so convenient โจ - a new API function,
"Perl_langinfo8"in perlapi, is added. same as plain"Perl_langinfo"in perlapi, but with an extra parameter that lets the caller simply and reliably know if the returned string is UTF-8. ๐ - we have introduced a limit on the number of nested
eval EXPR/BEGINblocks andrequire/BEGIN(and thususestatements as well) to prevent C stack overflows. this variable can also be used to forbidBEGINblocks from executing duringeval EXPRcompilation. the limit defaults to 1000 but can be overridden by setting the${^MAX_NESTED_EVAL_BEGIN_BLOCKS}variable. the default itself can be changed at compile time with:
-Accflags='-DPERL_MAX_NESTED_EVAL_BEGIN_BLOCKS_DEFAULT=12345'
โ ๏ธ heads up bestie: this value relates to the size of your C stack, and if you choose an inappropriately large value Perl may segfault. be conservative about what you choose. do not just crank it to a million for fun, i am begging ๐
- a new magic type
PERL_MAGIC_extvaluehas been added. it's available for use likePERL_MAGIC_ext, but it's a value magic: upon localization the new value will not be magical. subtle but iconic โจ - the
SSNEW(),SSNEWt(),SSNEWa()andSSNEWat()APIs now return aSSize_tvalue. theSSPTR()andSSPTRt()macros now expect aSSize_tparameter, and enforce that on debugging builds. [GH #20411https://github.com/Perl/perl5/issues/20411] - filenames in cops are now refcounted under threads. under threads we used to copy the filenames into each opcode (because in theory opcodes created in one thread can be destroyed in another, messy). the change adds a new struct/type
RCPV, which is a refcounted string using shared memory. it's implemented in such a way that code that previously used achar *can continue to do so, because the refcounting data is located at a specific offset before thechar *pointer itself. sneaky genius fr fr ๐ง - added
HvNAMEfandHvNAMEf_QUOTEDPREFIXspecial formats. they take anHV *as an argument and useHvNAME()and related macros to determine the string, its length, and whether it is utf8. ๐ - the underlying
Perl_dowantarrayfunction implementing the long-deprecatedGIMMEmacro has been marked as deprecated, so that use of the macro emits a compile-time warning.GIMMEhas been documented as deprecated in favour ofGIMME_Vsince Perl v5.6.0, but had not previously issued a warning. okay so it was always on thin ice, now the ice is actually cracking ๐ - the API function
utf8_lengthin perlapi is now more efficient. go off king ๐ - added
SAVERCPV()andSAVEFREERCPV()for better support for working withRCPV(reference counted string/pointer value) structures, which currently are used in opcodes to share filename and warning bit data in a memory efficient manner. memory efficient AND fancy, the duality ๐ - added
MORTALSVFUNC_SV()andMORTALDESTRUCTOR_SV()macros, which make it possible to create a destructor that is fired at the end of the current statement. this uses thePERL_MAGIC_destructmagic to usefreemagic to trigger an action when a variable is freed. the action can be specified as a C function or as a Perl code reference. choose your fighter ๐ - added the
%{^HOOK}api and relatedPERL_MAGIC_hookandPERL_MAGIC_hookelemfor providing ways to hook selected perl functions which, for one reason or another, are problematic to wrap with a customized subroutine. sometimes you can't just put a lil jacket on it, you need a real hook ๐ช - added support for
${^HOOK}{require__before}which can be used to rewrite the filename thatrequirewill try to load, and also to blockrequirefrom loading a specific module โ even via fully qualified filename. the hook can also be used to perform"pre-require"and"post-require"actions. interfering lovingly ๐ - added support for
${^HOOK}{require__after}which can be used to track what modules have been required after the fact. detective energy ๐ต๏ธโโ๏ธ - regular expression opcodes (regops) now use a standardized structure layout that uses unions to expose data in different formats. this means it should be much easier to extend or modify regops to use more memory. and this has already been used to make a number of regops track how many parens they contain ๐๐
๐ฅ Selected Bug Fixes ๐ฅ
okay bestie, grab a snack, this is the glowy-up list of everything we fixed ๐
- No more recursion and stack overflow when parsing a
packtemplate, we said not today ๐ [GH #16319 <https://github.com/Perl/perl5/issues/16319>] - An
eval()sitting as the last statement inside a regex code block used to be able to trigger an interpreter panic, like this:
/(?{ ...; eval {....}; })/
[GH #19680 <https://github.com/Perl/perl5/issues/19680>]
- Turning off the
bareword_filehandlesfeature does not treatprint Class->methodas an error anymore. [GH #19704 <https://github.com/Perl/perl5/issues/19704>] - When a Perl sub tail-calls an XS sub with
goto &xs_sub, that XS sub can now actually figure out its calling context ๐ before this it was always reported as scalar.
Also, when the Perl sub gets freed at the same moment, like:
sub foo { *foo = sub {}; goto &xs_sub }
this used to be able to crash if the XS sub tried to use PL_op, because that was being set to NULL. Fixed now, bestie. [GH #19936 <https://github.com/Perl/perl5/issues/19936>]
setsockopt()now uses the mechanism that got added back in 5.36 to be better at telling numeric values apart from string values passed as theOPTVALparameter. [GH #18761 <https://github.com/Perl/perl5/issues/18761>]- The 4-argument
select()now rejects strings with code points above 255. And for code points 128-255, the operator now always gives the OS the corresponding octet, no matter how Perl happens to store those code points in memory. (Before this, Perl was literally leaking its internal string storage to the OS, embarrassing ๐) [GH #19882 <https://github.com/Perl/perl5/issues/19882>] - Fixed the panic situation coming from
val {} inside /(?{...})/. [GH #19390 <https://github.com/Perl/perl5/issues/19390>] - Fixed a whole pile of compiler warnings coming out of
regexp.candlocale.c. [GH #19915 <https://github.com/Perl/perl5/issues/19915>] - Fixed a bug with querying locales on platforms that don't have
LC_NUMERICat all. [GH #19890 <https://github.com/Perl/perl5/issues/19890>] - Stopped undefined behaviour in
S_maybe_multideref(). - Avoided signed integer overflow in
use integerops. - Avoided adding an offset to a
NULLpointer inhv_delete_common. PerlIO::get_layersnow accepts IO references too ๐
Before this it would only take glob references or names of globs. Now it also takes IO references. Slay.
- Fixes to memory handling for
PL_splitstr:- If a thread was created, the allocated string would be freed twice. ๐
- If two
-Fswitches were supplied, the memory allocated for the first switch wouldn't get freed.
- Correctly handle
OP_ANONCODEops generated by CPAN modules that don't include theOPf_REFflag when propagating lvalue context. [GH #20532 <https://github.com/Perl/perl5/pull/20532>] POSIX::strxfrmnow uses theLC_CTYPElocale category to specify its collation, ignoring any differingLC_COLLATE. It genuinely does not make sense for a string to be encoded in one locale (say, ISO-8859-6, Arabic) and then collated based on another one (like ISO-8859-7, Greek). Perl assumes the currentLC_CTYPElocale correctly represents the encoding, and collates accordingly. โจ
Also, embedded NUL characters are now allowed in the input.
If locale collation isn't enabled on the platform (LC_COLLATE), the input gets returned unchanged.
- Double FETCH during stringification of tied scalars returning an overloaded object has been fixed. The FETCH method should only be called once, but before this release it was actually called twice. ๐ญ [GH #20574 <https://github.com/Perl/perl5/pull/20574>]
- Writing to the magic variables tied to the selected output handle โ
$^,$~,$=,$-and$%โ no longer crashes perl if the IO object has been cleared from the selected output handle. [GH #20733 <https://github.com/Perl/perl5/issues/20733>] - Redefining a
use constantlist constant withuse constantnow properly warns. This changes the behaviour ofuse constant, but it's a core change, not a change toconstant.pm. [GH #20742 <https://github.com/Perl/perl5/issues/20742>] - Redefining a
use constantlist constant with an empty prototype constant sub used to result in an assertion failure. [GH #20742 <https://github.com/Perl/perl5/issues/20742>] - Fixed a regression where the
INCmethod for objects in@INCwould not be resolved byAUTOLOAD, while it was in 5.36. TheINCDIRmethod for objects in@INCcannot be resolved byAUTOLOADthe wayINCwould have been resolved first. [GH #20665 <https://github.com/Perl/perl5/issues/20665>] $SIG{__DIE__}will now be called from eval when the code dies during compilation, no matter how it dies. What this means is that code expecting to be able to upgrade$@into an object will be called consistently. In earlier versions of perl,$SIG{__DIE__}would not be called for certain compilation errors โ undeclared variables, for example. For other errors it might get called if there were more than a certain number of errors, but not if there were fewer. Now you can expect it will be called in every case. ๐ซถ- Compilation of code with errors used to stop inconsistently, depending on the count and type of errors it hit. The intent was that after 10 errors compilation would halt, but bugs in that logic meant certain types of error would get counted, but then would not trigger the threshold check that stops compilation. Other errors would. With this release, after at most 10 errors compilation will terminate, regardless of what type of error they were.
Heads up though: you can change that maximum count by defining PERL_STOP_PARSING_AFTER_N_ERRORS to be something else during the configuration process. For example:
./Configure ... -Accflags='-DPERL_STOP_PARSING_AFTER_N_ERRORS=100'
would allow up to 100 errors. ๐
- The API function
my_snprintfin perlapi now prints a non-dot decimal point if the perl code it ultimately gets called from is in the scope ofuse localeand the locale in effect calls for that. - A bunch of bugs related to capture groups inside quantified groups in regular expressions have been fixed, especially in alternations. For example, in a pattern like:
"foobazfoobar" =~ /((foo)baz|foo(bar))+/
the regex variable $2 will not be "foo" like it once was โ it will be undef.
- Bugs with regex backreference operators that sit inside a capture group have been fixed. For instance:
"xa=xaaa" =~ /^(xa|=?\1a){2}\z/
will now correctly not match. [GH #10073 <https://github.com/Perl/perl5/issues/10073>]
SSGROW()andSSCHECK()have been reworked to make sure the requested space is actually allocated.SSCHECK()is now an alias forSSGROW().
๐ซถ Acknowledgements ๐ซถ
Perl 5.38.0 represents approximately 12 months of development since Perl 5.36.0, and contains approximately 290,000 lines of changes across 1,500 files from 100 authors. no cap, that's a lot ๐
If we're excluding auto-generated files, documentation and release tools, there were approximately 190,000 lines of changes to 970 .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.38.0:
Alex, Alexander Nikolov, Alex Davies, Andreas Kรถnig, Andrew Fresh, Andrew Ruthven, Andy Lester, Aristotle Pagaltzis, Arne Johannessen, A. Sinan Unur, Bartosz Jarzyna, Bart Van Assche, Benjamin Smith, Bram, Branislav Zahradnรญk, Brian Greenfield, Bruce Gray, Chad Granum, Chris 'BinGOs' Williams, chromatic, Clemens Wasser, Craig A. Berry, Dagfinn Ilmari Mannsรฅker, Dan Book, danielnachun, Dan Jacobson, Dan Kogai, David Cantrell, David Golden, David Mitchell, E. Choroba, Ed J, Ed Sabol, Elvin Aslanov, Eric Herman, Felipe Gasper, Ferenc Erki, Firas Khalil Khana, Florian Weimer, Graham Knop, Hรฅkon Hรฆgland, Harald Jรถrg, H.Merijn Brand, Hugo van der Sanden, James E Keenan, James Raspass, jkahrman, Joe McMahon, Johan Vromans, Jonathan Stowe, Jon Gentle, Karen Etheridge, Karl Williamson, Kenichi Ishigaki, Kenneth รlwing, Kurt Fitzner, Leon Timmermans, Li Linjie, Loren Merritt, Lukas Mai, Marcel Telka, Mark Jason Dominus, Mark Shelor, Matthew Horsfall, Matthew O. Persico, Mattia Barbon, Max Maischein, Mohammad S Anwar, Nathan Mills, Neil Bowers, Nicholas Clark, Nicolas Mendoza, Nicolas R, Paul Evans, Paul Marquess, Peter John Acklam, Peter Levine, Philippe Bruhat (BooK), Reini Urban, Renee Baecker, Ricardo Signes, Richard Leach, Russ Allbery, Scott Baker, Sevan Janiyan, Sidney Markowitz, Sisyphus, Steve Hay, TAKAI Kousuke, Todd Rinaldo, Tomasz Konojacki, Tom Stellard, Tony Cook, Tsuyoshi Watanabe, Unicode Consortium, vsfos, Yves Orton, Zakariyya Mughal, Zefram, ๅฐ้ธก.
The list above is almost certainly incomplete, since it's 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. y'all are the real ones ๐
Many of the changes 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 something you think is a bug, you might want to check the perl bug database at <https://github.com/Perl/perl5/issues> first. There may also be info over at <http://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, be sure to trim your bug down to a tiny but sufficient test case, that's the move.
If the bug you're reporting has security implications that make it inappropriate to send to a public issue tracker, then check out "SECURITY VULNERABILITY CONTACT INFORMATION" in perlsec for the details on how to report it. ๐
๐ Give Thanks ๐
If you want to thank the Perl 5 Porters for the work we've done in Perl 5, you can do that by running the perlthanks program:
perlthanks
This will send an email to the Perl 5 Porters list with your show of thanks. it's giving gratitude, it's giving community ๐ฅน
๐ 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 the whole page, bestie!! ๐ฆ this was PERL5380DELTA(1perl), covering perl v5.44.0 and dated 2026-10-17 โ go forth and upgrade, ily, periodt ๐
โจ
๐ฆ 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