PERL5220DELTA(1perl)
perl5220delta ๐ the glow-up guide to perl v5.22.0
okay besties, gather round ๐ซถ this is perl5220delta, the manual page that spills ALL the tea on what's new in perl v5.22.0. it ships with Perl as part of the Perl Programmers Reference Guide, and it's gonna be a LOT, so hydrate ๐
โจ NAME โจ
perl5220delta โ literally what is new for perl v5.22.0, no cap.
๐ซ DESCRIPTION ๐ซ
So this doc walks through every single difference between the 5.20.0 release and the 5.22.0 release. that's the whole vibe ๐ธ
psst โ if you're upgrading from something even older, like 5.18.0, bestie you gotta read perl5200delta FIRST, because that one covers the glow-up from 5.18.0 to 5.20.0. don't skip steps ๐
๐ Core Enhancements ๐
girl, this is where the main character energy lives. buckle up ๐
๐ New bitwise operators
There's a brand new experimental facility that makes the four classic bitwise operators:
& | ^ ~
treat their operands consistently as numbers. and THEN it introduces four new dotted operators:
&. |. ^. ~.
which treat their operands consistently as strings. slay. and yes, the assignment variants came too:
&= |= ^= &.= |.= ^.=
To actually use this, you need to enable the bitwise feature AND disable the experimental::bitwise warnings category. See "Bitwise String Operators" in perlop for the deets. [GH #14348] <https://github.com/Perl/perl5/issues/14348>. ๐
๐ New double-diamond operator
<<>> is giving <> energy but leveled up โ it uses three-argument open to open each file in @ARGV. what that means for you: every element of @ARGV gets treated as an actual file name, and "|foo" will NOT be treated as a pipe open. no sneaky pipes, we're being safe here ๐ซถ
๐ฆ New \b boundaries in regular expressions
qr/\b{gcb}/
gcb stands for Grapheme Cluster Boundary. it's a Unicode property that finds the boundary between sequences of characters that look like a single character to a native speaker of a language. Perl has had the ability to deal with these for ages via the \X regular escape sequence, but now there's an alternative way to handle them. See "\b{}, \b, \B{}, \B" in perlrebackslash for details.
qr/\b{wb}/
wb stands for Word Boundary. it's a Unicode property that finds the boundary between words. it's similar to the plain \b (the one without braces, bestie) but way more suitable for natural language processing. for example, it knows apostrophes can occur in the middle of words ๐. See "\b{}, \b, \B{}, \B" in perlrebackslash for details.
qr/\b{sb}/
sb stands for Sentence Boundary. it's a Unicode property that helps with parsing natural language sentences. See "\b{}, \b, \B{}, \B" in perlrebackslash for details. ๐
๐ Non-Capturing Regular Expression Flag
Regular expressions now support a /n flag that disables capturing and filling in $1, $2, etc. inside of groups:
"hello" =~ /(hi|hello)/n; # $1 is not set
This is equivalent to putting ?: at the beginning of every capturing group. iconic. See "n" in perlre for more information.
๐ use re 'strict'
This applies stricter syntax rules to regular expression patterns compiled within its scope. the whole point is to (hopefully) alert you to typos and other unintentional behavior that backwards-compatibility issues prevent us from reporting in normal regular expression compilations. Because the behavior of this is subject to change in future Perl releases as we gain experience, using this pragma will raise a warning of category experimental::re_strict. See 'strict' in re.
๐ธ Unicode 7.0 (with correction) is now supported
For details on what's in this release, see <http://www.unicode.org/versions/Unicode7.0.0/>. The version of Unicode 7.0 that comes with Perl includes a correction dealing with glyph shaping in Arabic (see <http://www.unicode.org/errata/#current_errata/>). periodt ๐
โจ use locale can restrict which locale categories are affected
It's now possible to pass a parameter to use locale to specify a subset of locale categories to be locale-aware, with the remaining ones left unaffected. See "The "use locale" pragma" in perllocale for details.
๐ธ Perl now supports POSIX 2008 locale currency additions
On platforms that are able to handle POSIX.1-2008, the hash returned by POSIX::localeconv() includes the international currency fields added by that version of the POSIX standard. These are:
int_n_cs_precedesint_n_sep_by_spaceint_n_sign_posnint_p_cs_precedesint_p_sep_by_spaceint_p_sign_posn
money money money ๐ค lowkey obsessed.
๐ Better heuristics on older platforms for determining locale UTF-8ness
On platforms that implement neither the C99 standard nor the POSIX 2001 standard, determining if the current locale is UTF-8 or not depends on heuristics. Those got improved in this release. we love an upgrade ๐
๐ Aliasing via reference
Variables and subroutines can now be aliased by assigning to a reference:
\$c = \$d;
\&x = \&y;
Aliasing can also be accomplished by using a backslash before a foreach iterator variable โ and honestly? this is maybe the most useful idiom this feature provides:
foreach \%hash (@array_of_hash_refs) { ... }
โ ๏ธ This feature is experimental and must be enabled viause feature 'refaliasing';. It will warn unless theexperimental::refaliasingwarnings category is disabled.
See "Assigning to References" in perlref ๐ซถ
๐ prototype with no arguments
prototype() with no arguments now infers $_. [GH #14376] <https://github.com/Perl/perl5/issues/14376>. cute, convenient, iconic โจ
๐ New :const subroutine attribute
The const attribute can be applied to an anonymous subroutine. It causes the new sub to be executed immediately whenever one is created (i.e. when the sub expression is evaluated). Its value is captured and used to create a new constant subroutine that is returned. This feature is experimental. See "Constant Functions" in perlsub ๐
๐ fileno now works on directory handles
When the relevant support is available in the operating system, the fileno builtin now works on directory handles, yielding the underlying file descriptor in the same way as for filehandles. On operating systems without such support, fileno on a directory handle continues to return the undefined value, as before โ but it ALSO sets $! to indicate that the operation is not supported. so at least you get a heads up ๐
Currently, this uses either a dd_fd member in the OS DIR structure, or a dirfd(3) function as specified by POSIX.1-2008.
๐ฐ List form of pipe open implemented for Win32
The list form of pipe:
open my $fh, "-|", "program", @arguments;
is now implemented on Win32. It has the same limitations as "system LIST" on Win32, since the Win32 API doesn't accept program arguments as a list. them's the rules, bestie ๐ธ
๐ Assignment to list repetition
(...) x ... can now be used within a list that is assigned to, as long as the left-hand side is a valid lvalue. This lets
(undef,undef,$foo) = that_function()
be written as
((undef)x2, $foo) = that_function()
shorter, cleaner, slay โจ
โพ๏ธ Infinity and NaN (not-a-number) handling improved
Floating point values are able to hold the special values infinity, negative infinity, and NaN (not-a-number). Now we more robustly recognize and propagate the value in computations, and on output we normalize them to the strings "Inf", "-Inf", and "NaN".
See also the POSIX enhancements. ๐ฅ
๐ข Floating point parsing has been improved
Parsing and printing of floating point values has been improved.
As a completely new feature, hexadecimal floating point literals (like 0x1.23p-4) are now supported, and they can be output with printf "%a". See "Scalar value constructors" in perldata for more details. ๐
๐ Packing infinity or not-a-number into a character is now fatal
Before, when trying to pack infinity or not-a-number into a (signed) character, Perl would warn, and assumed you tried to pack 0xFF; if you gave it as an argument to chr, U+FFFD was returned.
but NOW? all such actions โpack,chr, andprint '%c'โ result in a fatal error. no more guessing, it just dies ๐ญ
๐ง Experimental C Backtrace API
Perl now supports (via a C level API) retrieving the C level backtrace โ similar to what symbolic debuggers like gdb do. main character debugging energy ๐ฅ
The backtrace returns the stack trace of the C call frames, with the symbol names (function names), the object names (like "perl"), and if it can, also the source code locations (file:line).
The supported platforms are Linux and OS X (some *BSD might work at least partly, but they have not yet been tested).
The feature needs to be enabled with Configure -Dusecbacktrace.
See "C backtrace" in perlhacktips for more information. ๐ฆ
๐ก๏ธ Security ๐ก๏ธ
protect ya neck, besties ๐
๐ Perl is now compiled with -fstack-protector-strong if available
Perl has been compiled with the anti-stack-smashing option -fstack-protector since 5.10.1. Now Perl uses the newer variant called -fstack-protector-strong, if available. upgraded armor โจ
๐จ The Safe module could allow outside packages to be replaced
Critical bugfix: outside packages could be replaced. Safe has been patched to 2.38 to address this. girl, that was a whole situation ๐
๐งฑ Perl is now always compiled with -D_FORTIFY_SOURCE=2 if available
The 'code hardening' option called _FORTIFY_SOURCE, available in gcc 4.*, is now always used for compiling Perl, if available.
Note that this isn't necessarily a huge step since in many platforms the step had already been taken several years ago: many Linux distributions (like Fedora) have been using this option for Perl, and OS X has enforced the same for many years. so it's more like... catching up, but official now ๐ซถ
๐ Incompatible Changes ๐
okay bestie, buckle up โ these are the glow-ups that might break your old code. but like, in a slay way. ๐
โจ Subroutine signatures moved before attributes โจ
so the experimental sub signatures thing? it landed in 5.20 and used to parse signatures after attributes. but the girlies gave feedback, and now the positioning is moved so signatures show up after the subroutine name (if there is one) and before the attribute list (if there is one). periodt. ๐
๐ & and \& prototypes accepts only subs ๐
the & prototype character is now super selective โ it only accepts anonymous subs (sub {...}), things beginning with \&, or an explicit undef. formerly it was messy and erroneously also allowed references to arrays, hashes, and lists. [GH #2776] <https://github.com/Perl/perl5/issues/2776>. [GH #14186] <https://github.com/Perl/perl5/issues/14186>. [GH #14353] <https://github.com/Perl/perl5/issues/14353>.
also, the \& prototype was out here allowing subroutine calls, but now it only allows subroutines: &foo is still permitted as an argument, while &foo() and foo() no longer are. [GH #10633] <https://github.com/Perl/perl5/issues/10633>.
๐ธ use encoding is now lexical ๐ธ
the encoding pragma's effect is now limited to lexical scope. this pragma is deprecated, but in the meantime, it could adversely affect unrelated modules that are included in the same program; this change fixes that. no more side-eye from your other modules. โจ
๐ฆ List slices returning empty lists ๐ฆ
list slices now return an empty list only if the original list was empty (or if there are no indices). formerly, a list slice would return an empty list if all indices fell outside the original list; now it returns a list of undef values in that case. [GH #12335] <https://github.com/Perl/perl5/issues/12335>. it's giving "actually, here's your undefs" ๐
๐ \N{} with a sequence of multiple spaces is now a fatal error ๐
e.g. \N{TOO MANY SPACES} or \N{TRAILING SPACE }. this has been deprecated since v5.18. so like, clean up your spaces, bestie. ๐ญ
๐ฅ use UNIVERSAL '...' is now a fatal error ๐ฅ
importing functions from UNIVERSAL has been deprecated since v5.12, and is now a fatal error. use UNIVERSAL without any arguments is still allowed. so don't come for UNIVERSAL with extra baggage. ๐
โจ In double-quotish \cX, X must now be a printable ASCII character โจ
in prior releases, failure to do this raised a deprecation warning. now it's a hard rule. no cap. ๐ซถ
๐ Splitting the tokens (? and (* in regular expressions is now a fatal compilation error ๐
these had been deprecated since v5.18. so yeah, don't split those tokens unless you want the compiler to yell at you. ๐
๐ qr/foo/x now ignores all Unicode pattern white space ๐
the /x regular expression modifier allows the pattern to contain white space and comments (both of which are ignored) for improved readability. until now, not all the white space characters that Unicode designates for this purpose were handled. the additional ones now recognized are:
U+0085 NEXT LINE
U+200E LEFT-TO-RIGHT MARK
U+200F RIGHT-TO-LEFT MARK
U+2028 LINE SEPARATOR
U+2029 PARAGRAPH SEPARATOR
the use of these characters with /x outside bracketed character classes and when not preceded by a backslash has raised a deprecation warning since v5.18. now they will be ignored. iconic. ๐
๐ Comment lines within (?[ ]) are now ended only by a \n ๐
(?[ ]) is an experimental feature, introduced in v5.18. it operates as if /x is always enabled. but there was a difference: comment lines (following a # character) were terminated by anything matching \R which includes all vertical whitespace, such as form feeds. for consistency, this is now changed to match what terminates comment lines outside (?[ ]), namely a \n (even if escaped), which is the same as what terminates a heredoc string and formats. so yeah, only \n ends the line now. ๐
๐ (?[...]) operators now follow standard Perl precedence ๐
this experimental feature allows set operations in regular expression patterns. prior to this, the intersection operator had the same precedence as the other binary operators. now it has higher precedence. this could lead to different outcomes than existing code expects (though the documentation has always noted that this change might happen, recommending fully parenthesizing the expressions). see "Extended Bracketed Character Classes" in perlrecharclass. so like, parenthesize or perish. ๐ญ
๐ธ Omitting % and @ on hash and array names is no longer permitted ๐ธ
really old Perl let you omit the @ on array names and the % on hash names in some spots. this has issued a deprecation warning since Perl 5.000, and is no longer permitted. so put those sigils back, bestie. ๐
โจ $! text is now in English outside the scope of use locale โจ
previously, the text, unlike almost everything else, always came out based on the current underlying locale of the program. (also affected on some systems is $^E.) for programs that are unprepared to handle locale differences, this can cause garbage text to be displayed. it's better to display text that is translatable via some tool than garbage text which is much harder to figure out. so yeah, English by default. no cap. ๐ซถ
๐ฆ $! text will be returned in UTF-8 when appropriate ๐ฆ
the stringification of $! and $^E will have the UTF-8 flag set when the text is actually non-ASCII UTF-8. this will enable programs that are set up to be locale-aware to properly output messages in the user's native language. code that needs to continue the 5.20 and earlier behavior can do the stringification within the scopes of both use bytes and use locale ":messages". within these two scopes, no other Perl operations will be affected by locale; only $! and $^E stringification. the bytes pragma causes the UTF-8 flag to not be set, just as in previous Perl releases. this resolves [GH #12035] <https://github.com/Perl/perl5/issues/12035>. slay. ๐
๐ Support for ?PATTERN? without explicit operator has been removed ๐
the m?PATTERN? construct, which allows matching a regex only once, previously had an alternative form that was written directly with a question mark delimiter, omitting the explicit m operator. this usage has produced a deprecation warning since 5.14.0. it is now a syntax error, so that the question mark can be available for use in new operators. bye bye, old syntax. ๐
๐ฅ defined(@array) and defined(%hash) are now fatal errors ๐ฅ
these have been deprecated since v5.6.1 and have raised deprecation warnings since v5.16. now they're just fatal. no more playing. ๐
๐ Using a hash or an array as a reference are now fatal errors ๐
for example, %foo->{"bar"} now causes a fatal compilation error. these have been deprecated since before v5.8, and have raised deprecation warnings since then. so yeah, don't do that. ๐
๐ Changes to the * prototype ๐
the * character in a subroutine's prototype used to allow barewords to take precedence over most, but not all, subroutine names. it was never consistent and exhibited buggy behavior.
now it has been changed, so subroutines always take precedence over barewords, which brings it into conformity with similarly prototyped built-in functions:
sub splat(*) { ... }
sub foo { ... }
splat(foo); # now always splat(foo())
splat(bar); # still splat('bar') as before
close(foo); # close(foo())
close(bar); # close('bar')
and that's the tea. โ
๐ Deprecations ๐
Setting ${^ENCODING} to anything but undef ๐
So this variable lets Perl scripts get written in an encoding that isn't ASCII or UTF-8. Sounds cute, right? It is not. It messes with all modules globally, and that leads to wrong answers and straight-up segmentation faults. ๐ญ
New scripts should just be written in UTF-8, periodt. Old scripts should get converted to UTF-8, and that's genuinely easy with the piconv utility. Do that. ๐ซถ
Use of non-graphic characters in single-character variable names ๐
Single-character variable names have a wayyy more lenient syntax than longer ones โ the one-character name is allowed to be a punctuation character or even invisible (a non-graphic). Perl v5.20 deprecated the ASCII-range controls being used that way. Now, all non-graphic characters that used to be allowed are deprecated. ๐ซ
The practical effect here only shows up when you're not under use utf8, and it affects just the C1 controls (code points 0x80 through 0xFF), NO-BREAK SPACE, and SOFT HYPHEN.
Inlining of sub () { $var } with observable side-effects ๐ฌ
In a lot of cases Perl turns sub () { $var } into an inlinable constant subroutine, capturing the value of $var at the moment the sub expression gets evaluated. And that can break closure behavior whenever $var gets modified afterward, because the sub won't return the changed value. (Heads up: this only applies to anonymous subroutines with an empty prototype โ sub ().)
This usage is now deprecated in those cases where the variable could be modified somewhere else. Perl detects those cases and emits a deprecation warning. And such code will likely change in the future and stop producing a constant. ๐
If your variable is only modified right where it's declared, then Perl keeps making the sub inlinable with no warnings. Slay.
sub make_constant {
my $var = shift;
return sub () { $var }; # fine
}
sub make_constant_deprecated {
my $var;
$var = shift;
return sub () { $var }; # deprecated
}
sub make_constant_deprecated2 {
my $var = shift;
log_that_value($var); # could modify $var
return sub () { $var }; # deprecated
}
In that second example, detecting that $var is assigned to only once is too hard to detect. The fact that it happens somewhere other than the my declaration is enough for Perl to find it suspicious. ๐ต๏ธโ๏ธ
This deprecation warning happens only for a simple variable for the body of the sub. (A BEGIN block or use statement inside the sub gets ignored, because it doesn't become part of the sub's body.) For more complex cases like sub () { do_something() if 0; $var } the behavior has changed so that inlining doesn't happen when the variable is modifiable elsewhere. Such cases should be rare, fr fr.
Use of multiple /x regexp modifiers ๐ธ
It's now deprecated to say anything like any of these:
qr/foo/xx;
/(?xax:foo)/;
use re qw(/amxx);
That is, x should only occur once in any string of contiguous regular expression pattern modifiers. We genuinely do not believe there are any occurrences of this in all of CPAN. This is in preparation for a future Perl release having /xx permit white-space for readability in bracketed character classes (the ones enclosed in square brackets: [...]). Lowkey exciting.
Using a NO-BREAK space in a character alias for \N{...} is now deprecated ๐ซ
This non-graphic character is essentially indistinguishable from a regular space, so it should not be allowed. See CUSTOM ALIASES in charnames.
A literal { should now be escaped in a pattern ๐ญ
If you want a literal left curly bracket (also called a left brace) in a regular expression pattern, you should now escape it โ either by preceding it with a backslash (\{) or enclosing it within square brackets [{], or by using \Q. Otherwise a deprecation warning gets raised. ๐ข
This was first announced as forthcoming in the v5.16 release; it will allow future extensions to the language to happen.
Making all warnings fatal is discouraged ๐
The documentation for fatal warnings notes that use warnings FATAL => 'all' is discouraged, and provides stronger language about the risks of fatal warnings in general. Listen to the docs, bestie.
โก Performance Enhancements โก
- If a method or class name is known at compile time, a hash is precomputed to speed up run-time method lookup. Also, compound method names like
SUPER::neware parsed at compile time, to save having to parse them at run time. ๐ฅ - Array and hash lookups (especially nested ones) that use only constants or simple variables as keys, are now considerably faster. See
Internal Changesfor more details. (...)x1,("constant")x0and($scalar)x0are now optimised in list context. If the right-hand argument is a constant 1, the repetition operator disappears. If the right-hand argument is a constant 0, the whole expression is optimised to the empty list, so long as the left-hand argument is a simple scalar or constant. (That is,(foo())x0is not subject to this optimisation.) โจsubstrassignment is now optimised into 4-argumentsubstrat the end of a subroutine (or as the argument toreturn). Previously, this optimisation only happened in void context.- In
\L...,\Q..., etc., the extrastringifyop is now optimised away, making these just as fast aslcfirst,quotemeta, etc. ๐ - Assignment to an empty list is now sometimes faster. In particular, it never calls
FETCHon tied arguments on the right-hand side, whereas it used to sometimes. - There is a performance improvement of up to 20% when
lengthis applied to a non-magical, non-tied string, and eitheruse bytesis in scope or the string doesn't use UTF-8 internally. ๐ - On most perl builds with 64-bit integers, memory usage for non-magical, non-tied scalars containing only a floating point value has been reduced by between 8 and 32 bytes, depending on OS.
- In
@array = split, the assignment can be optimized away, so thatsplitwrites directly to the array. This optimisation was happening only for package arrays other than@_, and only sometimes. Now this optimisation happens almost all the time. ๐ joinis now subject to constant folding. So for examplejoin "-", "a", "b"is converted at compile-time to"a-b". Moreover,joinwith a scalar or constant for the separator and a single-item list to join is simplified to a stringification, and the separator doesn't even get evaluated.qq(@array)is implemented using two ops: a stringify op and a join op. If theqqcontains nothing but a single array, the stringification is optimized away.our $varandour($s,@a,%h)in void context are no longer evaluated at run time. Even a whole sequence ofour $foo;statements will simply be skipped over. The same applies tostatevariables. ๐ฆ- Many internal functions have been refactored to improve performance and reduce their memory footprints.
[GH #13659]<https://github.com/Perl/perl5/issues/13659>[GH #13856]<https://github.com/Perl/perl5/issues/13856>[GH #13874]<https://github.com/Perl/perl5/issues/13874> -Tand-Bfiletests will return sooner when an empty file is detected.[GH #13686]<https://github.com/Perl/perl5/issues/13686>- Hash lookups where the key is a constant are faster.
- Subroutines with an empty prototype and a body containing just
undefare now eligible for inlining.[GH #14077]<https://github.com/Perl/perl5/issues/14077> โจ - Subroutines in packages no longer need to be stored in typeglobs: declaring a subroutine will now put a simple sub reference directly in the stash if possible, saving memory. The typeglob still notionally exists, so accessing it will cause the stash entry to be upgraded to a typeglob (i.e. this is just an internal implementation detail). This optimization does not currently apply to XSUBs or exported subroutines, and method calls will undo it, since they cache things in typeglobs.
[GH #13392]<https://github.com/Perl/perl5/issues/13392> - The functions
utf8::native_to_unicode()andutf8::unicode_to_native()(see utf8) are now optimized out on ASCII platforms. There is now not even a minimal performance hit in writing code portable between ASCII and EBCDIC platforms. ๐ - Win32 Perl uses 8 KB less of per-process memory than before for every perl process, because some data is now memory mapped from disk and shared between processes from the same perl binary.
๐ฆ Modules and Pragmata ๐ฆ
Updated Modules and Pragmata ๐
Many of the libraries distributed with perl have been upgraded since v5.20.0. For a complete list of changes, run:
corelist --diff 5.20.0 5.22.0
You can substitute your favorite version in place of 5.20.0, too. ๐
Some notable changes include:
- Archive::Tar has been upgraded to version 2.04.
Tests can now be run in parallel. โก
- attributes has been upgraded to version 0.27.
The usage of memEQs in the XS has been corrected. [GH #14072] <https://github.com/Perl/perl5/issues/14072>
Avoid reading beyond the end of a buffer. [perl #122629]
- B has been upgraded to version 1.58.
It provides a new B::safename function, based on the existing B::GV->SAFENAME, that converts \cOPEN to ^OPEN. ๐
Nulled COPs are now of class B::COP, rather than B::OP.
B::REGEXP objects now provide a qr_anoncv method for accessing the implicit CV associated with qr// things containing code blocks, and a compflags method that returns the pertinent flags originating from the qr//blahblah op.
B::PMOP now provides a pmregexp method returning a B::REGEXP object. Two new classes, B::PADNAME and B::PADNAMELIST, have been introduced. ๐ฆ
A bug where, after an ithread creation or pseudofork, special/immortal SVs in the child ithread/pseudoprocess did not have the correct class of B::SPECIAL, has been fixed. The id and outid PADLIST methods have been added.
- B::Concise has been upgraded to version 0.996.
Null ops that are part of the execution chain are now given sequence numbers.
Private flags for nulled ops are now dumped with mnemonics as they would be for the non-nulled counterparts.
- B::Deparse has been upgraded to version 1.35.
It now deparses +sub : attr { ... } correctly at the start of a statement. Without the initial +, sub would be a statement label. ๐
BEGINblocks are now emitted in the right place most of the time, but unfortunately that change brought a regression along with it, bestie:BEGINblocks that show up just before the end of the enclosing block might get deparsed below it instead ๐ญB::Deparseno longer sprinkles boguslocals around here and there, like onLIST = tr/a//d. [perl #119815]- Adjacent
usestatements no longer get accidentally nested just because one of them contains adoblock. [perl #115066] - Parenthesised arrays inside lists passed to
\are now deparsed with their parentheses, correct and everything (e.g.\(@a, (@b), @c)now keeps the parentheses around@b), which preserves the flattening behavior of referenced parenthesised arrays โจ Before, it only worked for one array:\(@a). local ournow deparses correctly, with theourincluded and everything ๐for($foo; !$bar; $baz) {...}was getting deparsed without the!(ornot). That's fixed now ๐ฉน- Core keywords that conflict with lexical subroutines are now deparsed with the
CORE::prefix. foreach state $x (...) {...}now deparses correctly withstateand notmy๐our @array = split(...)now deparses correctly with theourin those cases where the assignment gets optimized away.- It now deparses
our(LIST)and typed lexicals (my Dog $spot) correctly. - Deparses
$#_as$#_instead of as$#{_}. [GH #14545] https://github.com/Perl/perl5/issues/14545 BEGINblocks at the end of the enclosing scope are now deparsed in the right place. [perl #77452]BEGINblocks used to sometimes get deparsed as__ANON__, but now they're always calledBEGIN. periodt.- Lexical subroutines are now fully deparsed. [perl #116553]
Anything =~ y///rwith/rno longer drops the left-hand operand ๐- The op trees that make up regexp code blocks are now deparsed for real. Before, the original string that made up the regular expression was used, and that caused problems with
qr/(?{<<heredoc})/and multiline code blocks, which were deparsed incorrectly. [perl #123217] [perl #115256] $;at the end of a statement no longer loses its semicolon. [perl #123357]- Some cases of subroutine declarations stored in the stash in shorthand form were being omitted.
- Non-ASCII characters are now escaped in strings consistently, instead of only some of the time. (There are still outstanding problems with regular expressions and identifiers that have not been fixed, no cap.)
- When prototype sub calls are deparsed with
&(e.g. under the-Poption),scalaris now added where appropriate, to force the scalar context that the prototype implies. require(foo()),do(foo()),goto(foo())and similar constructs with loop controls are now deparsed correctly. The outer parentheses are not optional, bestie.- Whitespace is no longer escaped in regular expressions, because it was getting erroneously escaped within
(?x:...)sections ๐ค sub foo { foo() }is now deparsed with those mandatory parentheses./@array/is now deparsed as a regular expression, and not just@array./@{-}/,/@{+}/and$#{1}are now deparsed with the braces, which are mandatory in these cases.- When deparsing feature bundles,
B::Deparsewas emittingno feature;first instead ofno feature ':all';. That's fixed now โ chdir FHis now deparsed without quotation marks.\my @ais now deparsed without parentheses. (Parentheses would flatten the array.)systemandexecfollowed by a block are now deparsed correctly. Before, there was an erroneousdositting in front of the block ๐ตuse constant QR => qr/.../flagsfollowed by"" =~ QRis no longer missing the flags.- Deparsing
BEGIN { undef &foo }with the-wswitch enabled started emitting 'uninitialized' warnings back in Perl 5.14. Fixed ๐ - Deparsing calls to subs with a
(;+)prototype caused an infinite loop. The(;$",(_)and(;_)prototypes were given the wrong precedence, which madefoo($a<$b)deparse without the parentheses. - Deparse now provides a defined state sub in inner subs.
B::Op_privatehas been added ๐ It gives you detailed info about the flags used in theop_privatefield of perl opcodes.- bigint, bignum, bigrat have been upgraded to version
0.39. It documents inCAVEATSthat using strings as numbers won't always invoke the big number overloading, and how to invoke it. [rt.perl.org #123064] Carphas been upgraded to version1.36.Carp::Heavynow ignores version mismatches with Carp if Carp is newer than1.12, sinceCarp::Heavy's guts got merged into Carp at that point. [GH #13708] https://github.com/Perl/perl5/issues/13708- Carp now handles non-ASCII platforms better.
- Off-by-one error fix for Perl < 5.14.
constanthas been upgraded to version1.33. It now accepts fully-qualified constant names, so you can define constants in packages other than the caller ๐CPANhas been upgraded to version2.11.- Add support for
Cwd::getdcwd()and introduce a workaround for a misbehavior seen on Strawberry Perl 5.20.1. - Fix the chdir() after building dependencies bug.
- Introduce experimental support for plugins/hooks.
- Integrate the
App::Cpansources. - Do not check recursion on optional dependencies.
- Sanity check META.yml to contain a hash. [cpan #95271] https://rt.cpan.org/Ticket/Display.html?id=95271
- Add support for
CPAN::Meta::Requirementshas been upgraded to version2.132. It works around limitations inversion::vppdetecting v-string magic, and adds support for the forthcoming ExtUtils::MakeMaker bootstrap version.pm for Perls older than 5.10.0.Data::Dumperhas been upgraded to version2.158.- Fixes CVE-2014-4330 by adding a configuration variable/option to limit recursion when dumping deep data structures ๐ก๏ธ
- Changes to resolve Coverity issues. XS dumps incorrectly stored the name of code references stored in a GLOB. [GH #13911] https://github.com/Perl/perl5/issues/13911
DynaLoaderhas been upgraded to version1.32. Removes thedl_nonlazyglobal if it's unused in Dynaloader. [perl #122926]Encodehas been upgraded to version2.72.piconvnow has better error handling when the encoding name doesn't exist, and a build breakage when upgrading Encode in perl-5.8.2 and earlier has been fixed.- Building in C++ mode on Windows now works โจ
Errnohas been upgraded to version1.23. Adds-Pto the preprocessor command-line on GCC 5. GCC added extra line directives, which broke parsing of error code definitions. [rt.perl.org #123784]experimentalhas been upgraded to version0.013. Hardcodes features for Perls older than 5.15.7.ExtUtils::CBuilderhas been upgraded to version0.280221. Fixes a regression on Android. [GH #14064] https://github.com/Perl/perl5/issues/14064ExtUtils::Manifesthas been upgraded to version1.70. Fixes a bug withmaniread()'s handling of quoted filenames, and improvesmanifind()to follow symlinks. [GH #14003] https://github.com/Perl/perl5/issues/14003ExtUtils::ParseXShas been upgraded to version3.28.- Only declares
fileunused if we actually define it. Improves generatedRETVALcode generation to avoid repeated references toST(0). [perl #123278] - Broadens and documents the
/OBJ$/to/REF$/typemap optimization for theDESTROYmethod. [perl #123418]
- Only declares
Fcntlhas been upgraded to version1.13. Adds support for the Linux pipe buffer sizefcntl()commands.File::Findhas been upgraded to version1.29.find()andfinddepth()will now warn if you pass them inappropriate or misspelled options ๐File::Globhas been upgraded to version1.24. AvoidsSvIV()expanding to callget_sv()three times in a few places. [perl #123606]HTTP::Tinyhas been upgraded to version0.054.keep_aliveis now fork-safe and thread-safe ๐ฅIOhas been upgraded to version1.35. The XS implementation has been fixed for the sake of older Perls.IO::Sockethas been upgraded to version1.38. Documents the limitations of theconnected()method. [perl #123096]IO::Socket::IPhas been upgraded to version0.37.- A better fix for subclassing
connect(). [cpan #95983] https://rt.cpan.org/Ticket/Display.html?id=95983 [cpan #97050] https://rt.cpan.org/Ticket/Display.html?id=97050 - Implements
Timeoutforconnect(). [cpan #92075] https://rt.cpan.org/Ticket/Display.html?id=92075
- A better fix for subclassing
- The libnet collection of modules has been upgraded to version
3.05. Support for IPv6 and SSL toNet::FTP,Net::NNTP,Net::POP3andNet::SMTP. Improvements inNet::SMTPauthentication. Locale::Codeshas been upgraded to version3.34.- Fixed a bug in the scripts used to extract data from spreadsheets that prevented the SHP currency code from being found. [cpan #94229] https://rt.cpan.org/Ticket/Display.html?id=94229
- New codes have been added.
Math::BigInthas been upgraded to version1.9997. Synchronizes POD changes from the CPAN release.Math::BigFloat->blog(x)would sometimes return blog(2*x) when the accuracy was greater than 70 digits. The result ofMath::BigFloat->bdiv()in list context now satisfiesx = quotient * divisor + remainder. Correct handling of subclasses. [cpan #96254] https://rt.cpan.org/Ticket/Display.html?id=96254 [cpan #96329] https://rt.cpan.org/Ticket/Display.html?id=96329Module::Metadatahas been upgraded to version1.000026. Supports installations on older perls with an ExtUtils::MakeMaker earlier than6.63_03.overloadhas been upgraded to version1.26. A redundantref $subcheck has been removed.- The PathTools module collection has been upgraded to version
3.56.- A warning from the gcc compiler is now avoided when building the XS.
- Don't turn leading
//into/on Cygwin. [perl #122635]
perl5db.plhas been upgraded to version1.49.- The debugger would cause an assertion failure. [GH #14605] https://github.com/Perl/perl5/issues/14605
fork()in the debugger undertmuxwill now create a new window for the forked process. [GH #13602] https://github.com/Perl/perl5/issues/13602
- The debugger now saves the current working directory when it starts up and puts it right back when you restart your program with
Rorrerun. chef's kiss.[GH #13691]https://github.com/Perl/perl5/issues/13691 PerlIO::scalarโ upgraded to version 0.22 ๐- Reading from a position waaaay past the end of the scalar now correctly gives you end of file. no more pretending there's data there bestie.
[perl #123443] - Seeking to a negative position? still fails. but it no longer leaves the file position stuck at some made-up negation location. glow up โจ
eof()on aPerlIO::scalarhandle now actually returns true when the file position is past the 2GB mark on 32-bit systems. we love a correct answer.- Attempting to write at file positions that are straight-up impossible for the platform now fails early instead of wrapping at 4GB. no sneaky wraparound, we're done with that.
- Reading from a position waaaay past the end of the scalar now correctly gives you end of file. no more pretending there's data there bestie.
Pod::Perldocโ upgraded to version 3.25 ๐- Filehandles opened for reading or writing now have
:encoding(UTF-8)set.[cpan #98019]https://rt.cpan.org/Ticket/Display.html?id=98019
- Filehandles opened for reading or writing now have
POSIXโ upgraded to version 1.53 โจ- The C99 math functions and constants have been added, so say hi to
acosh,isinf,isnan,round,trunc, plusM_E,M_SQRT2,M_PI. math girlies rise ๐ซถ POSIX::tmpnam()now produces a deprecation warning.[perl #122005]
- The C99 math functions and constants have been added, so say hi to
Safeโ upgraded to version 2.39 ๐ฅrevalwasn't propagating void context properly. fixed.
Scalar-List-Utilsโ upgraded to version 1.41 ๐- A whole new module,
Sub::Util, has been added, containing functions related to CODE refs, includingsubname(inspired bySub::Identity) andset_subname(copied and renamed fromSub::Name). new drop alert ๐ฆ - The use of
GetMagicinList::Util::reduce()has also been fixed.[cpan #63211]https://rt.cpan.org/Ticket/Display.html?id=63211
- A whole new module,
SDBM_Fileโ upgraded to version 1.13 ๐ง- Simplified the build process.
[perl #123413]
- Simplified the build process.
Time::Pieceโ upgraded to version 1.29 โฐ- When pretty printing negative
Time::Seconds, theminusis no longer lost. the minus said i'm the main character actually.
- When pretty printing negative
Unicode::Collateโ upgraded to version 1.12 ๐- Version 0.67's improved discontiguous contractions is invalidated by default, and is supported as a parameter
long_contraction. iykyk.
- Version 0.67's improved discontiguous contractions is invalidated by default, and is supported as a parameter
Unicode::Normalizeโ upgraded to version 1.18 ๐ฆ- The XSUB implementation has been removed in favor of pure Perl.
Unicode::UCDโ upgraded to version 0.61 ๐- A new function
property_values()has been added to return a given property's possible values. - A new function
charprop()has been added to return the value of a given property for a given code point. - A new function
charprops_all()has been added to return the values of all Unicode properties for a given code point. - A bug has been fixed so that
propaliases()returns the correct short and long names for the Perl extensions where it was incorrect. no more lying ๐ซ - A bug has been fixed so that
prop_value_aliases()returnsundefinstead of a wrong result for properties that are Perl extensions. - This module now works on EBCDIC platforms. inclusivity periodt ๐
- A new function
utf8โ upgraded to version 1.17 โจ- A mismatch between the documentation and the code in
utf8::downgrade()was fixed in favor of the documentation. The optional second argument is now correctly treated as a perl boolean (true/false semantics) and not as an integer.
- A mismatch between the documentation and the code in
versionโ upgraded to version 0.9909 ๐- Numerous changes. See the
Changesfile in the CPAN distribution for details.
- Numerous changes. See the
Win32โ upgraded to version 0.51 ๐ชGetOSName()now supports Windows 8.1, and building in C++ mode now works.
Win32API::Fileโ upgraded to version 0.1202 ๐ช- Building in C++ mode now works.
XSLoaderโ upgraded to version 0.20 ๐- Allow XSLoader to load modules from a different namespace.
[perl #122455]
- Allow XSLoader to load modules from a different namespace.
๐ Removed Modules and Pragmata ๐
The following modules (and associated modules) have been removed from the core perl distribution. they're gone gone, bestie. not ghosted, removed. ๐ซถ
CGIModule::Build
perldata
- The syntax of single-character variable names has been brought up-to-date and explained way more fully. ๐
- Hexadecimal floating point numbers are described now, plus infinity and NaN. โจ
perlebcdic
- This document got a significant glow-up in light of all the recent improvements to EBCDIC support. ๐ฆ
perlfilter
- A LIMITATIONS section was added. ๐
perlfunc
- Now mentions that study() is currently a no-op (bestie, it's not doing anything, don't stress about it).
- Calling
deleteorexistson array values is now described as "strongly discouraged" rather than "deprecated". ๐ - Documentation of
ourimproved. โญ -lnow notes that it will return false if symlinks aren't supported by the file system. GH #13695 โhttps://github.com/Perl/perl5/issues/13695- Notes that
exec LISTandsystem LISTmay fall back to the shell on Win32. Only the indirect-object syntaxexec PROGRAM LISTandsystem PROGRAM LISTwill reliably avoid using the shell. This has also been noted in perlport. GH #13907 โhttps://github.com/Perl/perl5/issues/13907
perlguts
- The OOK example has been updated to account for COW changes and a change in the storage of the offset. ๐
- Details on C level symbols and libperl.t added.
- Information on Unicode handling has been added
- Information on EBCDIC handling has been added
perlhack
- A note has been added about running on platforms with non-ASCII character sets
- A note has been added about performance testing
perlhacktips
- Documentation has been added illustrating the perils of assuming that there is no change to the contents of static memory pointed to by the return values of Perl's wrappers for C library functions. (Spoiler: don't assume. ๐ฅ)
- Replacements for
tmpfile,atoi,strtol, andstrtoulare now recommended. - Updated documentation for the
test.valgrindmaketarget. GH #13658 โhttps://github.com/Perl/perl5/issues/13658 - Information is given about writing test files portably to non-ASCII platforms.
- A note has been added about how to get a C language stack backtrace.
perlhpux
- Note that the message "Redeclaration of "sendpath" with a different storage class specifier" is harmless. ๐ซถ
perllocale
- Updated for the enhancements in v5.22, along with some clarifications.
perlmodstyle
- Instead of pointing to the module list, we are now pointing to PrePAN
http://prepan.org/. ๐
perlop
- Updated for the enhancements in v5.22, along with some clarifications.
perlpodspec
- The specification of the pod language is changing so that the default encoding of pods that aren't in UTF-8 (unless otherwise indicated) is CP1252 instead of ISO 8859-1 (Latin1). ๐ฆ
perlpolicy
- We now have a code of conduct for the p5p mailing list, as documented in "STANDARDS OF CONDUCT" in perlpolicy. ๐
- The conditions for marking an experimental feature as non-experimental are now set out.
- Clarification has been made as to what sorts of changes are permissible in maintenance releases.
perlport
- Out-of-date VMS-specific information has been fixed and/or simplified.
- Notes about EBCDIC have been added.
perlre
- The description of the
/xmodifier has been clarified to note that comments cannot be continued onto the next line by escaping them; and there is now a list of all the characters that are considered whitespace by this modifier. โจ - The new
/nmodifier is described. ๐ - A note has been added on how to make bracketed character class ranges portable to non-ASCII machines.
perlrebackslash
- Added documentation of
\b{sb},\b{wb},\b{gcb}, and\b{g}. ๐
perlrecharclass
- Clarifications have been added to "Character Ranges" in perlrecharclass to the effect
[A-Z],[a-z],[0-9]and any subranges thereof in regular expression bracketed character classes are guaranteed to match exactly what a naive English speaker would expect them to match, even on platforms (such as EBCDIC) where perl has to do extra work to accomplish this. ๐ฅ - The documentation of Bracketed Character Classes has been expanded to cover the improvements in
qr/[\N{named sequence}]/(see under "Selected Bug Fixes").
perlref
- A new section has been added Assigning to References
perlsec
- Comments added on algorithmic complexity and tied hashes. ๐
perlsyn
- An ambiguity in the documentation of the
...statement has been corrected. GH #14054 โhttps://github.com/Perl/perl5/issues/14054 - The empty conditional in
forandwhileis now documented in perlsyn.
perlunicode
- This has had extensive revisions to bring it up-to-date with current Unicode support and to make it more readable. Notable is that Unicode 7.0 changed what it should do with non-characters. Perl retains the old way of handling for reasons of backward compatibility. See "Noncharacter code points" in perlunicode. ๐ธ
perluniintro
- Advice for how to make sure your strings and regular expression patterns are interpreted as Unicode has been updated.
perlvar
$]is no longer listed as being deprecated. Instead, discussion has been added on the advantages and disadvantages of using it versus$^V.$OLD_PERL_VERSIONwas re-added to the documentation as the long form of$]. โญ${^ENCODING}is now marked as deprecated.- The entry for
%^Hhas been clarified to indicate it can only handle simple values.
perlvms
- Out-of-date and/or incorrect material has been removed.
- Updated documentation on environment and shell interaction in VMS.
perlxs
- Added a discussion of locale issues in XS code. ๐
๐ฉบ 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 ๐จ
Bad symbol for scalar(P) An internal request asked to add a scalar entry to something that wasn't a symbol table entry.Can't use a hash as a reference(F) You tried to use a hash as a reference, as in%foo->{"bar"}or%$ref->{"hello"}. Versions of perl <= 5.6.1 used to allow this syntax, but shouldn't have. ๐Can't use an array as a reference(F) You tried to use an array as a reference, as in@foo->[23]or@$ref->[99]. Versions of perl <= 5.6.1 used to allow this syntax, but shouldn't have. ๐Can't use 'defined(@array)' (Maybe you should just omit the defined()?)(F) defined() is not useful on arrays because it checks for an undefined scalar value. If you want to see if the array is empty, just useif (@array) { # not empty }for example.Can't use 'defined(%hash)' (Maybe you should just omit the defined()?)(F) defined() is not usually right on hashes.
Although defined %hash is false on a plain not-yet-used hash, it becomes true in several non-obvious circumstances, including iterators, weak references, stash names, even remaining true after undef %hash. These things make defined %hash fairly useless in practice, so it now generates a fatal error. ๐ซ
If a check for non-empty is what you wanted then just put it in boolean context (see "Scalar values" in perldata):
if (%hash) {
# not empty
}
If you had defined %Foo::Bar::QUUX to check whether such a package variable exists then that's never really been reliable, and isn't a good way to enquire about the features of a package, or whether it's loaded, etc.
Cannot chr %f(F) You passed an invalid number (like an infinity or not-a-number) tochr.Cannot compress %f in pack(F) You tried converting an infinity or not-a-number to an unsigned character, which makes no sense.Cannot pack %f with '%c'(F) You tried converting an infinity or not-a-number to a character, which makes no sense.Cannot print %f with '%c'(F) You tried printing an infinity or not-a-number as a character (%c), which makes no sense. Maybe you meant '%s', or just stringifying it? ๐charnames alias definitions may not contain a sequence of multiple spaces(F) You defined a character name which had multiple space characters in a row. Change them to single spaces. Usually these names are defined in the:aliasimport argument touse charnames, but they could be defined by a translator installed into$^H{charnames}. See "CUSTOM ALIASES" in charnames.charnames alias definitions may not contain trailing white-space(F) You defined a character name which ended in a space character. Remove the trailing space(s). Usually these names are defined in the:aliasimport argument touse charnames, but they could be defined by a translator installed into$^H{charnames}. See "CUSTOM ALIASES" in charnames.:const is not permitted on named subroutines(F) Theconstattribute causes an anonymous subroutine to be run and its value captured at the time that it is cloned. Named subroutines are not cloned like this, so the attribute does not make sense on them.Hexadecimal float: internal error(F) Something went horribly bad in hexadecimal float handling. ๐ญHexadecimal float: unsupported long double format
(F) โ so you configured Perl to run with long doubles, but the internals of the long double format? Nobody knows them. Unknown. Therefore hexadecimal float output is impossible. It's giving "we tried" ๐ญ
Illegal suidscriptโ (F) the script that got run undersuidperlwas, somehow, illegal. That's it. That's the whole message. Somehow. ๐In '(?...)', the '(' and '?' must be adjacent in regex; marked by <-- HERE in m/%s/โ (F) bestie, the two-character sequence(?in this context in a regular expression pattern is supposed to be an indivisible token โ like, literally nothing is allowed to chill between the(and the?โ but you went and separated them. ๐In '(*VERB...)', the '(' and '*' must be adjacent in regex; marked by <-- HERE in m/%s/โ (F) same energy, different token: the two-character sequence(*in this context in a regular expression pattern should be an indivisible token, with nothing intervening between the(and the*, but you separated them. ๐ญInvalid quantifier in {,} in regex; marked by <-- HERE in m/%s/โ (F) the pattern is giving{min,max}quantifier, but the min or max couldn't be parsed as a valid number. Two possible reasons, pick your fighter: it has leading zeroes, or it's representing too big a number to cope with. The<-- HEREshows you exactly where in the regular expression the problem was discovered. See perlre. ๐'%s' is an unknown bound type in regexโ (F) you used\b{...}or\B{...}and that...is just not a thing Perl knows about. The currently valid ones are all listed in"\b{}, \b, \B{}, \B"in perlrebackslash. ๐ฆMissing or undefined argument to requireโ (F) you tried to callrequirewith no argument, or with an undefined value as an argument.requireexpects either a package name or a file-specification, bestie, that's the deal. See"require"in perlfunc.
Fun lore: formerly, require with no argument or undef warned about a Null filename instead. โจ
โจ New Warnings โจ
\C is deprecated in regexโ (D deprecated) the/\C/character class got deprecated way back in v5.20, and now it actually emits a warning. The intent is for it to become a hard error in v5.24. Why so serious? Because this character class matches a single byte even when it's sitting inside a multi-byte character โ it breaks encapsulation and can corrupt your UTF-8 strings. Do not recommend. ๐"%s" is more clearly written simply as "%s" in regex; marked by <-- HERE in m/%s/โ (W regexp) and heads up, this one's only underuse re 'strict'or within(?[...]). You specified a character that has the given plainer way of writing it โ and that plainer way is also portable to platforms running with different character sets. Slay, write it the simple way. โจArgument "%s" treated as 0 in increment (++)โ (W numeric) the indicated string got fed as an argument to the++operator, which expects either a number or a string matching/^[a-zA-Z]*[0-9]*\z/. See"Auto-increment and Auto-decrement"in perlop for the details. ๐Both or neither range ends should be Unicode in regex; marked by <-- HERE in m/%s/โ (W regexp) and again, only underuse re 'strict'or within(?[...]).
In a bracketed character class in a regex pattern, you had a range where exactly one end was specified using \N{}, and the other end was specified using a non-portable mechanism. Perl treats that range as a Unicode range โ meaning all the characters in it get considered the Unicode characters, and those may be different code points on some platforms Perl runs on!
Like, for example: [\N{U+06}-\x08] is treated as if you'd instead said [\N{U+06}-\N{U+08}], so it matches the characters whose code points in Unicode are 6, 7, and 8. But that \x08 might be a hint that you meant something else entirely โ so the warning gets raised. ๐ซถ
Can't do %s("%s") on non-UTF-8 locale; resolved to "%s".โ (W locale) the situation is: 1) you are running under"use locale"; 2) the current locale is not a UTF-8 one; 3) you tried to do the designated case-change operation on the specified Unicode character; and 4) the result of this operation would mix Unicode and locale rules, which likely conflict. Messy. ๐
The warnings category locale is new. ๐
:const is experimentalโ (S experimental::const_attr) theconstattribute is experimental. If you wanna use the feature, disable the warning withno warnings 'experimental::const_attr'โ but know that by doing so you're taking the risk that your code may break in a future Perl version. You've been warned, bestie. ๐ญgmtime(%f) failedโ (W overflow) you calledgmtimewith a number it could not handle: too large, too small, or NaN. The returned value isundef. Rip. ๐Hexadecimal float: exponent overflowโ (W overflow) the hexadecimal floating point has a larger exponent than the floating point supports.Hexadecimal float: exponent underflowโ (W overflow) the hexadecimal floating point has a smaller exponent than the floating point supports.Hexadecimal float: mantissa overflowโ (W overflow) the hexadecimal floating point literal had more bits in the mantissa than the floating point supports. (The mantissa is the part between the0xand the exponent โ also known as the fraction or the significand. ๐ )Hexadecimal float: precision lossโ (W overflow) the hexadecimal floating point had internally more digits than could be output. This can be caused by unsupported long double formats, or by 64-bit integers not being available (you need those to retrieve the digits under some configurations). ๐ฆLocale '%s' may not work well.%sโ (W locale) you're using the named locale, which is a non-UTF-8 one, and perl has determined it's not fully compatible with what it can handle. The second%shands you the reason. ๐ซถ
The warnings category locale is new.
localtime(%f) failedโ (W overflow) you calledlocaltimewith a number it could not handle: too large, too small, or NaN. The returned value isundef.Negative repeat count does nothingโ (W numeric) you tried to execute thexrepetition operator fewer than 0 times, which likeโฆ doesn't make sense, bestie. Nothing happens. ๐NO-BREAK SPACE in a charnames alias definition is deprecatedโ (D deprecated) you defined a character name which contained a no-break space character. Change it to a regular space, babe. Usually these names get defined in the:aliasimport argument touse charnames, but they could also be defined by a translator installed into$^H{charnames}. See"CUSTOM ALIASES"in charnames. โจNon-finite repeat count does nothingโ (W numeric) you tried to execute thexrepetition operatorInf(or-Inf) or NaN times, which also doesn't make sense. Same vibe, different number. ๐PerlIO layer ':win32' is experimentalโ (S experimental::win32_perlio) the:win32PerlIO layer is experimental. If you want to take the risk of using this layer, just disable this warning:
no warnings "experimental::win32_perlio";
Your risk, your call. ๐
Ranges of ASCII printables should be some subset of "0-9", "A-Z", or "a-z" in regex; marked by <-- HERE in m/%s/โ (W regexp) and yup, only underuse re 'strict'or within(?[...]).
Stricter rules are here to help you find typos and other errors. Maybe you didn't even intend a range here at all โ if that - was meant to be some other character, or should've been escaped (like \-). And if you did intend a range, the one that got used isn't portable between ASCII and EBCDIC platforms, and it doesn't have an obvious meaning to a casual reader. ๐ฆ
[3-7] # OK; Obvious and portable
[d-g] # OK; Obvious and portable
[A-Y] # OK; Obvious and portable
[A-z] # WRONG; Not portable; not clear what is meant
[a-Z] # WRONG; Not portable; not clear what is meant
[%-.] # WRONG; Not portable; not clear what is meant
[\x41-Z] # WRONG; Not portable; not obvious to non-geek
(You can force portability by specifying a Unicode range, which means the endpoints are specified by \N{...} โ but the meaning may still not be obvious, ngl.) The stricter rules require that ranges which start or stop with an ASCII character that isn't a control have all their endpoints be a literal character and not some escape sequence (like \x41), and the ranges must be all digits, or all uppercase letters, or all lowercase letters. Periodt. ๐
Ranges of digits should be from the same group in regex; marked by <-- HERE in m/%s/โ (W regexp) again, only underuse re 'strict'or within(?[...]).
Stricter rules help to find typos and other errors. You included a range, and at least one of the end points is a decimal digit. Under the stricter rules, when that happens, both end points should be digits in the same group of 10 consecutive digits. ๐
Redundant argument in %sโ (W redundant) you called a function with more arguments than were needed, as indicated by information within other arguments you supplied (e.g. a printf format). Currently it's only emitted when a printf-type format required fewer arguments than were supplied, but it might get used in the future for e.g.packin perlfunc. ๐ธ
The warnings category redundant is new. See also [GH #13534] at https://github.com/Perl/perl5/issues/13534.
Replacement list is longer than search listโ okay so this one is not a new diagnostic, but in earlier releases it was accidentally not displayed if the transliteration contained wide characters. That's fixed now, so you may see this diagnostic in places where you previously didn't (but should have). Glow up. โจUse of \b{} for non-UTF-8 locale is wrong. Assuming a UTF-8 localeโ (W locale) you're matching a regular expression using locale rules, and a Unicode boundary is being matched, but the locale is not a Unicode one. That just doesn't make sense. Perl will continue, assuming a Unicode (UTF-8) locale, but the results could well be wrong โ except if the locale happens to be ISO-8859-1 (Latin1), where this message is spurious and can be ignored. ๐
The warnings category locale is new.
Using /u for '%s' instead of /%s in regex; marked by <-- HERE in m/%s/โ (W regexp) you used a Unicode boundary (\b{...}or\B{...}) in a portion of a regular expression where the character set modifiers/aor/aaare in effect. Those two modifiers are indicating an ASCII interpretation, and that does not make sense for a Unicode definition. The generated regular expression will compile so that the boundary uses all of Unicode. No other portion of the regular expression is affected. ๐ฆThe bitwise feature is experimental(S experimental::bitwise)โ this warning shows up whenever you use bitwise operators (& | ^ ~ &. |. ^. ~.) while thebitwisefeature is enabled. If you genuinely want the feature, just silence the warning โ but bestie, know that you're rolling with an experimental feature that could change shape or get removed in a future Perl version ๐
no warnings "experimental::bitwise";
use feature "bitwise";
$x |.= $y;
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/%s/โ (D deprecated, regexp) you put a literal{in a regular expression pattern, bestie ๐ญ switch to\{instead, because a future Perl (tentatively v5.26) is gonna treat that as a syntax error, fr fr. And heads up: if your pattern delimiters are braces too, you gotta escape the matching right brace (}) as well so the parser doesn't get all confused, like this:
qr{abc\{def\}ghi}
Use of literal non-graphic characters in variable names is deprecatedโ (D deprecated) using literal non-graphic (control chars included) characters in your source to reference the^FOOvariables (think$^Xand"${^GLOBAL_PHASE}") is now deprecated. No more sneaky invisible characters, โจUseless use of attribute "const"โ (W misc) the"const"attribute does literally nothing except on anonymous closure prototypes ๐ซ you applied it to a subroutine viaattributes.pm, which is only useful inside an attribute handler for an anonymous subroutine. That's the whole vibe.Useless use of /d modifier in transliteration operatorโ not a new diagnostic, but in earlier releases it was accidentally not displayed whenever the transliteration contained wide characters ๐ that's fixed now, so you might see this diagnostic in places you previously didn't (but lowkey should have ๐)."use re 'strict'" is experimentalโ (S experimental::re_strict) everything that behaves differently when a regex pattern is compiled under'strict'is subject to change in future Perl releases in incompatible ways ๐ญ there are also proposals floating around to change how you enable strict checking instead of using this subpragma. Translation: a pattern that compiles today might not compile in a future Perl release. This warning is here to warn you about that risk, periodt.Warning: unable to close filehandle properly: %s/Warning: unable to close filehandle %s properly: %sโ (S io) previously, perl silently ignored any errors when doing an implicit close of a filehandle โ i.e. where the refcount of the filehandle hit zero and your code hadn't already calledclose(); like:
{
open my $fh, '>', $file or die "open: '$file': $!\n";
print $fh, $data or die;
} # implicit close here
In a situation like a full disk, thanks to buffering, the error might only be detected during that final close โ so not checking the close result is dangerous ๐จ so perl now warns in those situations.
Wide character (U+%X) in %sโ (W locale) while chillin' in a single-byte locale (aka a non-UTF-8 one), a multi-byte character showed up. Perl considers this character to be the specified Unicode code point. Mixing non-UTF-8 locales and Unicode is dangerous, bestie. Almost certainly some characters are gonna have two different representations โ for example, in the ISO 8859-7 (Greek) locale, code point0xC3represents a Capital Gamma. But so does0x393๐ which makes string comparisons unreliable.
You probably need to figure out how this multi-byte character got mixed up with your single-byte locale (or maybe you thought you had a UTF-8 locale, but Perl disagrees ๐).
The warnings category locale is new, slay.
๐ธ Changes to Existing Diagnostics ๐ธ
<> should be quotesโ this warning has been changed to<> at require-statement should be quotesso the issue is more identifiable โจArgument "%s" isn't numeric%sโ the perldiag entry for this warning has this clarifying note added:
Note that for the Inf and NaN (infinity and not-a-number) the definition of "numeric" is somewhat unusual: the strings themselves (like "Inf") are considered numeric, and anything following them is considered non-numeric.
Global symbol "%s" requires explicit package nameโ this message now has(did you forget to declare "my %s"?)appended to it, to be more helpful to new Perl programmers ๐ซถ[GH #13732]โhttps://github.com/Perl/perl5/issues/13732"my" variable &foo::bar can't be in a packagehas been reworded to saysubroutineinstead ofvariable. ๐\N{} in character class restricted to one character in regex; marked by <-- HERE in m/%s/โ this message hadcharacter classchanged toinverted character class or as a range end-point, to reflect improvements inqr/[\N{named sequence}]/(peep under "Selected Bug Fixes").panic: frexpโ this message had: %fappended to it, so you can see what the offending floating point number actually is ๐Possible precedence problem on bitwise %c operatorreworded asPossible precedence problem on bitwise %s operator.Unsuccessful %s on filename containing newlineโ this warning is now only produced when the newline is at the end of the filename."Variable %s will not stay shared"has been changed to say"Subroutine"when it's actually a lexical sub that will not stay shared.Variable length lookbehind not implemented in regex m/%s/โ the perldiag entry for this warning has had information about Unicode behavior added. ๐ฆ
๐ Diagnostic Removals ๐
"Ambiguous use of -foo resolved as -&foo()"โ there's actually no ambiguity here, and it was impeding the use of negated constants; e.g.,-Inf. Gone, bye ๐"Constant is not a FOO reference"โ compile-time checking of constant dereferencing (e.g.,my_constant->()) has been removed, since it wasn't taking overloading into account ๐ค[GH #9891]โhttps://github.com/Perl/perl5/issues/9891[GH #14044]โhttps://github.com/Perl/perl5/issues/14044
โจ Utility Changes โจ
find2perl, s2p and a2p removal
- The
x2p/directory has been removed from the Perl core. ๐ฅ
This removes find2perl, s2p and a2p. They've all been released to CPAN as separate distributions (App::find2perl, App::s2p, App::a2p). So go find them there, bestie ๐ซถ
h2ph
h2phnow handles hexadecimal constants in the compiler's predefined macro definitions, as visible in$Config{cppsymbols}.[GH #14491]โhttps://github.com/Perl/perl5/issues/14491.
encguess
- No longer depends on non-core modules. Iconic behavior honestly ๐
๐ธ Configuration and Compilation ๐ธ
Configurenow checks forlrintl(),lroundl(),llrintl(), andllroundl().Configurewith-Dmksymlinksshould now be faster.[GH #13890]โhttps://github.com/Perl/perl5/issues/13890.- The
pthreadsandcllibraries will be linked by default if present. This lets XS modules that require threading work on non-threaded perls. But note: you still have to pass-Dusethreadsif you want a threaded perl. Don't forget it ๐ - To get more precision and range for floating point numbers you can now use the GCC quadmath library, which implements the quadruple precision floating point numbers on x86 and IA-64 platforms. See
INSTALLfor details. MurmurHash64AandMurmurHash64Bcan now be configured as the internal hash function. ๐ฅmake test.valgrindnow supports parallel testing.
For example:
TEST_JOBS=9 make test.valgrind
See "valgrind" in perlhacktips for more info.
[GH #13658] โ https://github.com/Perl/perl5/issues/13658
- The MAD (Misc Attribute Decoration) build option has been removed ๐๏ธ
This was an unmaintained attempt at preserving the Perl parse tree more faithfully so that automatic conversion of Perl 5 to Perl 6 would've been easier.
This build-time configuration option had been unmaintained for years, and had probably seriously diverged on both the Perl 5 and Perl 6 sides. Rip bozo ๐
- A new compilation flag,
-DPERL_OP_PARENT, is available. For details, see the discussion below at "Internal Changes". Pathtoolsno longer tries to load XS on miniperl. This speeds up building perl slightly. ๐๏ธ
๐ง Testing ๐ง
t/porting/re_context.thas been added to test that utf8 and its dependencies only use the subset of the$1..$ncapture vars thatPerl_save_re_context()is hard-coded to localize, because that function has no efficient way of determining at runtime what vars to localize. (Very demure, very mindful of them.)- Tests for performance issues have been added in the file
t/perf/taint.t. ๐ - Some regular expression tests are written in such a way that they'll run very slowly if certain optimizations break ๐ญ these tests have been moved into new files,
t/re/speed.tandt/re/speed_thr.t, and are run with awatchdog(). test.plnow allowsplan skip_all => $reason, to make it more compatible withTest::More.- A new test script,
op/infnan.t, has been added to test if infinity and NaN are working correctly. See "Infinity and NaN (not-a-number) handling improved". โญ
โจ Platform Support โจ
๐ Regained Platforms ๐
๐ IRIX and Tru64 platforms are working again. ๐
okay so bestie, these two are literally back online! But thereโs still some make test drama: [GH #14557] <https://github.com/Perl/perl5/issues/14557> and [GH #14727] <https://github.com/Perl/perl5/issues/14727> for IRIX; [GH #14629] <https://github.com/Perl/perl5/issues/14629>, [cpan #99605] <https://rt.cpan.org/Public/Bug/Display.html?id=99605>, and [cpan #104836] <https://rt.cpan.org/Ticket/Display.html?id=104836> for Tru64.
๐ฆ z/OS running EBCDIC Code Page 1047 ๐ฆ
Core perl now works on this EBCDIC platform, periodt. Earlier perls also worked, but, even though support wasn't officially withdrawn, recent perls would not compile and run well. Perl 5.20 would work, but had many bugs which have now been fixed. Many CPAN modules that ship with Perl still fail tests, including Pod::Simple. However the version of Pod::Simple currently on CPAN should work; it was fixed too late to include in Perl 5.22. Work is under way to fix many of the still-broken CPAN modules, which likely will be installed on CPAN when completed, so that you may not have to wait until Perl 5.24 to get a working version.
๐ Discontinued Platforms ๐
NeXTSTEP/OPENSTEP
okay so NeXTSTEP was a proprietary operating system bundled with NeXT's workstations in the early to mid 90s; OPENSTEP was an API specification that provided a NeXTSTEP-like environment on a non-NeXTSTEP system. Both are now long dead, so support for building Perl on them has been removed. rip ๐
๐ ๏ธ Platform-Specific Notes ๐ ๏ธ
๐ EBCDIC ๐
Special handling is required of the perl interpreter on EBCDIC platforms to get qr/[i-j]/ to match only i and j, since there are 7 characters between the code points for i and j. This special handling had only been invoked when both ends of the range are literals. Now it is also invoked if any of the \N{...} forms for specifying a character by name or Unicode code point is used instead of a literal. See "Character Ranges" in perlrecharclass.
๐ HP-UX ๐
The archname now distinguishes use64bitint from use64bitall. slay.
๐ค Android ๐ค
Build support has been improved for cross-compiling in general and for Android in particular.
๐ VMS ๐
- When spawning a subprocess without waiting, the return value is now the correct PID.
- Fix a prototype so linking doesn't fail under the VMS C++ compiler.
finite,finitel, andisfinitedetection has been added toconfigure.com, environment handling has had some minor changes, and a fix for legacy feature checking status.
๐ช Win32 ๐ช
miniperl.exeis now built with-fno-strict-aliasing, allowing 64-bit builds to complete on GCC 4.8.[GH #14556] <https://github.com/Perl/perl5/issues/14556>nmake minitestnow works on Win32. Due to dependency issues you need to buildnmake test-prepfirst, and a small number of the tests fail.[GH #14318] <https://github.com/Perl/perl5/issues/14318>- Perl can now be built in C++ mode on Windows by setting the makefile macro
USE_CPLUSPLUSto the valuedefine. - The list form of piped open has been implemented for Win32. Note: unlike
system LISTthis does not fall back to the shell.[GH #13574] <https://github.com/Perl/perl5/issues/13574> - New
DebugSymbolsandDebugFullconfiguration options added to Windows makefiles. - Previously, compiling XS modules (including CPAN ones) using Visual C++ for Win64 resulted in around a dozen warnings per file from
hv_func.h. These warnings have been silenced. - Support for building without PerlIO has been removed from the Windows makefiles. Non-PerlIO builds were all but deprecated in Perl 5.18.0 and are already not supported by Configure on POSIX systems.
- Between 2 and 6 milliseconds and seven I/O calls have been saved per attempt to open a perl module for each path in
@INC. - Intel C builds are now always built with C99 mode on.
%I64dis now being used instead of%lldfor MinGW.- In the experimental
:win32layer, a crash inopenwas fixed. Also opening/dev/null(which works under Win32 Perl's default:unixlayer) was implemented for:win32.[GH #13968] <https://github.com/Perl/perl5/issues/13968> - A new makefile option,
USE_LONG_DOUBLE, has been added to the Windows dmake makefile for gcc builds only. Set this todefineif you want perl to use long doubles to give more accuracy and range for floating point numbers.
๐ก OpenBSD ๐ก
On OpenBSD, Perl will now default to using the system malloc due to the security features it provides. Perl's own malloc wrapper has been in use since v5.14 due to performance reasons, but the OpenBSD project believes the tradeoff is worth it and would prefer that users who need the speed specifically ask for it.
[GH #13888] <https://github.com/Perl/perl5/issues/13888>.
โ๏ธ Solaris โ๏ธ
- We now look for the Sun Studio compiler in both
/opt/solstudio*and/opt/solarisstudio*. - Builds on Solaris 10 with
-Dusedtracewould fail early since make didn't follow implied dependencies to buildperldtrace.h. Added an explicit dependency todepend.[GH #13334] <https://github.com/Perl/perl5/issues/13334> - C99 options have been cleaned up; hints look for
solstudioas well asSUNWspro; and support for nativesetenvhas been added.
๐ง Internal Changes ๐ง
- Experimental support has been added to allow ops in the optree to locate their parent, if any. This is enabled by the non-default build option
-DPERL_OP_PARENT. It is envisaged that this will eventually become enabled by default, so XS code which directly accesses theop_siblingfield of ops should be updated to be future-proofed.
On PERL_OP_PARENT builds, the op_sibling field has been renamed op_sibparent and a new flag, op_moresib, added. On the last op in a sibling chain, op_moresib is false and op_sibparent points to the parent (if any) rather than being NULL.
To make existing code work transparently whether using PERL_OP_PARENT or not, a number of new macros and functions have been added that should be used, rather than directly manipulating op_sibling.
For the case of just reading op_sibling to determine the next sibling, two new macros have been added. A simple scan through a sibling chain like this:
for (; kid->op_sibling; kid = kid->op_sibling) { ... }
should now be written as:
for (; OpHAS_SIBLING(kid); kid = OpSIBLING(kid)) { ... }
For altering optrees, a general-purpose function op_sibling_splice() has been added, which allows for manipulation of a chain of sibling ops. By analogy with the Perl function splice(), it allows you to cut out zero or more ops from a sibling chain and replace them with zero or more new ops. It transparently handles all the updating of sibling, parent, op_last pointers etc.
If you need to manipulate ops at a lower level, then three new macros, OpMORESIB_set, OpLASTSIB_set and OpMAYBESIB_set are intended to be a low-level portable way to set op_sibling / op_sibparent while also updating op_moresib. The first sets the sibling pointer to a new sibling, the second makes the op the last sibling, and the third conditionally does the first or second action. Note that unlike op_sibling_splice() these macros won't maintain consistency in the parent at the same time (e.g. by updating op_first and op_last where appropriate).
A C-level Perl_op_parent() function and a Perl-level B::OP::parent() method have been added. The C function only exists under PERL_OP_PARENT builds (using it is build-time error on vanilla perls). B::OP::parent() exists always, but on a vanilla build it always returns NULL. Under PERL_OP_PARENT, they return the parent of the current op, if any. The variable $B::OP::does_parent allows you to determine whether B supports retrieving an op's parent.
PERL_OP_PARENT was introduced in 5.21.2, but the interface was changed considerably in 5.21.11. If you updated your code before the 5.21.11 changes, it may require further revision. The main changes after 5.21.2 were:
- The
OP_SIBLINGandOP_HAS_SIBLINGmacros have been renamedOpSIBLINGandOpHAS_SIBLINGfor consistency with other op-manipulating macros. - The
op_lastsibfield has been renamedop_moresib, and its meaning inverted. - The macro
OpSIBLING_sethas been removed, and has been superseded byOpMORESIB_setet al. - The
op_sibling_splice()function now accepts a nullparentargument where the splicing doesn't affect the first or last ops in the sibling chain
- Macros have been created to allow XS code to better manipulate the POSIX locale category
LC_NUMERIC. See "Locale-related functions and macros" in perlapi. - The previous
atoiet al replacement function,grok_atou, has now been superseded bygrok_atoUV. See perlclib for details. - A new function,
Perl_sv_get_backrefs(), has been added which allows you retrieve the weak references, if any, which point at an SV. - The
screaminstr()function has been removed. Although marked as public API, it was undocumented and had no usage in CPAN modules. Calling it has been fatal since 5.17.0. - The
newDEFSVOP(),block_start(),block_end()andintro_my()functions have been added to the API. - The internal
convertfunction inop.chas been renamedop_convert_listand added to the API. - The
sv_magic()function no longer forbidsextmagic on read-only values. After all, perl can't know whether the custom magic will modify the SV or not.[GH #14202] <https://github.com/Perl/perl5/issues/14202>. - Accessing
CvPADLISTin perlapi on an XSUB is now forbidden.
The CvPADLIST field has been reused for a different internal purpose for XSUBs. So in particular, you can no longer rely on it being NULL as a test of whether a CV is an XSUB. Use CvISXSUB() instead.
SVt_NVSVs are sometimes bodiless now ๐ โ but only when your build config and platform allow it, specifically whensizeof(NV)<=sizeof(IV). So what does "bodiless" even mean bestie? It means the NV value lives directly in the head of an SV, no separate body allocation needed. IVs have been doing this since 5.9.2 (tho for IVs it's always the move, no matter the platform or build config). NVs are just catching up. slay.- The
$DB::single,$DB::signaland$DB::tracevariables now have set- and get-magic that stores their values as IVs, and those IVs are what gets used when testing their values inpp_dbstate(). Why do we care? Because this stops perl from recursing infinitely if an overloaded object gets assigned to any of those variables. ๐ [GH #14013] <https://github.com/Perl/perl5/issues/14013>. Perl_tmps_grow()โ which is marked public API but is famously undocumented โ has been removed from the public API. Chill tho: this does not affect XS code that uses theEXTEND_MORTALmacro to pre-extend the mortal stack. ๐ซถ- Perl's internals no longer sets or uses the
SVs_PADMYflag. SoSvPADMY()now returns true for anything not markedPADTMP, andSVs_PADMYis now defined as0. iconique. - The macros
SETsvandSETsvUNhave been removed. They hadn't been used in the core since commit6f1401dc2afive years ago, and nobody found them present on CPAN either. gone, reduced to atoms. ๐ - The
SvFAKEbit (unused on HVs) got informally reserved by David Mitchell for future vtables work. putting a little "reserved" sign on it. ๐ - The
sv_catpvn_flags()function acceptsSV_CATBYTESandSV_CATUTF8flags, which say whether the appended string is bytes or UTF-8, respectively. (ngl these flags have actually been around since 5.16.0, they just weren't officially regarded as part of the API before. now they're official. glow up. โจ) - A new opcode class,
METHOP, has been introduced. It holds info used at runtime to make class/object method calls faster. ๐โ๏ธ๐จ
OP_METHOD and OP_METHOD_NAMED changed from being UNOP/SVOP to being METHOP. glow-up era for both of them.
cv_name()is a brand new API function you can hand a CV or a GV. It returns an SV containing the name of the subroutine, for use in diagnostics. [GH #12767] <https://github.com/Perl/perl5/issues/12767> [GH #13392] <https://github.com/Perl/perl5/issues/13392>cv_set_call_checker_flags()is a new API function that works likecv_set_call_checker(), except it lets the caller specify whether the call checker requires a full GV for reporting the subroutine's name, or whether it could just get passed a CV instead. Whatever value gets passed will be acceptable tocv_name(). For comparison:cv_set_call_checker()guarantees there will be a GV, but it may have to create one on the fly, which is inefficient. ๐ฎ๐จ [GH #12767] <https://github.com/Perl/perl5/issues/12767>CvGV(which is not part of the API) is now a more complex macro, and it may call a function and reify a GV. For the cases where it's been used as a boolean,CvHASGVhas been added โ it returns true for CVs that notionally have GVs, but without reifying the GV.CvGValso now returns a GV for lexical subs. [GH #13392] <https://github.com/Perl/perl5/issues/13392>- The
sync_localein perlapi function has been added to the public API. Look ๐, changing the program's locale should be avoided by XS code. But some non-Perl libraries called from XS just gotta, likeGtk. When that happens, Perl needs to be told the locale changed. Use this function to do it, before returning to Perl. the way that this is just necessary sometimes. - The defines and labels for the flags in the
op_privatefield of OPs are now auto-generated from data in regen/op_private. Noticeable effects: some of the flag output ofConcisemight differ slightly, and the flag output ofperl -Dxmay differ considerably (they both use the same set of labels now). Also, debugging builds now have a new assertion inop_free()to make sure the op doesn't have any unrecognized flags set inop_private. ๐ - The deprecated variable
PL_sv_objcounthas been removed. bye bestie. ๐ - Perl now tries to keep the locale category
LC_NUMERICset toC, except around operations that need it set to the program's underlying locale. Why? To protect the many XS modules that simply cannot cope with the decimal radix character not being a dot. ๐ซ Before this release, Perl initialized this category toC, but a call toPOSIX::setlocale()would change it. Now, such a call will change the underlying locale of theLC_NUMERICcategory for the program, but the locale exposed to XS code will stayC. There are new macros to manipulate the LC_NUMERIC locale, includingSTORE_LC_NUMERIC_SET_TO_NEEDEDandSTORE_LC_NUMERIC_FORCE_TO_UNDERLYING. See "Locale-related functions and macros" in perlapi. โจ - A new macro
isUTF8_CHARhas been written, and it efficiently determines if the string given by its parameters begins with a well-formed UTF-8 encoded character. she's efficient and she's iconic. ๐ฆ - The following private API functions all had their context parameter removed:
Perl_cast_ulong,Perl_cast_i32,Perl_cast_iv,Perl_cast_uv,Perl_cv_const_sv,Perl_mg_find,Perl_mg_findext,Perl_mg_magical,Perl_mini_mktime,Perl_my_dirfd,Perl_sv_backoff,Perl_utf8_hop.
Heads up tho ๐ข โ the prefix-less versions of those functions that are part of the public API, like cast_i32(), remain unaffected. they're fine. untouched. thriving.
- The
PADNAMEandPADNAMELISTtypes are now separate types, no longer just aliases for SV and AV. [GH #14250] <https://github.com/Perl/perl5/issues/14250>. - Pad names are now always UTF-8. The
PadnameUTF8macro always returns true. Previously this was, like, effectively already the case, but any support for two different internal representations of pad names has now been removed. one representation to rule them all. ๐ - A new op class,
UNOP_AUX, has been added. It's a subclass ofUNOPwith an addedop_auxfield, which points to an array of unions of UV, SV* etc. It's intended for when an op needs to store more data than a simpleop_svor whatever. Currently the only op of this type isOP_MULTIDEREF(see the very next item bestie). ๐ - A new op has been added,
OP_MULTIDEREF, and it performs one or more nested array and hash lookups where the key is a constant or simple variable. For example, the expression$a[0]{$k}[$i]โ which previously involved tenrv2Xv,Xelem,gvsvandconstops โ is now performed by a singlemultiderefop. ten ops โก๏ธ one op, that's the energy. It can also handlelocal,existsanddelete. A non-simple index expression, like[$i+1], is still done usingaelem/helem, and single-level array lookup with a small constant index is still done usingaelemfast. some things stay classic.
๐ Selected Bug Fixes ๐
closenow sets$!๐ฅ
When an I/O error occurs, the fact that there's been an error gets recorded in the handle. close returns false for such a handle. Previously the value of $! would be untouched by close, so the super common convention of writing close $fh or die $! did not work reliably. ๐ญ Now the handle records the value of $! too, and close restores it. the idiom is saved. we love to see it.
no renow can turn off everything thatuse reenables โจ
Previously, running no re would only turn off a few things. Now it can turn off all the enabled things. For example, back in the day the only way to stop debugging, once enabled, was to exit the enclosing block; that is now fixed. periodt.
pack("D", $x)andpack("F", $x)now zero the padding on x86 long double builds ๐ง
Under some build options on GCC 4.8 and later, they used to either overwrite the zero-initialized padding, or bypass the initialized buffer entirely. This caused op/pack.t to fail. [GH #14554] <https://github.com/Perl/perl5/issues/14554>
- Extending an array cloned from a parent thread could result in
Modification of a read-only value attemptederrors when you tried to modify the new elements. not anymore bestie. [GH #14605] <https://github.com/Perl/perl5/issues/14605> - An assertion failure and subsequent crash with
*x=<y>has been fixed. ๐โก๏ธ๐ซถ [GH #14493] <https://github.com/Perl/perl5/issues/14493> - A possible crashing/looping bug related to compiling lexical subs has been fixed. [GH #14596] <https://github.com/Perl/perl5/issues/14596>
- UTF-8 now works correctly in function names, in unquoted HERE-document terminators, and in variable names used as array indexes. ๐ [GH #14601] <https://github.com/Perl/perl5/issues/14601>
- Repeated global pattern matches in scalar context on large tainted strings were exponentially slow depending on the current match position in the string. that's like, so bad. fixed now. [GH #14238] <https://github.com/Perl/perl5/issues/14238>
- Various crashes due to the parser getting confused by syntax errors have been fixed. the parser said "not today" way too often, tbh. [GH #14496] <https://github.com/Perl/perl5/issues/14496> [GH #14497] <https://github.com/Perl/perl5/issues/14497> [GH #14548] <https://github.com/Perl/perl5/issues/14548> [GH #14564] <https://github.com/Perl/perl5/issues/14564>
splitin the scope of lexical$_has been fixed not to fail assertions. [GH #14483] <https://github.com/Perl/perl5/issues/14483>my $x : attrsyntax inside various list operators no longer fails assertions. [GH #14500] <https://github.com/Perl/perl5/issues/14500>- An
@sign in quotes followed by a non-ASCII digit (which is not a valid identifier) would cause the parser to crash, instead of simply trying the@as a literal. This has been fixed. [GH #14553] <https://github.com/Perl/perl5/issues/14553> *bar::=*foo::=*glob_with_hashhas been crashing since Perl 5.14, but no longer does. ๐ [GH #14512] <https://github.com/Perl/perl5/issues/14512>foreachin scalar context was not pushing an item on to the stack, which resulted in bugs. (print 4, scalar do { foreach(@x){} } + 1would print5.) It has been fixed to returnundef. [GH #14569] <https://github.com/Perl/perl5/issues/14569>- Several cases of data used to store environment variable contents in core C code being potentially overwritten before being used have been fixed. [GH #14476] <https://github.com/Perl/perl5/issues/14476>
- Bestie, some patterns starting with
/.*..../matched against long strings have been slow since v5.8, and some of the form/.*..../ihave been slow since v5.18 ๐ญ. They are now all fast again ๐ฅ. [GH #14475] <https://github.com/Perl/perl5/issues/14475>. - The original visible value of
$/is now preserved when you set it to an invalid value ๐. Previously, if you set$/to a reference to an array, for example, perl would produce a runtime error and not setPL_rs, but Perl code that checked$/would totally see the array reference ๐ต. [GH #14245] <https://github.com/Perl/perl5/issues/14245>. - In a regular expression pattern, a POSIX class, like
[:ascii:], must be inside a bracketed character class, likeqr/[[:ascii:]]/โจ. A warning gets issued when something looking like a POSIX class is not inside a bracketed class. That warning wasn't getting generated when the POSIX class was negated:[:^ascii:]๐. This is now fixed โ . - Perl 5.14.0 introduced a bug whereby
eval { LABEL: }would crash ๐. This has been fixed. [GH #14438] <https://github.com/Perl/perl5/issues/14438>. - Various crashes due to the parser getting confused by syntax errors have been fixed ๐ ๏ธ. [GH #14421] <https://github.com/Perl/perl5/issues/14421>. [GH #14472] <https://github.com/Perl/perl5/issues/14472>. [GH #14480] <https://github.com/Perl/perl5/issues/14480>. [GH #14447] <https://github.com/Perl/perl5/issues/14447>.
- Code like
/$a[/used to read the next line of input and treat it as though it came immediately after the opening bracket ๐ณ. Some invalid code consequently would parse and run, but some code caused crashes, so this is now disallowed. [GH #14462] <https://github.com/Perl/perl5/issues/14462>. - Fix argument underflow for
pack๐งฐ. [GH #14525] <https://github.com/Perl/perl5/issues/14525>. - Fix handling of non-strict
\x{}. Now\x{}is equivalent to\x{0}instead of faulting ๐ . stat -tis now no longer treated as stackable, just like-t stat๐ธ. [GH #14499] <https://github.com/Perl/perl5/issues/14499>.- The following no longer causes a SEGV:
qr{x+(y(?0))*}๐. - Fixed infinite loop in parsing backrefs in regexp patterns ๐โจ.
- Several minor bug fixes in behavior of Infinity and NaN, including warnings when stringifying Infinity-like or NaN-like strings ๐งฎ. For example,
NaNcydoesn't numify to NaN anymore ๐. - A bug in regular expression patterns that could lead to segfaults and other crashes has been fixed ๐ฉน. This occurred only in patterns compiled with
/iwhile taking into account the current POSIX locale (which usually means they have to be compiled within the scope ofuse locale), and there must be a string of at least 128 consecutive bytes to match ๐ค. [GH #14389] <https://github.com/Perl/perl5/issues/14389>. s///gnow works on very long strings (where there are more than 2 billion iterations) instead of dying with'Substitution loop'๐. [GH #11742] <https://github.com/Perl/perl5/issues/11742>. [GH #14190] <https://github.com/Perl/perl5/issues/14190>.gmtimeno longer crashes with not-a-number values โฐ๐. [GH #14365] <https://github.com/Perl/perl5/issues/14365>.\()(a reference to an empty list), andy///with lexical$_in scope, could both do a bad write past the end of the stack ๐ฑ. They have both been fixed to extend the stack first ๐ซถ.prototype()with no arguments used to read the previous item on the stack, soprint "foo", prototype()would print foo's prototype ๐ซ . It has been fixed to infer$_instead. [GH #14376] <https://github.com/Perl/perl5/issues/14376>.- Some cases of lexical state subs declared inside predeclared subs could crash, for example when evalling a string including the name of an outer variable, but no longer do โจ.
- Some cases of nested lexical state subs inside anonymous subs could cause
'Bizarre copy'errors or possibly even crashes ๐ต๐ซ. - When trying to emit warnings, perl's default debugger (
perl5db.pl) was sometimes giving'Undefined subroutine &DB::db_warn called'instead ๐ญ. This bug, which started to occur in Perl 5.18, has been fixed. [GH #14400] <https://github.com/Perl/perl5/issues/14400>. - Certain syntax errors in substitutions, such as
s/${<>{})//, would crash, and had done so since Perl 5.10 ๐. (In some cases the crash did not start happening till 5.16.) The crash has, of course, been fixed. [GH #14391] <https://github.com/Perl/perl5/issues/14391>. - Fix a couple of string grow size calculation overflows; in particular, a repeat expression like
33 x ~3could cause a large buffer overflow since the new output buffer size was not correctly handled bySvGROW()๐ฌ. An expression like this now properly produces a memory wrap panic. [GH #14401] <https://github.com/Perl/perl5/issues/14401>. formline("@...", "a");would crash ๐. TheFF_CHECKNLcase inpp_formline()didn't set the pointer used to mark the chop position, which led to theFF_MOREcase crashing with a segmentation fault. This has been fixed ๐ง. [GH #14388] <https://github.com/Perl/perl5/issues/14388>.- A possible buffer overrun and crash when parsing a literal pattern during regular expression compilation has been fixed ๐ก๏ธ. [GH #14416] <https://github.com/Perl/perl5/issues/14416>.
fchmod()andfutimes()now set$!when they fail due to being passed a closed file handle ๐ซ. [GH #14073] <https://github.com/Perl/perl5/issues/14073>.op_free()andscalarvoid()no longer crash due to a stack overflow when freeing a deeply recursive op tree ๐. [GH #11866] <https://github.com/Perl/perl5/issues/11866>.- In Perl 5.20.0,
$^Naccidentally had the internal UTF-8 flag turned off if accessed from a code block within a regular expression, effectively UTF-8-encoding the value ๐ต. This has been fixed. [GH #14211] <https://github.com/Perl/perl5/issues/14211>. - A failed
semctlcall no longer overwrites existing items on the stack, which means that(semctl(-1,0,0,0))[0]no longer gives an"uninitialized"warning ๐. else{foo()}with no space beforefoois now better at assigning the right line number to that statement ๐. [GH #14070] <https://github.com/Perl/perl5/issues/14070>.- Sometimes the assignment in
@array = splitgets optimised so thatsplititself writes directly to the array ๐. This caused a bug, preventing this assignment from being used in lvalue context. So(@a=split//,"foo")=bar()was an error ๐ค. (This bug probably goes back to Perl 3, when the optimisation was added.) It has now been fixed. [GH #14183] <https://github.com/Perl/perl5/issues/14183>. - When an argument list fails the checks specified by a subroutine signature (which is still an experimental feature), the resulting error messages now give the file and line number of the caller, not of the called subroutine ๐. [GH #13643] <https://github.com/Perl/perl5/issues/13643>.
- The flip-flop operators (
..and...in scalar context) used to maintain a separate state for each recursion level (the number of times the enclosing sub was called recursively), contrary to the documentation ๐. Now each closure has one internal state for each flip-flop. [GH #14110] <https://github.com/Perl/perl5/issues/14110>. - The flip-flop operator (
..in scalar context) would return the same scalar each time, unless the containing subroutine was called recursively ๐ณ. Now it always returns a new scalar. [GH #14110] <https://github.com/Perl/perl5/issues/14110>. use,no, statement labels, special blocks (BEGIN) and pod are now permitted as the first thing in amaporgrepblock, the block afterprintorsay(or other functions) returning a handle, and within${...},@{...}, etc. ๐ [GH #14088] <https://github.com/Perl/perl5/issues/14088>.- The repetition operator
xnow propagates lvalue context to its left-hand argument when used in contexts likeforeach๐. That allowsfor(($#that_array)x2) { ... }to work as expected if the loop modifies$_๐. (...) x ...in scalar context used to corrupt the stack if one operand was an object withxoverloading, causing erratic behavior ๐ต๐ซ. [GH #13811] <https://github.com/Perl/perl5/issues/13811>.- Assignment to a lexical scalar is often optimised away; for example in
my $x; $x = $y + $z, the assign operator is optimised away and the add operator writes its result directly to$xโ๏ธ. Various bugs related to this optimisation have been fixed. Certain operators on the right-hand side would sometimes fail to assign the value at all or assign the wrong value, or would callSTOREtwice or not at all on tied variables ๐ค. The operators affected were$foo++,$foo--, and-$foounderuse integer,chomp,chrandsetpgrp. - List assignments were sometimes buggy if the same scalar ended up on both sides of the assignment due to use of
tied,valuesoreach๐ฌ. The result would be the wrong value getting assigned. setpgrp($nonzero)(with one argument) was accidentally changed in 5.16 to meansetpgrp(0)๐ญ. This has been fixed โ .__SUB__could return the wrong value or even corrupt memory under the debugger (the-dswitch) and in subs containingeval $string๐.- When
sub () { $var }becomes inlinable, it now returns a different scalar each time, just as a non-inlinable sub would, though Perl still optimises the copy away in cases where it would make no observable difference ๐ง โจ. my sub f () { $var }andsub () : attr { $var }are no longer eligible for inlining ๐ซ. The former would crash; the latter would just throw the attributes away ๐. An exception is made for the little-known:methodattribute, which does nothing much ๐ .- Inlining of subs with an empty prototype is now more consistent than before ๐. Previously, a sub with multiple statements, of which all but the last were optimised away, would be inlinable only if it were an anonymous sub containing a string
evalorstatedeclaration or closing over an outer lexical variable (or any anonymous sub under the debugger) ๐ต. Now any sub that gets folded to a single constant after statements have been optimised away is eligible for inlining ๐ฅ. This applies to things likesub () { jabber() if DEBUG; 42 }๐. - Bestie. Some subroutines that had an explicit
returnin them were getting made inlinable, which directly contradicts the docs. Rude! Nowreturnalways prevents inlining. The docs won. โจ - On some systems (looking at you, VMS),
cryptcan hand back a non-ASCII string. And if the scalar you were assigning to had previously held a UTF-8 string,cryptwould forget to turn off the UTF-8 flag โ so your return value got corrupted. This one hit you with"$lexical = crypt ...". Fixed. ๐ญ cryptno longer callsFETCHtwice on a tied first argument. Once was enough, thanks. ๐- An unterminated here-doc sitting on the last line of a quote-like operator โ like
"qq[${ <<END }]"or"/(?{ <<END })/"โ no longer causes a double free. It started doing that in 5.18, so, like, it's been a whole thing. Fixed now. ๐ index()andrindex()no longer crash when you use them on strings over 2GB in size.[GH #13700]https://github.com/Perl/perl5/issues/13700.- That small memory leak in
PERL_SYS_INIT/PERL_SYS_INIT3on Win32 builds? It was previously intentional, but it's been fixed anyway. Heads up though: this might affect embedders who repeatedly create and destroy perl engines within the same process. ๐ซถ POSIX::localeconv()now returns the data for the program's underlying locale even when you call it from outside the scope ofuse locale. It's giving consistency. ๐ธPOSIX::localeconv()now works properly on platforms that don't haveLC_NUMERICand/orLC_MONETARY, or where Perl was compiled to disregard either or both of those locale categories. In those situations there are now no entries for the corresponding values in the hash thatlocaleconv()returns. No ghost entries, periodt. ๐POSIX::localeconv()now marks its returned values as UTF-8 or not, appropriately. Before, they were always returned as bytes โ even when they were supposed to be UTF-8 encoded. Iconic fix honestly. โจ- On Microsoft Windows, inside the scope of
use locale, these POSIX character classes were giving results that did not conform to the POSIX standard for many locales:"[[:alnum:]]","[[:alpha:]]","[[:blank:]]","[[:digit:]]","[[:graph:]]","[[:lower:]]","[[:print:]]","[[:punct:]]","[[:upper:]]","[[:word:]]", and"[[:xdigit:]]". Why? Because the underlying Microsoft implementation just doesn't follow the standard. ๐ Perl now takes special precautions to correct for this. Slay. - Many issues have been detected by Coverity (
http://www.coverity.com/) and fixed. Thank u Coverity. ๐ฆ system()and friends should now work properly on more Android builds.
So here's the tea: due to an oversight, the value you specified through "-Dtargetsh" to Configure would end up being ignored by some of the build process. Which meant perls cross-compiled for Android ended up with defective versions of system(), exec() and backticks โ the commands would go looking for "/bin/sh" instead of "/system/bin/sh", and so they'd fail on the vast majority of devices, leaving $! as "ENOENT". Fixed. ๐ซ
"qr(...\(...\)...)","qr[...\[...\]...]", and"qr{...\{...\}...}"now work. Before, it was literally impossible to escape these three left-characters with a backslash inside a regular expression pattern where they'd otherwise be considered metacharacters, when the pattern opening delimiter was the character and the closing delimiter was its mirror character. No cap. ๐ฅ"s///e"on tainted UTF-8 strings corruptedpos(). This bug was introduced in 5.20 and is now fixed.[GH #13948]https://github.com/Perl/perl5/issues/13948.- A non-word boundary in a regular expression (
"\B") didn't always match the end of the string โ in particular"q{} =~ /\B/"did not match. Introduced in perl 5.14, fixed now.[GH #13917]https://github.com/Perl/perl5/issues/13917. "" P" =~ /(?=.*P)P/"should match, and it didn't. Now fixed.[GH #13954]https://github.com/Perl/perl5/issues/13954.- Failing to compile
use Fooinside anevalcould leave behind a spuriousBEGINsubroutine definition, which would then produce aSubroutine BEGIN redefinedwarning on the next use ofuse, or any otherBEGINblock.[GH #13926]https://github.com/Perl/perl5/issues/13926. "method { BLOCK } ARGS"syntax now correctly parses the arguments if they begin with an opening brace.[GH #9085]https://github.com/Perl/perl5/issues/9085.- External libraries and Perl can have different ideas of what the locale is. (Relatable, we've all been there.) That's a problem when parsing version strings if the locale's numeric separator has been changed. Version parsing has been patched to make sure it handles the locales correctly.
[GH #13863]https://github.com/Perl/perl5/issues/13863. - A bug where zero-length assertions and code blocks inside a regex could cause
posto see an incorrect value has been fixed.[GH #14016]https://github.com/Perl/perl5/issues/14016. - Dereferencing constants now works correctly for typeglob constants. Before, the glob was stringified and its name looked up. Now the glob itself is used.
[GH #9891]https://github.com/Perl/perl5/issues/9891 - When the parser is dealing with a sigil (
"$""@""%""&)) followed by braces, it no longer tries to guess whether it's a block or a hash constructor โ because guessing the latter caused a syntax error. It can only be a block. The guessing game is over. ๐ "undef $reference"now frees the referent immediately, instead of hanging onto it until the next statement. Let it go, girl.[GH #14032]https://github.com/Perl/perl5/issues/14032- Various cases where the name of a sub gets used (autoload, overloading, error messages) used to crash for lexical subs, but those are fixed now. ๐
- Bareword lookup now tries to avoid vivifying packages if it turns out the bareword isn't going to be a subroutine name. Lowkey considerate of it.
- Compilation of anonymous constants (e.g.,
"sub () { 3 }") no longer deletes any subroutine named"__ANON__"in the current package. Not only was"*__ANON__{CODE}"being cleared, there was a memory leak too. This bug goes all the way back to Perl 5.8.0. ๐ - Stub declarations like
"sub f;"and"sub f ();"no longer wipe out constants of the same name declared byuse constant. This bug was introduced in Perl 5.10.0. โจ "qr/[\N{named sequence}]/"now works properly in many instances.
Some names known to "\N{...}" refer to a sequence of multiple characters, instead of the usual single character. Bracketed character classes generally only match single characters โ but now special handling has been added so they can match named sequences. Not if the class is inverted, and not if the sequence is specified as the beginning or end of a range. In those cases, the only behavior change from before is a slight rewording of the fatal error message given when this class is part of a "?[...])" construct. When the "[...]" stands alone, the same non-fatal warning as before is raised, and only the first character in the sequence is used โ again, just as before. ๐
- Tainted constants evaluated at compile time no longer cause unrelated statements to become tainted.
[GH #14059]https://github.com/Perl/perl5/issues/14059 "open $$fh, ...", which vivifies a handle with a name like"main::_GEN_0", was not giving the handle the right reference count, so a double free could happen. Fixed. ๐ญ- When the parser was deciding that a bareword was a method name, it would get confused if an
"our"sub with the same name existed โ and it would look up the method in the package of the"our"sub instead of the package of the invocant. Not the vibe. Fixed. ๐ซถ - The parser no longer gets confused by
"\U="inside a double-quoted string. It used to throw a syntax error, but now it compiles it correctly.[GH #10882]https://github.com/Perl/perl5/issues/10882 - It has always been the intention for the
"-B"and"-T"file test operators to treat UTF-8 encoded files as text. (perlfunc has been updated to say so.) Previously, some files could get considered UTF-8 when they actually weren't valid UTF-8. Now fixed โ and the operators also work on EBCDIC platforms as well. ๐ - Under some conditions, warning messages raised during regular expression pattern compilation were being output more than once. Fixed. We heard you the first time, bestie.
- Perl 5.20.0 introduced a regression where a UTF-8 encoded regular expression pattern containing a single ASCII lowercase letter did not match its uppercase counterpart. Fixed in both 5.20.1 and 5.22.0.
[GH #14051]https://github.com/Perl/perl5/issues/14051 - Constant folding could incorrectly suppress warnings if lexical warnings (
use warningsorno warnings) were not in effect and$^Wwere false at compile time and true at run time. Sneaky. Fixed. ๐ฆ - Loading Unicode tables during a regular expression match could cause assertion failures under debugging builds if the previous match used the very same regular expression.
[GH #14081]https://github.com/Perl/perl5/issues/14081 - Thread cloning used to work incorrectly for lexical subs, possibly causing crashes or double frees on exit. Fab. Fixed. ๐
- Since Perl 5.14.0, deleting
$SomePackage::{__ANON__}and then undefining an anonymous subroutine could corrupt things internally, which resulted in Devel::Peek crashing or B.pm giving nonsensical data. This has been fixed. ๐ "(caller $n)[3]"now reports the names of lexical subs, instead of treating them as"(unknown)". Give them their name back. ๐"sort subname LIST"now supports using a lexical sub as the comparison routine. Ate. ๐ฅ- Aliasing (e.g., via
"*x = *y") could confuse list assignments that mention the two names for the same variable on either side, causing the wrong values to be assigned.[GH #5788]https://github.com/Perl/perl5/issues/5788 - Long here-doc terminators could cause a bad read on short lines of input. Fixed. It's doubtful that any crash could have actually occurred, tbh. This bug goes back to when here-docs were introduced in Perl 3.000, twenty-five years ago. A true elder. ๐ญ
- An optimization in
splitto treat"split /^/"like"split /^/m"had the unfortunate side-effect of also treating"split /\A/"like"split /^/m", which it should not. Fixed. (Note, however, that"split /^x/"does not behave like"split /^x/m"โ which is also considered to be a bug and will be fixed in a future version.)[GH #14086]https://github.com/Perl/perl5/issues/14086 - The little-known
"my Class $var"syntax (see fields and attributes) could get confused in the scope ofuse utf8if"Class"were a constant whose value contained Latin-1 characters. Fixed. ๐
- Bestie, locking and unlocking values via
Hash::UtilorInternals::SvREADONLYdoes literally nothing now if those values were read-only from the start. Like, it used to be that unlocking them could crash you, hang you, or just act chaotic ๐ โ that's fixed, so don't go poking at it expecting a rewind. - Some unterminated
(?(...)...)constructs in regular expressions were out here crashing or giving the most unhinged error messages./``(?(1)/is one of those little gremlins ๐. pack "w", $tiedโ okay so it no longer callsFETCHtwice. Iconic, honestly. ๐- List assignments like
($x, $z) = (1, $y)now actually work right if$xand$yhave been aliased byforeach. Slay. โจ - Some patterns with code blocks that had syntax errors, like
/ (?{(^{})/, would hang or fail assertions on debugging builds. Now? They just give you errors. Growth. ๐ฑ - An assertion failure when parsing
sortwith debugging enabled has been fixed. [GH #14087] <https://github.com/Perl/perl5/issues/14087>. *a = *b; @a = split //, $b[1]could do a bad read and produce junk results. Not the vibe. Fixed.- In
() = @array = split, that() =at the beginning no longer confuses the optimizer into assuming a limit of 1. The optimizer was being dramatic for no reason and now it's chill ๐ซถ. - Fatal warnings no longer prevent the output of syntax errors. [GH #14155] <https://github.com/Perl/perl5/issues/14155>.
- Fixed a NaN double-to-long-double conversion error on VMS. For quiet NaNs (and only on Itanium, not Alpha, iykyk) negative infinity was being produced instead of NaN. Rude of it. Now fixed.
- Fixed the issue that caused
make distcleanto incorrectly leave some files behind. [GH #14108] <https://github.com/Perl/perl5/issues/14108>. - AIX now sets the length in
getsockoptcorrectly. [GH #13484] <https://github.com/Perl/perl5/issues/13484>. [cpan #91183] <https://rt.cpan.org/Ticket/Display.html?id=91183>. [cpan #85570] <https://rt.cpan.org/Ticket/Display.html?id=85570>. - The optimization phase of a regexp compilation could run "forever" and eat all your memory under certain circumstances; that's now fixed. [GH #13984] <https://github.com/Perl/perl5/issues/13984>. No more infinite gluttony ๐.
- The test script
t/op/crypt.tnow uses the SHA-256 algorithm if the default one is disabled, instead of just giving failures. [GH #13715] <https://github.com/Perl/perl5/issues/13715>. - Fixed an off-by-one error when setting the size of a shared array. [GH #14151] <https://github.com/Perl/perl5/issues/14151>.
- Fixed a bug that could cause perl to enter an infinite loop during compilation. In particular, a
while(1)within a sublist, e.g.
sub foo { () = ($a, my $b, ($c, do { while(1) {} })) }
The bug was introduced in 5.20.0 [GH #14165] <https://github.com/Perl/perl5/issues/14165>.
- On Win32, if a variable was
local-ized in a pseudo-process that later forked, restoring the original value in the child pseudo-process caused memory corruption and a crash in the child pseudo-process (and therefore the OS process). [GH #8641] <https://github.com/Perl/perl5/issues/8641>. Scary fr fr ๐ญ. - Calling
writeon a format with a^**field could produce a panic insv_chop()if there were insufficient arguments or if the variable used to fill the field was empty. [GH #14255] <https://github.com/Perl/perl5/issues/14255>. - Non-ASCII lexical sub names now appear without trailing junk when they appear in error messages. Clean. โจ
- The
\@subroutine prototype no longer flattens parenthesized arrays (taking a reference to each element), but takes a reference to the array itself. [GH #9111] <https://github.com/Perl/perl5/issues/9111>. - A block containing nothing except a C-style
forloop could corrupt the stack, causing lists outside the block to lose elements or have elements overwritten. This could happen withmap { for(...){...} } ...and with lists containingdo { for(...){...} }. [GH #14269] <https://github.com/Perl/perl5/issues/14269>. Stack corruption is NOT the main character energy we want ๐ . scalar()now propagates lvalue context, so thatfor(scalar($#foo)) { ... }can modify$#foothrough$_. Okay this one is kind of iconic actually.qr/@array(?{block})/no longer dies withBizarre copy of ARRAY. [GH #14292] <https://github.com/Perl/perl5/issues/14292>. (Love that error message tho, very me.)eval '$variable'in nested named subroutines would sometimes look up a global variable even with a lexical variable in scope. Bestie. The audacity. Fixed.- In perl 5.20.0,
sort CORE::fakewhere 'fake' is anything other than a keyword, started chopping off the last 6 characters and treating the result as a sort sub name. The previous behavior of treatingCORE::fakeas a sort sub name has been restored. [GH #14323] <https://github.com/Perl/perl5/issues/14323>. We're so back ๐ซถ. - Outside of
use utf8, a single-character Latin-1 lexical variable is disallowed. The error message for it,Can't use global $foo..., was giving garbage instead of the variable name. Garbage output is not the moment, so now it's fixed. readlineon a nonexistent handle was causing${^LAST_FH}to produce a reference to an undefined scalar (or fail an assertion). Now${^LAST_FH}ends up undefined. Cleaner, lowkey.(...) x ...in void context now applies scalar context to the left-hand argument, instead of the context the current sub was called in. [GH #14174] <https://github.com/Perl/perl5/issues/14174>.
๐ซ Known Problems ๐ซ
pack-ing a NaN on a perl compiled with Visual C 6 does not behave properly, leading to a test failure int/op/infnan.t. [GH #14705] <https://github.com/Perl/perl5/issues/14705>. Not ideal!! ๐ญ- A goal is for Perl to be able to be recompiled to work reasonably well on any Unicode version. In Perl 5.22, though, the earliest such version is Unicode 5.1 (current is 7.0).
- EBCDIC platforms
- The
cmp(and hencesort) operators do not necessarily give the correct results when both operands are UTF-EBCDIC encoded strings and there is a mixture of ASCII and/or control characters, along with other characters. - Ranges containing
\N{...}in thetr///(andy///) transliteration operators are treated differently than the equivalent ranges in regular expression patterns. They should, but don't, cause the values in the ranges to all be treated as Unicode code points, and not native ones. (Version 8 Regular Expressionsin perlre gives details as to how it should work.) - Encode and encoding are mostly broken. ๐
- Many CPAN modules that are shipped with core show failing tests.
pack/unpackwithU0format may not work properly.
- The
- The following modules are known to have test failures with this version of Perl. In many cases, patches have been submitted, so there will hopefully be new releases soon:
B::Generateversion 1.50B::Utilsversion 0.25Coroversion 6.42Dancerversion 1.3130Data::Aliasversion 1.18Data::Dump::Streamerversion 2.38Data::Utilversion 0.63Devel::Spyversion 0.07invokerversion 0.34Lexical::Varversion 0.009LWP::ConsoleLoggerversion 0.000018Masonversion 2.22NgxQueueversion 0.02Padreversion 1.00Parse::Keyword0.08
๐๏ธ Obituary ๐๏ธ
Brian McCauley died on May 8, 2015. He was a frequent poster to Usenet, Perl Monks, and other Perl forums, and made several CPAN contributions under the nick NOBULL, including to the Perl FAQ. He attended almost every YAPC::Europe, and indeed, helped organise YAPC::Europe 2006 and the QA Hackathon 2009. His wit and his delight in intricate systems were particularly apparent in his love of board games; many Perl mongers will have fond memories of playing Fluxx and other games with Brian. He will be missed. ๐ซถ๐
๐ธ Acknowledgements ๐ธ
Perl 5.22.0 represents approximately 12 months of development since Perl 5.20.0 and contains approximately 590,000 lines of changes across 2,400 files from 94 authors. The math is mathing and the effort is immaculate.
Excluding auto-generated files, documentation and release tools, there were approximately 370,000 lines of changes to 1,500 .pm, .t, .c and .h files. That's a LOT of files bestie.
Perl continues to flourish into its third decade thanks to a vibrant community of users and developers. The following people are known to have contributed the improvements that became Perl 5.22.0:
Aaron Crane, Abhijit Menon-Sen, Abigail, Alberto Simรตes, Alex Solovey, Alex Vandiver, Alexandr Ciornii, Alexandre (Midnite) Jousset, Andreas Kรถnig, Andreas Voegele, Andrew Fresh, Andy Dougherty, Anthony Heading, Aristotle Pagaltzis, brian d foy, Brian Fraser, Chad Granum, Chris 'BinGOs' Williams, Craig A. Berry, Dagfinn Ilmari Mannsรฅker, Daniel Dragan, Darin McBride, Dave Rolsky, David Golden, David Mitchell, David Wheeler, Dmitri Tikhonov, Doug Bell, E. Choroba, Ed J, Eric Herman, Father Chrysostomos, George Greer, Glenn D. Golden, Graham Knop, H.Merijn Brand, Herbert Breunung, Hugo van der Sanden, James E Keenan, James McCoy, James Raspass, Jan Dubois, Jarkko Hietaniemi, Jasmine Ngan, Jerry D. Hedden, Jim Cromie, John Goodyear, kafka, Karen Etheridge, Karl Williamson, Kent Fredric, kmx, Lajos Veres, Leon Timmermans, Lukas Mai, Mathieu Arnold, Matthew Horsfall, Max Maischein, Michael Bunk, Nicholas Clark, Niels Thykier, Niko Tyni, Norman Koch, Olivier Menguรฉ, Peter John Acklam, Peter Martini, Petr Pรญsaล, Philippe Bruhat (BooK), Pierre Bogossian, Rafael Garcia-Suarez, Randy Stauner, Reini Urban, Ricardo Signes, Rob Hoelz, Rostislav Skudnov, Sawyer X, Shirakata Kentaro, Shlomi Fish, Sisyphus, Slaven Rezic, Smylers, Steffen Mรผller, Steve Hay, Sullivan Beck, syber, Tadeusz Soลnierz, Thomas Sibley, Todd Rinaldo, Tony Cook, Vincent Pit, Vladimir Marek, Yaroslav Kuzmin, Yves Orton, รvar Arnfjรถrรฐ Bjarmason. ๐ every single one of y'all ๐
The list above is almost certainly incomplete as it is automatically generated from version control history. In particular, it does not include the names of the (very much appreciated) contributors who reported issues to the Perl bug tracker. Y'all are seen and loved too ๐.
Many of the changes included in this version originated in the CPAN modules included in Perl's core. We're grateful to the entire CPAN community for helping Perl to flourish. ๐ฆ
For a more complete list of all of Perl's historical contributors, please see the AUTHORS file in the Perl source distribution.
๐ Reporting Bugs ๐
okay bestie, so if you find something you're pretty sure is a bug, first things first โ go peek at the articles that got posted recently to the comp.lang.perl.misc newsgroup, and also the perl bug database over at <https://rt.perl.org/>. maybe somebody already found it, yk? also there might be info waiting for you at <http://www.perl.org/>, which is literally the Perl Home Page. ๐ โจ
and if you're like "no bestie, this is genuinely unreported" โ then pls run the perlbug program that ships with your release. important: trim that bug down to a tiny but sufficient test case. tiny!! sufficient!! both!! ๐ช๐ธ your bug report, plus the output of perl -V, gets sent off to perlbug@perl.org so the Perl porting team can analyse it. ๐
now if the bug you're reporting has security implications โ like, the kind that make it inappropriate to send to a publicly archived mailing list โ then send it to perl5-security-report@perl.org instead. ๐ this one points to a closed subscription, unarchived mailing list, and it includes all the core committers, who will be able to help assess the impact of the issues, figure out a resolution, and help co-ordinate the release of patches to mitigate or fix the problem across all platforms on which Perl is supported. slay. ๐
ok but fr fr โ please ONLY use that address for security issues in the Perl core. not for modules independently distributed on CPAN. them's different vibes entirely. ๐ซ
๐ SEE ALSO โจ
- The
Changesfile โ for an explanation of how to view exhaustive details on what changed. it's giving receipts. ๐งพ - The
INSTALLfile โ for how to build Perl. ๐จ - The
READMEfile โ for general stuff. (yes. general. stuff. iconic.) ๐ - The
ArtisticandCopyingfiles โ for copyright information. ๐
and that's the whole thing, bestie!! you made it to the end of the entire PERL5220DELTA(1perl) page which is honestly such a flex ๐๐ฆ go forth and write some absolutely unhinged but correct Perl, mwah ๐
โจ
this wasperl v5.44.0from2026-10-17, thePERL5220DELTA(1perl)page โ thanks for reading, ily, bye ๐๐ธ
๐ฆ 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