PERL5220DELTA(1) | Perl Programmers Reference Guide | PERL5220DELTA(1) |
perl5220delta - what is new for perl v5.22.0
This document describes differences between the 5.20.0 release and the 5.22.0 release.
If you are upgrading from an earlier release such as 5.18.0, first read perl5200delta, which describes differences between 5.18.0 and 5.20.0.
A new experimental facility has been added that makes the four standard bitwise operators ("& | ^ ~") treat their operands consistently as numbers, and introduces four new dotted operators ("&. |. ^. ~.") that treat their operands consistently as strings. The same applies to the assignment variants ("&= |= ^= &.= |.= ^.=").
To use this, enable the "bitwise" feature and disable the "experimental::bitwise" warnings category. See "Bitwise String Operators" in perlop for details. [GH #14348] <https://github.com/Perl/perl5/issues/14348>.
"<<>>" is like "<>" but uses three-argument "open" to open each file in @ARGV. This means that each element of @ARGV will be treated as an actual file name, and "|foo" won't be treated as a pipe open.
"qr/\b{gcb}/"
"gcb" stands for Grapheme Cluster Boundary. It is 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 long had the ability to deal with these through the "\X" regular escape sequence. Now, there is an alternative way of handling these. See "\b{}, \b, \B{}, \B" in perlrebackslash for details.
"qr/\b{wb}/"
"wb" stands for Word Boundary. It is a Unicode property that finds the boundary between words. This is similar to the plain "\b" (without braces) but is more suitable for natural language processing. It knows, for example, that 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 is a Unicode property to aid in parsing natural language sentences. See "\b{}, \b, \B{}, \B" in perlrebackslash for details.
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.
See "n" in perlre for more information.
This applies stricter syntax rules to regular expression patterns compiled within its scope. This will 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.
For details on what is 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>).
It is now possible to pass a parameter to "use locale" to specify a subset of locale categories to be locale-aware, with the remaining ones unaffected. See "The "use locale" pragma" in perllocale for details.
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_precedes", "int_n_sep_by_space", "int_n_sign_posn", "int_p_cs_precedes", "int_p_sep_by_space", and "int_p_sign_posn".
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. These are improved in this release.
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; this is perhaps the most useful idiom this feature provides:
foreach \%hash (@array_of_hash_refs) { ... }
This feature is experimental and must be enabled via "use feature 'refaliasing'". It will warn unless the "experimental::refaliasing" warnings category is disabled.
See "Assigning to References" in perlref
"prototype()" with no arguments now infers $_. [GH #14376] <https://github.com/Perl/perl5/issues/14376>.
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.
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 also sets $! to indicate that the operation is not supported.
Currently, this uses either a "dd_fd" member in the OS "DIR" structure, or a dirfd(3) function as specified by POSIX.1-2008.
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.
"(...) x ..." can now be used within a list that is assigned to, as long as the left-hand side is a valid lvalue. This allows "(undef,undef,$foo) = that_function()" to be written as "((undef)x2, $foo) = that_function()".
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 normalize them to the strings "Inf", "-Inf", and "NaN".
See also the POSIX enhancements.
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.
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", and "print '%c'") result in a fatal error.
Perl now supports (via a C level API) retrieving the C level backtrace (similar to what symbolic debuggers like gdb do).
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.
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.
Critical bugfix: outside packages could be replaced. Safe has been patched to 2.38 to address this.
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.
The experimental sub signatures feature, as introduced in 5.20, parsed signatures after attributes. In this release, following feedback from users of the experimental feature, the positioning has been moved such that signatures occur after the subroutine name (if any) and before the attribute list (if any).
The "&" prototype character now accepts only anonymous subs ("sub {...}"), things beginning with "\&", or an explicit "undef". Formerly it 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>.
In addition, the "\&" prototype was allowing subroutine calls, whereas 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>.
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.
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>.
E.g. "\N{TOO MANY SPACES}" or "\N{TRAILING SPACE }". This has been deprecated since v5.18.
Importing functions from "UNIVERSAL" has been deprecated since v5.12, and is now a fatal error. "use UNIVERSAL" without any arguments is still allowed.
In prior releases, failure to do this raised a deprecation warning.
These had been deprecated since v5.18.
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.
"(?[ ])" 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.
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.
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.
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.
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>.
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.
These have been deprecated since v5.6.1 and have raised deprecation warnings since v5.16.
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.
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')
This variable allows Perl scripts to be written in an encoding other than ASCII or UTF-8. However, it affects all modules globally, leading to wrong answers and segmentation faults. New scripts should be written in UTF-8; old scripts should be converted to UTF-8, which is easily done with the piconv utility.
The syntax for single-character variable names is more lenient than for longer variable names, allowing the one-character name to be a punctuation character or even invisible (a non-graphic). Perl v5.20 deprecated the ASCII-range controls as such a name. Now, all non-graphic characters that formerly were allowed are deprecated. The practical effect of this occurs only when not under "use utf8", and affects just the C1 controls (code points 0x80 through 0xFF), NO-BREAK SPACE, and SOFT HYPHEN.
In many cases Perl makes "sub () { $var }" into an inlinable constant subroutine, capturing the value of $var at the time the "sub" expression is evaluated. This can break the closure behavior in those cases where $var is subsequently modified, since the subroutine won't return the changed value. (Note that this all only applies to anonymous subroutines with an empty prototype ("sub ()").)
This usage is now deprecated in those cases where the variable could be modified elsewhere. Perl detects those cases and emits a deprecation warning. Such code will likely change in the future and stop producing a constant.
If your variable is only modified in the place where it is declared, then Perl will continue to make the sub inlinable with no warnings.
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 the second example above, detecting that $var is assigned to only once is too hard to detect. That it happens in a spot 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 is ignored, because it does not become part of the sub's body.) For more complex cases, such as "sub () { do_something() if 0; $var }" the behavior has changed such that inlining does not happen if the variable is modifiable elsewhere. Such cases should be rare.
It is now deprecated to say something like any of the following:
qr/foo/xx; /(?xax:foo)/; use re qw(/amxx);
That is, now "x" should only occur once in any string of contiguous regular expression pattern modifiers. We 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 (those enclosed in square brackets: "[...]").
This non-graphic character is essentially indistinguishable from a regular space, and so should not be allowed. See "CUSTOM ALIASES" in charnames.
If you want a literal left curly bracket (also called a left brace) in a regular expression pattern, you should now escape it by either preceding it with a backslash ("\{") or enclosing it within square brackets "[{]", or by using "\Q"; otherwise a deprecation warning will be raised. This was first announced as forthcoming in the v5.16 release; it will allow future extensions to the language to happen.
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.
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:
Tests can now be run in parallel.
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]
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.
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.
It now deparses "+sub : attr { ... }" correctly at the start of a statement. Without the initial "+", "sub" would be a statement label.
"BEGIN" blocks are now emitted in the right place most of the time, but the change unfortunately introduced a regression, in that "BEGIN" blocks occurring just before the end of the enclosing block may appear below it instead.
"B::Deparse" no longer puts erroneous "local" here and there, such as for "LIST = tr/a//d". [perl #119815]
Adjacent "use" statements are no longer accidentally nested if one contains a "do" block. [perl #115066]
Parenthesised arrays in lists passed to "\" are now correctly deparsed with parentheses (e.g., "\(@a, (@b), @c)" now retains the parentheses around @b), thus preserving the flattening behavior of referenced parenthesised arrays. Formerly, it only worked for one array: "\(@a)".
"local our" is now deparsed correctly, with the "our" included.
"for($foo; !$bar; $baz) {...}" was deparsed without the "!" (or "not"). This has been fixed.
Core keywords that conflict with lexical subroutines are now deparsed with the "CORE::" prefix.
"foreach state $x (...) {...}" now deparses correctly with "state" and not "my".
"our @array = split(...)" now deparses correctly with "our" in those cases where the assignment is optimized away.
It now deparses "our(LIST)" and typed lexical ("my Dog $spot") correctly.
Deparse $#_ as that instead of as $#{_}. [GH #14545] <https://github.com/Perl/perl5/issues/14545>
BEGIN blocks at the end of the enclosing scope are now deparsed in the right place. [perl #77452]
BEGIN blocks were sometimes deparsed as __ANON__, but are now always called BEGIN.
Lexical subroutines are now fully deparsed. [perl #116553]
"Anything =~ y///r" with "/r" no longer omits the left-hand operand.
The op trees that make up regexp code blocks are now deparsed for real. Formerly, the original string that made up the regular expression was used. 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 consistently escaped in strings, instead of some of the time. (There are still outstanding problems with regular expressions and identifiers that have not been fixed.)
When prototype sub calls are deparsed with "&" (e.g., under the -P option), "scalar" is now added where appropriate, to force the scalar context implied by the prototype.
"require(foo())", "do(foo())", "goto(foo())" and similar constructs with loop controls are now deparsed correctly. The outer parentheses are not optional.
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.
In deparsing feature bundles, "B::Deparse" was emitting "no feature;" first instead of "no feature ':all';". This has been fixed.
"chdir FH" is now deparsed without quotation marks.
"\my @a" is now deparsed without parentheses. (Parenthese would flatten the array.)
"system" and "exec" followed by a block are now deparsed correctly. Formerly there was an erroneous "do" before the block.
"use constant QR => qr/.../flags" followed by """ =~ QR" is no longer without the flags.
Deparsing "BEGIN { undef &foo }" with the -w switch enabled started to emit 'uninitialized' warnings in Perl 5.14. This has been fixed.
Deparsing calls to subs with a "(;+)" prototype resulted in an infinite loop. The "(;$") "(_)" and "(;_)" prototypes were given the wrong precedence, causing "foo($a<$b)" to be deparsed without the parentheses.
Deparse now provides a defined state sub in inner subs.
B::Op_private provides detailed information about the flags used in the "op_private" field of perl opcodes.
Document in CAVEATS that using strings as numbers won't always invoke the big number overloading, and how to invoke it. [rt.perl.org #123064]
"Carp::Heavy" now ignores version mismatches with Carp if Carp is newer than 1.12, since "Carp::Heavy"'s guts were 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.
It now accepts fully-qualified constant names, allowing constants to be defined in packages other than the caller.
Add support for "Cwd::getdcwd()" and introduce workaround for a misbehavior seen on Strawberry Perl 5.20.1.
Fix "chdir()" after building dependencies bug.
Introduce experimental support for plugins/hooks.
Integrate the "App::Cpan" sources.
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>
Works around limitations in "version::vpp" detecting v-string magic and adds support for forthcoming ExtUtils::MakeMaker bootstrap version.pm for Perls older than 5.10.0.
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>
Remove "dl_nonlazy" global if unused in Dynaloader. [perl #122926]
"piconv" now has better error handling when the encoding name is nonexistent, 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.
Add "-P" to the preprocessor command-line on GCC 5. GCC added extra line directives, breaking parsing of error code definitions. [rt.perl.org #123784]
Hardcodes features for Perls older than 5.15.7.
Fixes a regression on Android. [GH #14064] <https://github.com/Perl/perl5/issues/14064>
Fixes a bug with "maniread()"'s handling of quoted filenames and improves "manifind()" to follow symlinks. [GH #14003] <https://github.com/Perl/perl5/issues/14003>
Only declare "file" unused if we actually define it. Improve generated "RETVAL" code generation to avoid repeated references to ST(0). [perl #123278] Broaden and document the "/OBJ$/" to "/REF$/" typemap optimization for the "DESTROY" method. [perl #123418]
Add support for the Linux pipe buffer size "fcntl()" commands.
"find()" and "finddepth()" will now warn if passed inappropriate or misspelled options.
Avoid "SvIV()" expanding to call "get_sv()" three times in a few places. [perl #123606]
"keep_alive" is now fork-safe and thread-safe.
The XS implementation has been fixed for the sake of older Perls.
Document the limitations of the "connected()" method. [perl #123096]
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 Timeout for "connect()". [cpan #92075] <https://rt.cpan.org/Ticket/Display.html?id=92075>
Support for IPv6 and SSL to "Net::FTP", "Net::NNTP", "Net::POP3" and "Net::SMTP". Improvements in "Net::SMTP" authentication.
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.
Synchronize 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 of "Math::BigFloat->bdiv()" in list context now satisfies "x = 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=96329>
Support installations on older perls with an ExtUtils::MakeMaker earlier than 6.63_03
A redundant "ref $sub" check has been removed.
A warning from the gcc compiler is now avoided when building the XS.
Don't turn leading "//" into "/" on Cygwin. [perl #122635]
The debugger would cause an assertion failure. [GH #14605] <https://github.com/Perl/perl5/issues/14605>
"fork()" in the debugger under "tmux" will 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 on startup and restores it when you restart your program with "R" or "rerun". [GH #13691] <https://github.com/Perl/perl5/issues/13691>
Reading from a position well past the end of the scalar now correctly returns end of file. [perl #123443]
Seeking to a negative position still fails, but no longer leaves the file position set to a negation location.
"eof()" on a "PerlIO::scalar" handle now properly returns true when the file position is past the 2GB mark on 32-bit systems.
Attempting to write at file positions impossible for the platform now fail early rather than wrapping at 4GB.
Filehandles opened for reading or writing now have ":encoding(UTF-8)" set. [cpan #98019] <https://rt.cpan.org/Ticket/Display.html?id=98019>
The C99 math functions and constants (for example "acosh", "isinf", "isnan", "round", "trunc"; "M_E", "M_SQRT2", "M_PI") have been added.
"POSIX::tmpnam()" now produces a deprecation warning. [perl #122005]
"reval" was not propagating void context properly.
A new module, Sub::Util, has been added, containing functions related to CODE refs, including "subname" (inspired by "Sub::Identity") and "set_subname" (copied and renamed from "Sub::Name"). The use of "GetMagic" in "List::Util::reduce()" has also been fixed. [cpan #63211] <https://rt.cpan.org/Ticket/Display.html?id=63211>
Simplified the build process. [perl #123413]
When pretty printing negative "Time::Seconds", the "minus" is no longer lost.
Version 0.67's improved discontiguous contractions is invalidated by default and is supported as a parameter "long_contraction".
The XSUB implementation has been removed in favor of pure Perl.
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.
A bug has been fixed so that prop_value_aliases() returns "undef" instead of a wrong result for properties that are Perl extensions.
This module now works on EBCDIC platforms.
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.
Numerous changes. See the Changes file in the CPAN distribution for details.
"GetOSName()" now supports Windows 8.1, and building in C++ mode now works.
Building in C++ mode now works.
Allow XSLoader to load modules from a different namespace. [perl #122455]
The following modules (and associated modules) have been removed from the core perl distribution:
perlunicook
This document, by Tom Christiansen, provides examples of handling Unicode in Perl.
perlaix
perlapi
[GH #13835] <https://github.com/Perl/perl5/issues/13835>
perldata
perlebcdic
perlfilter
perlfunc
This has also been noted in perlport.
[GH #13907] <https://github.com/Perl/perl5/issues/13907>
perlguts
perlhack
perlhacktips
perlhpux
perllocale
perlmodstyle
perlop
perlpodspec
perlpolicy
perlport
perlre
perlrebackslash
perlrecharclass
perlref
perlsec
perlsyn
perlunicode
perluniintro
perlvar
perlvms
perlxs
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 Errors
(P) An internal request asked to add a scalar entry to something that wasn't a symbol table entry.
(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.
(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.
(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 use "if (@array) { # not empty }" for example.
(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.
(F) You passed an invalid number (like an infinity or not-a-number) to "chr".
(F) You tried converting an infinity or not-a-number to an unsigned character, which makes no sense.
(F) You tried converting an infinity or not-a-number to a character, which makes no sense.
(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?
(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 ":alias" import argument to "use charnames", but they could be defined by a translator installed into $^H{charnames}. See "CUSTOM ALIASES" in charnames.
(F) You defined a character name which ended in a space character. Remove the trailing space(s). Usually these names are defined in the ":alias" import argument to "use charnames", but they could be defined by a translator installed into $^H{charnames}. See "CUSTOM ALIASES" in charnames.
(F) The "const" attribute 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.
(F) Something went horribly bad in hexadecimal float handling.
(F) You have configured Perl to use long doubles but the internals of the long double format are unknown, therefore the hexadecimal float output is impossible.
(F) The script run under suidperl was somehow illegal.
(F) 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.
(F) 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.
(F) The pattern looks like a {min,max} quantifier, but the min or max could not be parsed as a valid number: either it has leading zeroes, or it represents too big a number to cope with. The <-- HERE shows where in the regular expression the problem was discovered. See perlre.
(F) You used "\b{...}" or "\B{...}" and the "..." is not known to Perl. The current valid ones are given in "\b{}, \b, \B{}, \B" in perlrebackslash.
(F) You tried to call "require" with no argument or with an undefined value as an argument. "require" expects either a package name or a file-specification as an argument. See "require" in perlfunc.
Formerly, "require" with no argument or "undef" warned about a Null filename.
New Warnings
(D deprecated) The "/\C/" character class was deprecated in v5.20, and now emits a warning. It is intended that it will become an error in v5.24. This character class matches a single byte even if it appears within a multi-byte character, breaks encapsulation, and can corrupt UTF-8 strings.
(W regexp) (only under "use re 'strict'" or within "(?[...])")
You specified a character that has the given plainer way of writing it, and which is also portable to platforms running with different character sets.
(W numeric) The indicated string was 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 details.
(W regexp) (only under "use re 'strict'" or within "(?[...])")
In a bracketed character class in a regular expression pattern, you had a range which has exactly one end of it specified using "\N{}", and the other end is specified using a non-portable mechanism. Perl treats the range as a Unicode range, that is, all the characters in it are considered to be the Unicode characters, and which may be different code points on some platforms Perl runs on. For example, "[\N{U+06}-\x08]" is treated as if you had instead said "[\N{U+06}-\N{U+08}]", that is it matches the characters whose code points in Unicode are 6, 7, and 8. But that "\x08" might indicate that you meant something different, so the warning gets raised.
(W locale) You are 1) 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.
The warnings category "locale" is new.
(S experimental::const_attr) The "const" attribute is experimental. If you want to use the feature, disable the warning with "no warnings 'experimental::const_attr'", but know that in doing so you are taking the risk that your code may break in a future Perl version.
(W overflow) You called "gmtime" with a number that it could not handle: too large, too small, or NaN. The returned value is "undef".
(W overflow) The hexadecimal floating point has larger exponent than the floating point supports.
(W overflow) The hexadecimal floating point has smaller exponent than the floating point supports.
(W overflow) The hexadecimal floating point literal had more bits in the mantissa (the part between the "0x" and the exponent, also known as the fraction or the significand) than the floating point supports.
(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 (needed to retrieve the digits under some configurations).
(W locale) You are using the named locale, which is a non-UTF-8 one, and which perl has determined is not fully compatible with what it can handle. The second %s gives a reason.
The warnings category "locale" is new.
(W overflow) You called "localtime" with a number that it could not handle: too large, too small, or NaN. The returned value is "undef".
(W numeric) You tried to execute the "x" repetition operator fewer than 0 times, which doesn't make sense.
(D deprecated) You defined a character name which contained a no-break space character. Change it to a regular space. Usually these names are defined in the ":alias" import argument to "use charnames", but they could be defined by a translator installed into $^H{charnames}. See "CUSTOM ALIASES" in charnames.
(W numeric) You tried to execute the "x" repetition operator "Inf" (or "-Inf") or NaN times, which doesn't make sense.
(S experimental::win32_perlio) The ":win32" PerlIO layer is experimental. If you want to take the risk of using this layer, simply disable this warning:
no warnings "experimental::win32_perlio";
(W regexp) (only under "use re 'strict'" or within "(?[...])")
Stricter rules help to find typos and other errors. Perhaps you didn't even intend a range here, if the "-" was meant to be some other character, or should have been escaped (like "\-"). If you did intend a range, the one that was used is not portable between ASCII and EBCDIC platforms, and 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 that the endpoints are specified by "\N{...}", but the meaning may still not be obvious.) The stricter rules require that ranges that start or stop with an ASCII character that is not 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.
(W regexp) (only under "use 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 this happens, both end points should be digits in the same group of 10 consecutive digits.
(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 only emitted when a printf-type format required fewer arguments than were supplied, but might be used in the future for e.g. "pack" in perlfunc.
The warnings category "redundant" is new. See also [GH #13534] <https://github.com/Perl/perl5/issues/13534>.
This is not a new diagnostic, but in earlier releases was accidentally not displayed if the transliteration contained wide characters. This is now fixed, so that you may see this diagnostic in places where you previously didn't (but should have).
(W locale) You are matching a regular expression using locale rules, and a Unicode boundary is being matched, but the locale is not a Unicode one. This 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.
(W regexp) You used a Unicode boundary ("\b{...}" or "\B{...}") in a portion of a regular expression where the character set modifiers "/a" or "/aa" are in effect. These two modifiers indicate an ASCII interpretation, and this doesn't 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.
(S experimental::bitwise) This warning is emitted if you use bitwise operators ("& | ^ ~ &. |. ^. ~.") with the "bitwise" feature enabled. Simply suppress the warning if you want to use the feature, but know that in doing so you are taking the risk of using an experimental feature which may change or be removed in a future Perl version:
no warnings "experimental::bitwise"; use feature "bitwise"; $x |.= $y;
(D deprecated, regexp) You used a literal "{" character in a regular expression pattern. You should change to use "\{" instead, because a future version of Perl (tentatively v5.26) will consider this to be a syntax error. If the pattern delimiters are also braces, any matching right brace ("}") should also be escaped to avoid confusing the parser, for example,
qr{abc\{def\}ghi}
(D deprecated) Using literal non-graphic (including control) characters in the source to refer to the ^FOO variables, like $^X and "${^GLOBAL_PHASE}" is now deprecated.
(W misc) The "const" attribute has no effect except on anonymous closure prototypes. You applied it to a subroutine via attributes.pm. This is only useful inside an attribute handler for an anonymous subroutine.
This is not a new diagnostic, but in earlier releases was accidentally not displayed if the transliteration contained wide characters. This is now fixed, so that you may see this diagnostic in places where you previously didn't (but should have).
(S experimental::re_strict) The things that are different when a regular expression pattern is compiled under 'strict' are subject to change in future Perl releases in incompatible ways; there are also proposals to change how to enable strict checking instead of using this subpragma. This means that a pattern that compiles today may not in a future Perl release. This warning is to alert you to that risk.
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 reference count of the filehandle reached zero and the user's code hadn't already called "close()"; e.g.
{ open my $fh, '>', $file or die "open: '$file': $!\n"; print $fh, $data or die; } # implicit close here
In a situation such as disk full, due to buffering, the error may only be detected during the final close, so not checking the result of the close is dangerous.
So perl now warns in such situations.
(W locale) While in a single-byte locale (i.e., a non-UTF-8 one), a multi-byte character was encountered. Perl considers this character to be the specified Unicode code point. Combining non-UTF-8 locales and Unicode is dangerous. Almost certainly some characters will have two different representations. For example, in the ISO 8859-7 (Greek) locale, the code point 0xC3 represents a Capital Gamma. But so also does 0x393. This will make string comparisons unreliable.
You likely need to figure out how this multi-byte character got mixed up with your single-byte locale (or perhaps you thought you had a UTF-8 locale, but Perl disagrees).
The warnings category "locale" is new.
This warning has been changed to <> at require-statement should be quotes to make the issue more identifiable.
The perldiag entry for this warning has added this clarifying note:
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.
This message has had '(did you forget to declare "my %s"?)' appended to it, to make it more helpful to new Perl programmers. [GH #13732] <https://github.com/Perl/perl5/issues/13732>
This message has had character class changed to inverted character class or as a range end-point is to reflect improvements in "qr/[\N{named sequence}]/" (see under "Selected Bug Fixes").
This message has had ': %f' appended to it, to show what the offending floating point number is.
This warning is now only produced when the newline is at the end of the filename.
The perldiag entry for this warning has had information about Unicode behavior added.
There is actually no ambiguity here, and this impedes the use of negated constants; e.g., "-Inf".
Compile-time checking of constant dereferencing (e.g., "my_constant->()") has been removed, since it was not taking overloading into account. [GH #9891] <https://github.com/Perl/perl5/issues/9891> [GH #14044] <https://github.com/Perl/perl5/issues/14044>
This removes find2perl, s2p and a2p. They have all been released to CPAN as separate distributions ("App::find2perl", "App::s2p", "App::a2p").
For example:
TEST_JOBS=9 make test.valgrind
See "valgrind" in perlhacktips for more information.
[GH #13658] <https://github.com/Perl/perl5/issues/13658>
This was an unmaintained attempt at preserving the Perl parse tree more faithfully so that automatic conversion of Perl 5 to Perl 6 would have been easier.
This build-time configuration option had been unmaintained for years, and had probably seriously diverged on both Perl 5 and Perl 6 sides.
[GH #13888] <https://github.com/Perl/perl5/issues/13888>.
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 "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.
"OP_METHOD" and "OP_METHOD_NAMED" have changed from being "UNOP/SVOP" to being "METHOP".
[GH #12767] <https://github.com/Perl/perl5/issues/12767> [GH #13392] <https://github.com/Perl/perl5/issues/13392>
Note that the prefix-less versions of those functions that are part of the public API, such as "cast_i32()", remain unaffected.
When an I/O error occurs, the fact that there has been an error is recorded in the handle. "close" returns false for such a handle. Previously, the value of $! would be untouched by "close", so the common convention of writing "close $fh or die $!" did not work reliably. Now the handle records the value of $!, too, and "close" restores it.
Previously, running "no re" would turn off only a few things. Now it can turn off all the enabled things. For example, the only way to stop debugging, once enabled, was to exit the enclosing block; that is now fixed.
Some subroutines with an explicit "return" were being made inlinable, contrary to the documentation, Now "return" always prevents inlining.
Due to an oversight, the value specified through "-Dtargetsh" to Configure would end up being ignored by some of the build process. This caused perls cross-compiled for Android to end up with defective versions of "system()", "exec()" and backticks: the commands would end up looking for "/bin/sh" instead of "/system/bin/sh", and so would fail for the vast majority of devices, leaving $! as "ENOENT".
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 that they can match named sequences, but not if the class is inverted or the sequence is specified as the beginning or end of a range. In these 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.
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>.
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.
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.
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.
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 Simo~es, Alex Solovey, Alex Vandiver, Alexandr Ciornii, Alexandre (Midnite) Jousset, Andreas Koenig, 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 Mannsaaker, 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 Mengue, Peter John Acklam, Peter Martini, Petr PisaX, 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 Mueller, Steve Hay, Sullivan Beck, syber, Tadeusz SoXnierz, Thomas Sibley, Todd Rinaldo, Tony Cook, Vincent Pit, Vladimir Marek, Yaroslav Kuzmin, Yves Orton, AEvar Arnfjoerd` Bjarmason.
The list above is almost certainly incomplete as it is automatically generated from version control history. In particular, it does not include the names of the (very much appreciated) contributors who reported issues to the Perl bug tracker.
Many of the changes included in this version originated in the CPAN modules included in Perl's core. We're grateful to the entire CPAN community for helping Perl to flourish.
For a more complete list of all of Perl's historical contributors, please see the AUTHORS file in the Perl source distribution.
If you find what you think is a bug, you might check the articles recently posted to the comp.lang.perl.misc newsgroup and the perl bug database at <https://rt.perl.org/>. There may also be information at <http://www.perl.org/>, the Perl Home Page.
If you believe you have an unreported bug, please run the perlbug program included with your release. Be sure to trim your bug down to a tiny but sufficient test case. Your bug report, along with the output of "perl -V", will be sent off to perlbug@perl.org to be analysed by the Perl porting team.
If the bug you are reporting has security implications, which make it inappropriate to send to a publicly archived mailing list, then please send it to perl5-security-report@perl.org. This points to a closed subscription unarchived mailing list, which includes all the core committers, who will be able to help assess the impact of 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. Please only use this address for security issues in the Perl core, not for modules independently distributed on CPAN.
The Changes file for an explanation of how to view exhaustive details on what changed.
The INSTALL file for how to build Perl.
The README file for general stuff.
The Artistic and Copying files for copyright information.
2019-10-21 | perl v5.30.3 |