PERL5140DELTA(1) | Perl Programmers Reference Guide | PERL5140DELTA(1) |
perl5140delta - what is new for perl v5.14.0
This document describes differences between the 5.12.0 release and the 5.14.0 release.
If you are upgrading from an earlier release such as 5.10.0, first read perl5120delta, which describes differences between 5.10.0 and 5.12.0.
Some of the bug fixes in this release have been backported to subsequent releases of 5.12.x. Those are indicated with the 5.12.x version in parentheses.
As described in perlpolicy, the release of Perl 5.14.0 marks the official end of support for Perl 5.10. Users of Perl 5.10 or earlier should consider upgrading to a more recent release of Perl.
Unicode Version 6.0 is now supported (mostly)
Perl comes with the Unicode 6.0 data base updated with Corrigendum #8 <http://www.unicode.org/versions/corrigendum8.html>, with one exception noted below. See <http://unicode.org/versions/Unicode6.0.0/> for details on the new release. Perl does not support any Unicode provisional properties, including the new ones for this release.
Unicode 6.0 has chosen to use the name "BELL" for the character at U+1F514, which is a symbol that looks like a bell, and is used in Japanese cell phones. This conflicts with the long-standing Perl usage of having "BELL" mean the ASCII "BEL" character, U+0007. In Perl 5.14, "\N{BELL}" continues to mean U+0007, but its use generates a deprecation warning message unless such warnings are turned off. The new name for U+0007 in Perl is "ALERT", which corresponds nicely with the existing shorthand sequence for it, "\a". "\N{BEL}" means U+0007, with no warning given. The character at U+1F514 has no name in 5.14, but can be referred to by "\N{U+1F514}". In Perl 5.16, "\N{BELL}" will refer to U+1F514; all code that uses "\N{BELL}" should be converted to use "\N{ALERT}", "\N{BEL}", or "\a" before upgrading.
Full functionality for "use feature 'unicode_strings'"
This release provides full functionality for "use feature 'unicode_strings'". Under its scope, all string operations executed and regular expressions compiled (even if executed outside its scope) have Unicode semantics. See "the 'unicode_strings' feature" in feature. However, see "Inverted bracketed character classes and multi-character folds", below.
This feature avoids most forms of the "Unicode Bug" (see "The "Unicode Bug"" in perlunicode for details). If there is any possibility that your code will process Unicode strings, you are strongly encouraged to use this subpragma to avoid nasty surprises.
"\N{NAME}" and "charnames" enhancements
See charnames for details on all these changes.
New warnings categories for problematic (non-)Unicode code points.
Three new warnings subcategories of "utf8" have been added. These allow you to turn off some "utf8" warnings, while allowing other warnings to remain on. The three categories are: "surrogate" when UTF-16 surrogates are encountered; "nonchar" when Unicode non-character code points are encountered; and "non_unicode" when code points above the legal Unicode maximum of 0x10FFFF are encountered.
Any unsigned value can be encoded as a character
With this release, Perl is adopting a model that any unsigned value can be treated as a code point and encoded internally (as utf8) without warnings, not just the code points that are legal in Unicode. However, unless utf8 or the corresponding sub-category (see previous item) of lexical warnings have been explicitly turned off, outputting or executing a Unicode-defined operation such as upper-casing on such a code point generates a warning. Attempting to input these using strict rules (such as with the ":encoding(UTF-8)" layer) will continue to fail. Prior to this release, handling was inconsistent and in places, incorrect.
Unicode non-characters, some of which previously were erroneously considered illegal in places by Perl, contrary to the Unicode Standard, are now always legal internally. Inputting or outputting them works the same as with the non-legal Unicode code points, because the Unicode Standard says they are (only) illegal for "open interchange".
Unicode database files not installed
The Unicode database files are no longer installed with Perl. This doesn't affect any functionality in Perl and saves significant disk space. If you need these files, you can download them from <http://www.unicode.org/Public/zipped/6.0.0/>.
"(?^...)" construct signifies default modifiers
An ASCII caret "^" immediately following a "(?" in a regular expression now means that the subexpression does not inherit surrounding modifiers such as "/i", but reverts to the Perl defaults. Any modifiers following the caret override the defaults.
Stringification of regular expressions now uses this notation. For example, "qr/hlagh/i" would previously be stringified as "(?i-xsm:hlagh)", but now it's stringified as "(?^i:hlagh)".
The main purpose of this change is to allow tests that rely on the stringification not to have to change whenever new modifiers are added. See "Extended Patterns" in perlre.
This change is likely to break code that compares stringified regular expressions with fixed strings containing "?-xism".
"/d", "/l", "/u", and "/a" modifiers
Four new regular expression modifiers have been added. These are mutually exclusive: one only can be turned on at a time.
If the "/a" modifier is repeated, then additionally in case-insensitive matching, no ASCII character can match a non-ASCII character. For example,
"k" =~ /\N{KELVIN SIGN}/ai "\xDF" =~ /ss/ai
match but
"k" =~ /\N{KELVIN SIGN}/aai "\xDF" =~ /ss/aai
do not match.
See "Modifiers" in perlre for more detail.
Non-destructive substitution
The substitution ("s///") and transliteration ("y///") operators now support an "/r" option that copies the input variable, carries out the substitution on the copy, and returns the result. The original remains unmodified.
my $old = "cat"; my $new = $old =~ s/cat/dog/r; # $old is "cat" and $new is "dog"
This is particularly useful with "map". See perlop for more examples.
Re-entrant regular expression engine
It is now safe to use regular expressions within "(?{...})" and "(??{...})" code blocks inside regular expressions.
These blocks are still experimental, however, and still have problems with lexical ("my") variables and abnormal exiting.
"use re '/flags'"
The "re" pragma now has the ability to turn on regular expression flags till the end of the lexical scope:
use re "/x"; "foo" =~ / (.+) /; # /x implied
See "'/flags' mode" in re for details.
\o{...} for octals
There is a new octal escape sequence, "\o", in doublequote-like contexts. This construct allows large octal ordinals beyond the current max of 0777 to be represented. It also allows you to specify a character in octal which can safely be concatenated with other regex snippets and which won't be confused with being a backreference to a regex capture group. See "Capture groups" in perlre.
Add "\p{Titlecase}" as a synonym for "\p{Title}"
This synonym is added for symmetry with the Unicode property names "\p{Uppercase}" and "\p{Lowercase}".
Regular expression debugging output improvement
Regular expression debugging output (turned on by "use re 'debug'") now uses hexadecimal when escaping non-ASCII characters, instead of octal.
Return value of "delete $+{...}"
Custom regular expression engines can now determine the return value of "delete" on an entry of "%+" or "%-".
Array and hash container functions accept references
Warning: This feature is considered experimental, as the exact behaviour may change in a future version of Perl.
All builtin functions that operate directly on array or hash containers now also accept unblessed hard references to arrays or hashes:
|----------------------------+---------------------------| | Traditional syntax | Terse syntax | |----------------------------+---------------------------| | push @$arrayref, @stuff | push $arrayref, @stuff | | unshift @$arrayref, @stuff | unshift $arrayref, @stuff | | pop @$arrayref | pop $arrayref | | shift @$arrayref | shift $arrayref | | splice @$arrayref, 0, 2 | splice $arrayref, 0, 2 | | keys %$hashref | keys $hashref | | keys @$arrayref | keys $arrayref | | values %$hashref | values $hashref | | values @$arrayref | values $arrayref | | ($k,$v) = each %$hashref | ($k,$v) = each $hashref | | ($k,$v) = each @$arrayref | ($k,$v) = each $arrayref | |----------------------------+---------------------------|
This allows these builtin functions to act on long dereferencing chains or on the return value of subroutines without needing to wrap them in "@{}" or "%{}":
push @{$obj->tags}, $new_tag; # old way push $obj->tags, $new_tag; # new way for ( keys %{$hoh->{genres}{artists}} ) {...} # old way for ( keys $hoh->{genres}{artists} ) {...} # new way
Single term prototype
The "+" prototype is a special alternative to "$" that acts like "\[@%]" when given a literal array or hash variable, but will otherwise force scalar context on the argument. See "Prototypes" in perlsub.
"package" block syntax
A package declaration can now contain a code block, in which case the declaration is in scope inside that block only. So "package Foo { ... }" is precisely equivalent to "{ package Foo; ... }". It also works with a version number in the declaration, as in "package Foo 1.2 { ... }", which is its most attractive feature. See perlfunc.
Statement labels can appear in more places
Statement labels can now occur before any type of statement or declaration, such as "package".
Stacked labels
Multiple statement labels can now appear before a single statement.
Uppercase X/B allowed in hexadecimal/binary literals
Literals may now use either upper case "0X..." or "0B..." prefixes, in addition to the already supported "0x..." and "0b..." syntax [perl #76296].
C, Ruby, Python, and PHP already support this syntax, and it makes Perl more internally consistent: a round-trip with "eval sprintf "%#X", 0x10" now returns 16, just like "eval sprintf "%#x", 0x10".
Overridable tie functions
"tie", "tied" and "untie" can now be overridden [perl #75902].
To make them more reliable and consistent, several changes have been made to how "die", "warn", and $@ behave.
Likewise, a "local $@" inside an "eval" no longer clobbers any exception thrown in its scope. Previously, the restoration of $@ upon unwinding would overwrite any exception being thrown. Now the exception gets to the "eval" anyway. So "local $@" is safe before a "die".
Exceptions thrown from object destructors no longer modify the $@ of the surrounding context. (If the surrounding context was exception unwinding, this used to be another way to clobber the exception being thrown.) Previously such an exception was sometimes emitted as a warning, and then either was string-appended to the surrounding $@ or completely replaced the surrounding $@, depending on whether that exception and the surrounding $@ were strings or objects. Now, an exception in this situation is always emitted as a warning, leaving the surrounding $@ untouched. In addition to object destructors, this also affects any function call run by XS code using the "G_KEEPERR" flag.
Assignment to $0 sets the legacy process name with prctl() on Linux
On Linux the legacy process name is now set with prctl(2), in addition to altering the POSIX name via "argv[0]", as Perl has done since version 4.000. Now system utilities that read the legacy process name such as ps, top, and killall recognize the name you set when assigning to $0. The string you supply is truncated at 16 bytes; this limitation is imposed by Linux.
srand() now returns the seed
This allows programs that need to have repeatable results not to have to come up with their own seed-generating mechanism. Instead, they can use srand() and stash the return value for future use. One example is a test program with too many combinations to test comprehensively in the time available for each run. It can test a random subset each time and, should there be a failure, log the seed used for that run so this can later be used to produce the same results.
printf-like functions understand post-1980 size modifiers
Perl's printf and sprintf operators, and Perl's internal printf replacement function, now understand the C90 size modifiers "hh" ("char"), "z" ("size_t"), and "t" ("ptrdiff_t"). Also, when compiled with a C99 compiler, Perl now understands the size modifier "j" ("intmax_t") (but this is not portable).
So, for example, on any modern machine, "sprintf("%hhd", 257)" returns "1".
New global variable "${^GLOBAL_PHASE}"
A new global variable, "${^GLOBAL_PHASE}", has been added to allow introspection of the current phase of the Perl interpreter. It's explained in detail in "${^GLOBAL_PHASE}" in perlvar and in "BEGIN, UNITCHECK, CHECK, INIT and END" in perlmod.
"-d:-foo" calls "Devel::foo::unimport"
The syntax -d:foo was extended in 5.6.1 to make -d:foo=bar equivalent to -MDevel::foo=bar, which expands internally to "use Devel::foo 'bar'". Perl now allows prefixing the module name with -, with the same semantics as -M; that is:
This is particularly useful for suppressing the default actions of a "Devel::*" module's "import" method whilst still loading it for debugging.
Filehandle method calls load IO::File on demand
When a method call on a filehandle would die because the method cannot be resolved and IO::File has not been loaded, Perl now loads IO::File via "require" and attempts method resolution again:
open my $fh, ">", $file; $fh->binmode(":raw"); # loads IO::File and succeeds
This also works for globs like "STDOUT", "STDERR", and "STDIN":
STDOUT->autoflush(1);
Because this on-demand load happens only if method resolution fails, the legacy approach of manually loading an IO::File parent class for partial method support still works as expected:
use IO::Handle; open my $fh, ">", $file; $fh->autoflush(1); # IO::File not loaded
Improved IPv6 support
The "Socket" module provides new affordances for IPv6, including implementations of the "Socket::getaddrinfo()" and "Socket::getnameinfo()" functions, along with related constants and a handful of new functions. See Socket.
DTrace probes now include package name
The "DTrace" probes now include an additional argument, "arg3", which contains the package the subroutine being entered or left was compiled in.
For example, using the following DTrace script:
perl$target:::sub-entry { printf("%s::%s\n", copyinstr(arg0), copyinstr(arg3)); }
and then running:
$ perl -e 'sub test { }; test'
"DTrace" will print:
main::test
See "Internal Changes".
"User-Defined Character Properties" in perlunicode documented that you can create custom properties by defining subroutines whose names begin with "In" or "Is". However, Perl did not actually enforce that naming restriction, so "\p{foo::bar}" could call foo::bar() if it existed. The documented convention is now enforced.
Also, Perl no longer allows tainted regular expressions to invoke a user-defined property. It simply dies instead [perl #82616].
Perl 5.14.0 is not binary-compatible with any previous stable release.
In addition to the sections that follow, see "C API Changes".
Inverted bracketed character classes and multi-character folds
Some characters match a sequence of two or three characters in "/i" regular expression matching under Unicode rules. One example is "LATIN SMALL LETTER SHARP S" which matches the sequence "ss".
'ss' =~ /\A[\N{LATIN SMALL LETTER SHARP S}]\z/i # Matches
This, however, can lead to very counter-intuitive results, especially when inverted. Because of this, Perl 5.14 does not use multi-character "/i" matching in inverted character classes.
'ss' =~ /\A[^\N{LATIN SMALL LETTER SHARP S}]+\z/i # ???
This should match any sequences of characters that aren't the "SHARP S" nor what "SHARP S" matches under "/i". "s" isn't "SHARP S", but Unicode says that "ss" is what "SHARP S" matches under "/i". So which one "wins"? Do you fail the match because the string has "ss" or accept it because it has an "s" followed by another "s"?
Earlier releases of Perl did allow this multi-character matching, but due to bugs, it mostly did not work.
\400-\777
In certain circumstances, "\400"-"\777" in regexes have behaved differently than they behave in all other doublequote-like contexts. Since 5.10.1, Perl has issued a deprecation warning when this happens. Now, these literals behave the same in all doublequote-like contexts, namely to be equivalent to "\x{100}"-"\x{1FF}", with no deprecation warning.
Use of "\400"-"\777" in the command-line option -0 retain their conventional meaning. They slurp whole input files; previously, this was documented only for -0777.
Because of various ambiguities, you should use the new "\o{...}" construct to represent characters in octal instead.
Most "\p{}" properties are now immune to case-insensitive matching
For most Unicode properties, it doesn't make sense to have them match differently under "/i" case-insensitive matching. Doing so can lead to unexpected results and potential security holes. For example
m/\p{ASCII_Hex_Digit}+/i
could previously match non-ASCII characters because of the Unicode matching rules (although there were several bugs with this). Now matching under "/i" gives the same results as non-"/i" matching except for those few properties where people have come to expect differences, namely the ones where casing is an integral part of their meaning, such as "m/\p{Uppercase}/i" and "m/\p{Lowercase}/i", both of which match the same code points as matched by "m/\p{Cased}/i". Details are in "Unicode Properties" in perlrecharclass.
User-defined property handlers that need to match differently under "/i" must be changed to read the new boolean parameter passed to them, which is non-zero if case-insensitive matching is in effect and 0 otherwise. See "User-Defined Character Properties" in perlunicode.
\p{} implies Unicode semantics
Specifying a Unicode property in the pattern indicates that the pattern is meant for matching according to Unicode rules, the way "\N{NAME}" does.
Regular expressions retain their localeness when interpolated
Regular expressions compiled under "use locale" now retain this when interpolated into a new regular expression compiled outside a "use locale", and vice-versa.
Previously, one regular expression interpolated into another inherited the localeness of the surrounding regex, losing whatever state it originally had. This is considered a bug fix, but may trip up code that has come to rely on the incorrect behaviour.
Stringification of regexes has changed
Default regular expression modifiers are now notated using "(?^...)". Code relying on the old stringification will fail. This is so that when new modifiers are added, such code won't have to keep changing each time this happens, because the stringification will automatically incorporate the new modifiers.
Code that needs to work properly with both old- and new-style regexes can avoid the whole issue by using (for perls since 5.9.5; see re):
use re qw(regexp_pattern); my ($pat, $mods) = regexp_pattern($re_ref);
If the actual stringification is important or older Perls need to be supported, you can use something like the following:
# Accept both old and new-style stringification my $modifiers = (qr/foobar/ =~ /\Q(?^/) ? "^" : "-xism";
And then use $modifiers instead of "-xism".
Run-time code blocks in regular expressions inherit pragmata
Code blocks in regular expressions ("(?{...})" and "(??{...})") previously did not inherit pragmata (strict, warnings, etc.) if the regular expression was compiled at run time as happens in cases like these two:
use re "eval"; $foo =~ $bar; # when $bar contains (?{...}) $foo =~ /$bar(?{ $finished = 1 })/;
This bug has now been fixed, but code that relied on the buggy behaviour may need to be fixed to account for the correct behaviour.
Localised tied hashes and arrays are no longed tied
In the following:
tie @a, ...; { local @a; # here, @a is a now a new, untied array } # here, @a refers again to the old, tied array
Earlier versions of Perl incorrectly tied the new local array. This has now been fixed. This fix could however potentially cause a change in behaviour of some code.
Stashes are now always defined
"defined %Foo::" now always returns true, even when no symbols have yet been defined in that package.
This is a side-effect of removing a special-case kludge in the tokeniser, added for 5.10.0, to hide side-effects of changes to the internal storage of hashes. The fix drastically reduces hashes' memory overhead.
Calling defined on a stash has been deprecated since 5.6.0, warned on lexicals since 5.6.0, and warned for stashes and other package variables since 5.12.0. "defined %hash" has always exposed an implementation detail: emptying a hash by deleting all entries from it does not make "defined %hash" false. Hence "defined %hash" is not valid code to determine whether an arbitrary hash is empty. Instead, use the behaviour of an empty %hash always returning false in scalar context.
Clearing stashes
Stash list assignment "%foo:: = ()" used to make the stash temporarily anonymous while it was being emptied. Consequently, any of its subroutines referenced elsewhere would become anonymous, showing up as "(unknown)" in "caller". They now retain their package names such that "caller" returns the original sub name if there is still a reference to its typeglob and "foo::__ANON__" otherwise [perl #79208].
Dereferencing typeglobs
If you assign a typeglob to a scalar variable:
$glob = *foo;
the glob that is copied to $glob is marked with a special flag indicating that the glob is just a copy. This allows subsequent assignments to $glob to overwrite the glob. The original glob, however, is immutable.
Some Perl operators did not distinguish between these two types of globs. This would result in strange behaviour in edge cases: "untie $scalar" would not untie the scalar if the last thing assigned to it was a glob (because it treated it as "untie *$scalar", which unties a handle). Assignment to a glob slot (such as "*$glob = \@some_array") would simply assign "\@some_array" to $glob.
To fix this, the "*{}" operator (including its *foo and *$foo forms) has been modified to make a new immutable glob if its operand is a glob copy. This allows operators that make a distinction between globs and scalars to be modified to treat only immutable globs as globs. ("tie", "tied" and "untie" have been left as they are for compatibility's sake, but will warn. See "Deprecations".)
This causes an incompatible change in code that assigns a glob to the return value of "*{}" when that operator was passed a glob copy. Take the following code, for instance:
$glob = *foo; *$glob = *bar;
The *$glob on the second line returns a new immutable glob. That new glob is made an alias to *bar. Then it is discarded. So the second assignment has no effect.
See <https://github.com/Perl/perl5/issues/10625> for more detail.
Magic variables outside the main package
In previous versions of Perl, magic variables like $!, %SIG, etc. would "leak" into other packages. So %foo::SIG could be used to access signals, "${"foo::!"}" (with strict mode off) to access C's "errno", etc.
This was a bug, or an "unintentional" feature, which caused various ill effects, such as signal handlers being wiped when modules were loaded, etc.
This has been fixed (or the feature has been removed, depending on how you see it).
local($_) strips all magic from $_
local() on scalar variables gives them a new value but keeps all their magic intact. This has proven problematic for the default scalar variable $_, where perlsub recommends that any subroutine that assigns to $_ should first localize it. This would throw an exception if $_ is aliased to a read-only variable, and could in general have various unintentional side-effects.
Therefore, as an exception to the general rule, local($_) will not only assign a new value to $_, but also remove all existing magic from it as well.
Parsing of package and variable names
Parsing the names of packages and package variables has changed: multiple adjacent pairs of colons, as in "foo::::bar", are now all treated as package separators.
Regardless of this change, the exact parsing of package separators has never been guaranteed and is subject to change in future Perl versions.
"given" return values
"given" blocks now return the last evaluated expression, or an empty list if the block was exited by "break". Thus you can now write:
my $type = do { given ($num) { break when undef; "integer" when /^[+-]?[0-9]+$/; "float" when /^[+-]?[0-9]+(?:\.[0-9]+)?$/; "unknown"; } };
See "Return value" in perlsyn for details.
Change in parsing of certain prototypes
Functions declared with the following prototypes now behave correctly as unary functions:
* \$ \% \@ \* \& \[...] ;$ ;* ;\$ ;\% etc. ;\[...]
Due to this bug fix [perl #75904], functions using the "(*)", "(;$)" and "(;*)" prototypes are parsed with higher precedence than before. So in the following example:
sub foo(;$); foo $a < $b;
the second line is now parsed correctly as "foo($a) < $b", rather than "foo($a < $b)". This happens when one of these operators is used in an unparenthesised argument:
< > <= >= lt gt le ge == != <=> eq ne cmp ~~ & | ^ && || // .. ... ?: = += -= *= etc. , =>
Smart-matching against array slices
Previously, the following code resulted in a successful match:
my @a = qw(a y0 z); my @b = qw(a x0 z); @a[0 .. $#b] ~~ @b;
This odd behaviour has now been fixed [perl #77468].
Negation treats strings differently from before
The unary negation operator, "-", now treats strings that look like numbers as numbers [perl #57706].
Negative zero
Negative zero (-0.0), when converted to a string, now becomes "0" on all platforms. It used to become "-0" on some, but "0" on others.
If you still need to determine whether a zero is negative, use "sprintf("%g", $zero) =~ /^-/" or the Data::Float module on CPAN.
":=" is now a syntax error
Previously "my $pi := 4" was exactly equivalent to "my $pi : = 4", with the ":" being treated as the start of an attribute list, ending before the "=". The use of ":=" to mean ": =" was deprecated in 5.12.0, and is now a syntax error. This allows future use of ":=" as a new token.
Outside the core's tests for it, we find no Perl 5 code on CPAN using this construction, so we believe that this change will have little impact on real-world codebases.
If it is absolutely necessary to have empty attribute lists (for example, because of a code generator), simply avoid the error by adding a space before the "=".
Change in the parsing of identifiers
Characters outside the Unicode "XIDStart" set are no longer allowed at the beginning of an identifier. This means that certain accents and marks that normally follow an alphabetic character may no longer be the first character of an identifier.
Directory handles not copied to threads
On systems other than Windows that do not have a "fchdir" function, newly-created threads no longer inherit directory handles from their parent threads. Such programs would usually have crashed anyway [perl #75154].
"close" on shared pipes
To avoid deadlocks, the "close" function no longer waits for the child process to exit if the underlying file descriptor is still in use by another thread. It returns true in such cases.
fork() emulation will not wait for signalled children
On Windows parent processes would not terminate until all forked children had terminated first. However, "kill("KILL", ...)" is inherently unstable on pseudo-processes, and "kill("TERM", ...)" might not get delivered if the child is blocked in a system call.
To avoid the deadlock and still provide a safe mechanism to terminate the hosting process, Perl now no longer waits for children that have been sent a SIGTERM signal. It is up to the parent process to waitpid() for these children if child-cleanup processing must be allowed to finish. However, it is also then the responsibility of the parent to avoid the deadlock by making sure the child process can't be blocked on I/O.
See perlfork for more information about the fork() emulation on Windows.
Naming fixes in Policy_sh.SH may invalidate Policy.sh
Several long-standing typos and naming confusions in Policy_sh.SH have been fixed, standardizing on the variable names used in config.sh.
This will change the behaviour of Policy.sh if you happen to have been accidentally relying on its incorrect behaviour.
Perl source code is read in text mode on Windows
Perl scripts used to be read in binary mode on Windows for the benefit of the ByteLoader module (which is no longer part of core Perl). This had the side-effect of breaking various operations on the "DATA" filehandle, including seek()/tell(), and even simply reading from "DATA" after filehandles have been flushed by a call to system(), backticks, fork() etc.
The default build options for Windows have been changed to read Perl source code on Windows in text mode now. ByteLoader will (hopefully) be updated on CPAN to automatically handle this situation [perl #28106].
See also "Deprecated C APIs".
Omitting the space between a regular expression operator or its modifiers and the following word is deprecated. For example, "m/foo/sand $bar" is for now still parsed as "m/foo/s and $bar", but will now issue a warning.
The backslash-c construct was designed as a way of specifying non-printable characters, but there were no restrictions (on ASCII platforms) on what the character following the "c" could be. Now, a deprecation warning is raised if that character isn't an ASCII character. Also, a deprecation warning is raised for "\c{" (which is the same as simply saying ";").
In regular expressions, a literal "{" immediately following a "\b" (not in a bracketed character class) or a "\B{" is now deprecated to allow for its future use by Perl itself.
Perl bundles a handful of library files that predate Perl 5. This bundling is now deprecated for most of these files, which are now available from CPAN. The affected files now warn when run, if they were installed as part of the core.
This is a mandatory warning, not obeying -X or lexical warning bits. The warning is modelled on that supplied by deprecate.pm for deprecated-in-core .pm libraries. It points to the specific CPAN distribution that contains the .pl libraries. The CPAN versions, of course, do not generate the warning.
Assignment to $[ was deprecated and started to give warnings in Perl version 5.12.0. This version of Perl (5.14) now also emits a warning when assigning to $[ in list context. This fixes an oversight in 5.12.0.
Historically the parser fooled itself into thinking that "qw(...)" literals were always enclosed in parentheses, and as a result you could sometimes omit parentheses around them:
for $x qw(a b c) { ... }
The parser no longer lies to itself in this way. Wrap the list literal in parentheses like this:
for $x (qw(a b c)) { ... }
This is being deprecated because the parentheses in "for $i (1,2,3) { ... }" are not part of expression syntax. They are part of the statement syntax, with the "for" statement wanting literal parentheses. The synthetic parentheses that a "qw" expression acquired were only intended to be treated as part of expression syntax.
Note that this does not change the behaviour of cases like:
use POSIX qw(setlocale localeconv); our @EXPORT = qw(foo bar baz);
where parentheses were never required around the expression.
This is because Unicode is using that name for a different character. See "Unicode Version 6.0 is now supported (mostly)" for more explanation.
"?PATTERN?" (without the initial "m") has been deprecated and now produces a warning. This is to allow future use of "?" in new operators. The match-once functionality is still available as "m?PATTERN?".
Calling a tie function ("tie", "tied", "untie") with a scalar argument acts on a filehandle if the scalar happens to hold a typeglob.
This is a long-standing bug that will be removed in Perl 5.16, as there is currently no way to tie the scalar itself when it holds a typeglob, and no way to untie a scalar that has had a typeglob assigned to it.
Now there is a deprecation warning whenever a tie function is used on a handle without an explicit "*".
This feature is being deprecated due to its many issues, as documented in "User-Defined Case Mappings (for serious hackers only)" in perlunicode. This feature will be removed in Perl 5.16. Instead use the CPAN module Unicode::Casing, which provides improved functionality.
The following module will be removed from the core distribution in a future release, and should be installed from CPAN instead. Distributions on CPAN that require this should add it to their prerequisites. The core version of these module now issues a deprecation warning.
If you ship a packaged version of Perl, either alone or as part of a larger system, then you should carefully consider the repercussions of core module deprecations. You may want to consider shipping your default build of Perl with a package for the deprecated module that installs into "vendor" or "site" Perl library directories. This will inhibit the deprecation warnings.
Alternatively, you may want to consider patching lib/deprecate.pm to provide deprecation warnings specific to your packaging system or distribution of Perl, consistent with how your packaging system or distribution manages a staged transition from a release where the installation of a single package provides the given functionality, to a later release where the system administrator needs to know to install multiple packages to get that same functionality.
You can silence these deprecation warnings by installing the module in question from CPAN. To install the latest version of it by role rather than by name, just install "Task::Deprecations::5_14".
Signal dispatch has been moved from the runloop into control ops. This should give a few percent speed increase, and eliminates nearly all the speed penalty caused by the introduction of "safe signals" in 5.8.0. Signals should still be dispatched within the same statement as they were previously. If this does not happen, or if you find it possible to create uninterruptible loops, this is a bug, and reports are encouraged of how to recreate such issues.
Two fewer OPs are used for shift() and pop() calls with no argument (with implicit @_). This change makes shift() 5% faster than "shift @_" on non-threaded perls, and 25% faster on threaded ones.
The "foldEQ_utf8" API function for case-insensitive comparison of strings (which is used heavily by the regexp engine) was substantially refactored and optimised -- and its documentation much improved as a free bonus.
Compiling regular expressions has been made faster when upgrading the regex to utf8 is necessary but this isn't known when the compilation begins.
When doing a lot of string appending, perls built to use the system's "malloc" could end up allocating a lot more memory than needed in a inefficient way.
"sv_grow", the function used to allocate more memory if necessary when appending to a string, has been taught to round up the memory it requests to a certain geometric progression, making it much faster on certain platforms and configurations. On Win32, it's now about 100 times faster.
When "MULTIPLICITY" was first developed, and interpreter state moved into an interpreter struct, thread- and interpreter-local "PL_*" variables were defined as macros that called accessor functions (returning the address of the value) outside the Perl core. The intent was to allow members within the interpreter struct to change size without breaking binary compatibility, so that bug fixes could be merged to a maintenance branch that necessitated such a size change. This mechanism was redundant and penalised well-behaved code. It has been removed.
When there are many weak references to an object, freeing that object can under some circumstances take O(N*N) time to free, where N is the number of references. The circumstances in which this can happen have been reduced [perl #75254]
An earlier optimisation to speed up "my @array = ..." and "my %hash = ..." assignments caused a bug and was disabled in Perl 5.12.0.
Now we have found another way to speed up these assignments [perl #82110].
Previously, @_ was allocated for every subroutine at compile time with enough space for four entries. Now this allocation is done on demand when the subroutine is called [perl #72416].
"xhv_fill" has been eliminated from "struct xpvhv", saving 1 IV per hash and on some systems will cause "struct xpvhv" to become cache-aligned. To avoid this memory saving causing a slowdown elsewhere, boolean use of "HvFILL" now calls "HvTOTALKEYS" instead (which is equivalent), so while the fill data when actually required are now calculated on demand, cases when this needs to be done should be rare.
The order of structure elements in SV bodies has changed. Effectively, the NV slot has swapped location with STASH and MAGIC. As all access to SV members is via macros, this should be completely transparent. This change allows the space saving for PVHVs documented above, and may reduce the memory allocation needed for PVIVs on some architectures.
"XPV", "XPVIV", and "XPVNV" now allocate only the parts of the "SV" body they actually use, saving some space.
Scalars containing regular expressions now allocate only the part of the "SV" body they actually use, saving some space.
The @EXPORT_FAIL AV is no longer created unless needed, hence neither is the typeglob backing it. This saves about 200 bytes for every package that uses Exporter but doesn't use this functionality.
For weak references, the common case of just a single weak reference per referent has been optimised to reduce the storage required. In this case it saves the equivalent of one small Perl array per referent.
The bulk of the "Tie::Hash::NamedCapture" module used to be in the Perl core. It has now been moved to an XS module to reduce overhead for programs that do not use "%+" or "%-".
The internal structures of threading now make fewer API calls and fewer allocations, resulting in noticeably smaller object code. Additionally, many thread context checks have been deferred so they're done only as needed (although this is only possible for non-debugging builds).
Previously, in code such as
use constant DEBUG => 0; sub GAK { warn if DEBUG; print "stuff\n"; }
the ops for "warn if DEBUG" would be folded to a "null" op ("ex-const"), but the "nextstate" op would remain, resulting in a runtime op dispatch of "nextstate", "nextstate", etc.
The execution of a sequence of "nextstate" ops is indistinguishable from just the last "nextstate" op so the peephole optimizer now eliminates the first of a pair of "nextstate" ops except when the first carries a label, since labels must not be eliminated by the optimizer, and label usage isn't conclusively known at compile time.
Unicode::Collate::CJK::Big5
Unicode::Collate::CJK::GB2312
Unicode::Collate::CJK::JISX0208
Unicode::Collate::CJK::Korean
Unicode::Collate::CJK::Pinyin
Unicode::Collate::CJK::Stroke
Updates since 0.38 include: a safe print method that guards Archive::Extract from changes to "$\"; a fix to the tests when run in core Perl; support for TZ files; a modification for the lzma logic to favour IO::Uncompress::Unlzma; and a fix for an issue with NetBSD-current and its new unzip(1) executable.
Important changes since 1.54 include the following:
It no longer crashes when taking apart a "y///" containing characters outside the octet range or compiled in a "use utf8" scope.
The size of the shared object has been reduced by about 40%, with no reduction in functionality.
B::Concise marks rv2sv(), rv2av(), and rv2hv() ops with the new "OPpDEREF" flag as "DREFed".
It no longer produces mangled output with the -tree option [perl #80632].
The deparsing of a "nextstate" op has changed when it has both a change of package relative to the previous nextstate, or a change of "%^H" or other state and a label. The label was previously emitted first, but is now emitted last (5.12.1).
The "no 5.13.2" or similar form is now correctly handled by B::Deparse (5.12.3).
B::Deparse now properly handles the code that applies a conditional pattern match against implicit $_ as it was fixed in [perl #20444].
Deparsing of "our" followed by a variable with funny characters (as permitted under the "use utf8" pragma) has also been fixed [perl #33752].
Carp now detects incomplete caller() overrides and avoids using bogus @DB::args. To provide backtraces, Carp relies on particular behaviour of the caller() builtin. Carp now detects if other code has overridden this with an incomplete implementation, and modifies its backtrace accordingly. Previously incomplete overrides would cause incorrect values in backtraces (best case), or obscure fatal errors (worst case).
This fixes certain cases of "Bizarre copy of ARRAY" caused by modules overriding caller() incorrectly (5.12.2).
It now also avoids using regular expressions that cause Perl to load its Unicode tables, so as to avoid the "BEGIN not safe after errors" error that ensue if there has been a syntax error [perl #82854].
This provides the following security fixes: the MIME boundary in multipart_init() is now random and the handling of newlines embedded in header values has been improved.
It has been updated to use bzip2(1) 1.0.6.
Unicode constants work once more. They have been broken since Perl 5.10.0 [CPAN RT #67525].
Major highlights:
A change to cpanp-run-perl resolves RT #55964 <http://rt.cpan.org/Public/Bug/Display.html?id=55964> and RT #57106 <http://rt.cpan.org/Public/Bug/Display.html?id=57106>, both of which related to failures to install distributions that use "Module::Install::DSL" (5.12.2).
A dependency on Config was not recognised as a core module dependency. This has been fixed.
CPANPLUS now includes support for META.json and MYMETA.json.
The indentation used to be off when $Data::Dumper::Terse was set. This has been fixed [perl #73604].
This upgrade also fixes a crash when using custom sort functions that might cause the stack to change [perl #74170].
Dumpxs no longer crashes with globs returned by *$io_ref [perl #72332].
Merely loading Devel::DProf now no longer triggers profiling to start. Both "use Devel::DProf" and "perl -d:DProf ..." behave as before and start the profiler.
NOTE: Devel::DProf is deprecated and will be removed from a future version of Perl. We strongly recommend that you install and use Devel::NYTProf instead, as it offers significantly improved profiling and reporting.
It now renders pod links slightly better, and has been taught to find descriptions for messages that share their descriptions with other messages.
It is now safe to use this module in combination with threads.
"shasum" now more closely mimics sha1sum(1)/md5sum(1).
"addfile" accepts all POSIX filenames.
New SHA-512/224 and SHA-512/256 transforms (ref. NIST Draft FIPS 180-4 [February 2011])
It fixes a buffer overflow when passed a very long file name.
It no longer inherits from AutoLoader; hence it no longer produces weird error messages for unsuccessful method calls on classes that inherit from DynaLoader [perl #84358].
Now, all 66 Unicode non-characters are treated the same way U+FFFF has always been treated: in cases when it was disallowed, all 66 are disallowed, and in cases where it warned, all 66 warn.
The implementation of Errno has been refactored to use about 55% less memory.
On some platforms with unusual header files, like Win32 gcc(1) using "mingw64" headers, some constants that weren't actually error numbers have been exposed by Errno. This has been fixed [perl #77416].
Exporter no longer overrides $SIG{__WARN__} [perl #74472]
The AUTOLOAD helper code generated by "ExtUtils::Constant::ProxySubs" can now croak() for missing constants, or generate a complete "AUTOLOAD" subroutine in XS, allowing simplification of many modules that use it (Fcntl, File::Glob, GDBM_File, I18N::Langinfo, POSIX, Socket).
ExtUtils::Constant::ProxySubs can now optionally push the names of all constants onto the package's @EXPORT_OK.
It allows patterns containing literal parentheses: they no longer need to be escaped. On Windows, it no longer adds an extra ./ to file names returned when the pattern is a relative glob with a drive specification, like C:*.pl [perl #71712].
HTTP::Lite is now supported for the "http" scheme.
The fetch(1) utility is supported on FreeBSD, NetBSD, and Dragonfly BSD for the "http" and "ftp" schemes.
It improves handling of backslashes on Windows, so that paths like C:\dir\/file are no longer generated [perl #71710].
Several portability fixes were made in File::Spec::VMS: a colon is now recognized as a delimiter in native filespecs; caret-escaped delimiters are recognized for better handling of extended filespecs; catpath() returns an empty directory rather than the current directory if the input directory name is empty; and abs2rel() properly handles Unix-style input (5.12.2).
The "-x" and "-X" file test operators now work correctly when run by the superuser.
This fixes a memory leak when DBM filters are used.
Hash::Util no longer emits spurious "uninitialized" warnings when recursively locking hashes that have undefined values [perl #74280].
langinfo() now defaults to using $_ if there is no argument given, just as the documentation has always claimed.
This version of IO includes a new IO::Select, which now allows IO::Handle objects (and objects in derived classes) to be removed from an IO::Select set even if the underlying file descriptor is closed or invalid.
Resolves an issue with splitting Win32 command lines. An argument consisting of the single character "0" used to be omitted (CPAN RT #62961).
open3() now produces an error if the "exec" call fails, allowing this condition to be distinguished from a child process that exited with a non-zero status [perl #72016].
The internal xclose() routine now knows how to handle file descriptors as documented, so duplicating "STDIN" in a child process using its file descriptor now works [perl #76474].
Locale::Maketext now supports external caches.
This upgrade also fixes an infinite loop in "Locale::Maketext::Guts::_compile()" when working with tainted values (CPAN RT #40727).
"->maketext" calls now back up and restore $@ so error messages are not suppressed (CPAN RT #34182).
This fixes, among other things, incorrect results when computing binomial coefficients [perl #77640].
It also prevents "sqrt($int)" from crashing under "use bigrat". [perl #73534].
Includes new functions to calculate the length of encoded and decoded base64 strings.
Now provides encode_base64url() and decode_base64url() functions to process the base64 scheme for "URL applications".
A notable change is the deprecation of several modules. Module::Build::Version has been deprecated and Module::Build now relies on the version pragma directly. Module::Build::ModuleInfo has been deprecated in favor of a standalone copy called Module::Metadata. Module::Build::YAML has been deprecated in favor of CPAN::Meta::YAML.
Module::Build now also generates META.json and MYMETA.json files in accordance with version 2 of the CPAN distribution metadata specification, CPAN::Meta::Spec. The older format META.yml and MYMETA.yml files are still generated.
Besides listing the updated core modules of this release, it also stops listing the "Filespec" module. That module never existed in core. The scripts generating Module::CoreList confused it with VMS::Filespec, which actually is a core module as of Perl 5.8.7.
This fixes a memory leak when DBM filters are used.
This fixes a memory leak when DBM filters are used.
"overload::Method" can now handle subroutines that are themselves blessed into overloaded classes [perl #71998].
The documentation has greatly improved. See "Documentation" below.
The latest Parse::CPAN::Meta can now read YAML and JSON files using CPAN::Meta::YAML and JSON::PP, which are now part of the Perl core.
A read() after a seek() beyond the end of the string no longer thinks it has data to read [perl #78716].
It now includes constants for POSIX signal constants.
The "use re '/flags'" subpragma is new.
The regmust() function used to crash when called on a regular expression belonging to a pluggable engine. Now it croaks instead.
regmust() no longer leaks memory.
Coderefs returned by reval() and rdo() are now wrapped via wrap_code_refs() (5.12.1).
This fixes a possible infinite loop when looking for coderefs.
It adds several "version::vxs::*" routines to the default share.
It now works in taint mode [perl #72062].
It no longer tries to modify read-only arguments when generating a backtrace [perl #72340].
See "Improved IPv6 support" above.
Includes performance improvement for overloaded classes.
This adds support for serialising code references that contain UTF-8 strings correctly. The Storable minor version number changed as a result, meaning that Storable users who set $Storable::accept_future_minor to a "FALSE" value will see errors (see "FORWARD COMPATIBILITY" in Storable for more details).
Freezing no longer gets confused if the Perl stack gets reallocated during freezing [perl #80074].
Among many other things, subtests without a "plan" or "no_plan" now have an implicit done_testing() added to them.
It provides two new methods that give more control over the decrementing of semaphores: "down_nb" and "down_force".
Calling "Tie::Hash->TIEHASH()" used to loop forever. Now it "croak"s.
Unicode::Collate has been updated to use Unicode 6.0.0.
Unicode::Collate::Locale now supports a plethora of new locales: ar, be, bg, de__phonebook, hu, hy, kk, mk, nso, om, tn, vi, hr, ig, ja, ko, ru, sq, se, sr, to, uk, zh, zh__big5han, zh__gb2312han, zh__pinyin, and zh__stroke.
The following modules have been added:
Unicode::Collate::CJK::Big5 for "zh__big5han" which makes tailoring of CJK Unified Ideographs in the order of CLDR's big5han ordering.
Unicode::Collate::CJK::GB2312 for "zh__gb2312han" which makes tailoring of CJK Unified Ideographs in the order of CLDR's gb2312han ordering.
Unicode::Collate::CJK::JISX0208 which makes tailoring of 6355 kanji (CJK Unified Ideographs) in the JIS X 0208 order.
Unicode::Collate::CJK::Korean which makes tailoring of CJK Unified Ideographs in the order of CLDR's Korean ordering.
Unicode::Collate::CJK::Pinyin for "zh__pinyin" which makes tailoring of CJK Unified Ideographs in the order of CLDR's pinyin ordering.
Unicode::Collate::CJK::Stroke for "zh__stroke" which makes tailoring of CJK Unified Ideographs in the order of CLDR's stroke ordering.
This also sees the switch from using the pure-Perl version of this module to the XS version.
A new function, Unicode::UCD::num(), has been added. This function returns the numeric value of the string passed it or "undef" if the string in its entirety has no "safe" numeric value. (For more detail, and for the definition of "safe", see "num()" in Unicode::UCD.)
This upgrade also includes several bug fixes:
Because of a bug, now fixed, the is_strict() and is_lax() functions did not work when exported (5.12.1).
Calling "use warnings" without arguments is now significantly more efficient.
It is now possible to register warning categories other than the names of packages using warnings::register. See perllexwarn(1) for more information.
Two bugs have been fixed [perl #84086]:
The symbol table name was lost when tying a hash, due to a thinko in "TIEHASH". The result was that all tied hashes interacted with the local symbol table.
Unless a symbol table name had been explicitly specified in the call to the constructor, querying the special key ":LOCAL" failed to identify objects connected to the local symbol table.
This release has several new functions: Win32::GetSystemMetrics(), Win32::GetProductInfo(), Win32::GetOSDisplayName().
The names returned by Win32::GetOSName() and Win32::GetOSDisplayName() have been corrected.
As promised in Perl 5.12.0's release notes, the following modules have been removed from the core distribution, and if needed should be installed from CPAN instead.
The removal of Shell has been deferred until after 5.14, as the implementation of Shell shipped with 5.12.0 did not correctly issue the warning that it was to be removed from core.
perlgpl
perlgpl has been updated to contain GPL version 1, as is included in the README distributed with Perl (5.12.1).
Perl 5.12.x delta files
The perldelta files for Perl 5.12.1 to 5.12.3 have been added from the maintenance branch: perl5121delta, perl5122delta, perl5123delta.
perlpodstyle
New style guide for POD documentation, split mostly from the NOTES section of the pod2man(1) manpage.
perlsource, perlinterp, perlhacktut, and perlhacktips
See "perlhack and perlrepository revamp", below.
perlmodlib is now complete
The perlmodlib manpage that came with Perl 5.12.0 was missing several modules due to a bug in the script that generates the list. This has been fixed [perl #74332] (5.12.1).
Replace incorrect tr/// table in perlebcdic
perlebcdic contains a helpful table to use in "tr///" to convert between EBCDIC and Latin1/ASCII. The table was the inverse of the one it describes, though the code that used the table worked correctly for the specific example given.
The table has been corrected and the sample code changed to correspond.
The table has also been changed to hex from octal, and the recipes in the pod have been altered to print out leading zeros to make all values the same length.
Tricks for user-defined casing
perlunicode now contains an explanation of how to override, mangle and otherwise tweak the way Perl handles upper-, lower- and other-case conversions on Unicode data, and how to provide scoped changes to alter one's own code's behaviour without stomping on anybody else's.
INSTALL explicitly states that Perl requires a C89 compiler
This was already true, but it's now Officially Stated For The Record (5.12.2).
Explanation of "\xHH" and "\oOOO" escapes
perlop has been updated with more detailed explanation of these two character escapes.
-0NNN switch
In perlrun, the behaviour of the -0NNN switch for -0400 or higher has been clarified (5.12.2).
Maintenance policy
perlpolicy now contains the policy on what patches are acceptable for maintenance branches (5.12.1).
Deprecation policy
perlpolicy now contains the policy on compatibility and deprecation along with definitions of terms like "deprecation" (5.12.2).
New descriptions in perldiag
The following existing diagnostics are now documented:
perlbook
perlbook has been expanded to cover many more popular books.
"SvTRUE" macro
The documentation for the "SvTRUE" macro in perlapi was simply wrong in stating that get-magic is not processed. It has been corrected.
op manipulation functions
Several API functions that process optrees have been newly documented.
perlvar revamp
perlvar reorders the variables and groups them by topic. Each variable introduced after Perl 5.000 notes the first version in which it is available. perlvar also has a new section for deprecated variables to note when they were removed.
Array and hash slices in scalar context
These are now documented in perldata.
"use locale" and formats
perlform and perllocale have been corrected to state that "use locale" affects formats.
overload
overload's documentation has practically undergone a rewrite. It is now much more straightforward and clear.
perlhack and perlrepository revamp
The perlhack document is now much shorter, and focuses on the Perl 5 development process and submitting patches to Perl. The technical content has been moved to several new documents, perlsource, perlinterp, perlhacktut, and perlhacktips. This technical content has been only lightly edited.
The perlrepository document has been renamed to perlgit. This new document is just a how-to on using git with the Perl source code. Any other content that used to be in perlrepository has been moved to perlhack.
Time::Piece examples
Examples in perlfaq4 have been updated to show the use of Time::Piece.
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
New Warnings
perlbug(1)
Many systems these days don't have a valid Internet domain name, and perlbug@perl.org does not accept email with a return-path that does not resolve. So the user's address is now passed to sendmail so it's less likely to get stuck in a mail queue somewhere [perl #82996].
perl5db.pl
ptargrep
See also "Naming fixes in Policy_sh.SH may invalidate Policy.sh", above.
This means the "incpath", "libpth", "ldflags", "lddlflags" and "ldflags_nolargefiles" values in Config.pm and Config_heavy.pl are now set correctly.
./Configure -Accflags=-DPERLIOBUF_DEFAULT_BUFSIZ=N
where N is the desired size in bytes; it should probably be a multiple of your page size.
AIX
ARM
Cygwin
If a DLL is updated on cygwin the old imagebase address is reused. This solves most rebase errors, especially when updating on core DLL's. See <http://www.tishler.net/jason/software/rebase/rebase-2.4.2.README> for more information.
FreeBSD 7
HP-UX
IRIX
Mac OS X
These functions are now recognised on Mac OS 10.5 (Leopard; Darwin 9) and higher, as they have been fixed [perl #72990].
MirBSD
NetBSD
OpenBSD
OpenVOS
Solaris
VMS
When "perlio" became the default and "unix" became the default bottom layer, the most common path for creating files from Perl became "PerlIOUnix_open", which has always explicitly used 0666 as the permission mask. This prevents inheriting permissions from RMS defaults and ACLs, so to avoid that problem, we now pass 0777 to open(). In the VMS CRTL, 0777 has a special meaning over and above intersecting with the current umask; specifically, it allows Unix syscalls to preserve native default permissions (5.12.3).
Windows
See also "fork() emulation will not wait for signalled children" and "Perl source code is read in text mode on Windows", above.
CLONE_PARAMS structure added to ease correct thread creation
Modules that create threads should now create "CLONE_PARAMS" structures by calling the new function Perl_clone_params_new(), and free them with Perl_clone_params_del(). This will ensure compatibility with any future changes to the internals of the "CLONE_PARAMS" structure layout, and that it is correctly allocated and initialised.
New parsing functions
Several functions have been added for parsing Perl statements and expressions. These functions are meant to be used by XS code invoked during Perl parsing, in a recursive-descent manner, to allow modules to augment the standard Perl syntax.
Hints hash API
A new C API for introspecting the hinthash "%^H" at runtime has been added. See "cop_hints_2hv", "cop_hints_fetchpvn", "cop_hints_fetchpvs", "cop_hints_fetchsv", and "hv_copy_hints_hv" in perlapi for details.
A new, experimental API has been added for accessing the internal structure that Perl uses for "%^H". See the functions beginning with "cophh_" in perlapi.
C interface to caller()
The "caller_cx" function has been added as an XSUB-writer's equivalent of caller(). See perlapi for details.
Custom per-subroutine check hooks
XS code in an extension module can now annotate a subroutine (whether implemented in XS or in Perl) so that nominated XS code will be called at compile time (specifically as part of op checking) to change the op tree of that subroutine. The compile-time check function (supplied by the extension module) can implement argument processing that can't be expressed as a prototype, generate customised compile-time warnings, perform constant folding for a pure function, inline a subroutine consisting of sufficiently simple ops, replace the whole call with a custom op, and so on. This was previously all possible by hooking the "entersub" op checker, but the new mechanism makes it easy to tie the hook to a specific subroutine. See "cv_set_call_checker" in perlapi.
To help in writing custom check hooks, several subtasks within standard "entersub" op checking have been separated out and exposed in the API.
Improved support for custom OPs
Custom ops can now be registered with the new "custom_op_register" C function and the "XOP" structure. This will make it easier to add new properties of custom ops in the future. Two new properties have been added already, "xop_class" and "xop_peep".
"xop_class" is one of the OA_*OP constants. It allows B and other introspection mechanisms to work with custom ops that aren't BASEOPs. "xop_peep" is a pointer to a function that will be called for ops of this type from "Perl_rpeep".
See "Custom Operators" in perlguts and "Custom Operators" in perlapi for more detail.
The old "PL_custom_op_names"/"PL_custom_op_descs" interface is still supported but discouraged.
Scope hooks
It is now possible for XS code to hook into Perl's lexical scope mechanism at compile time, using the new "Perl_blockhook_register" function. See "Compile-time scope hooks" in perlguts.
The recursive part of the peephole optimizer is now hookable
In addition to "PL_peepp", for hooking into the toplevel peephole optimizer, a "PL_rpeepp" is now available to hook into the optimizer recursing into side-chains of the optree.
New non-magical variants of existing functions
The following functions/macros have been added to the API. The *_nomg macros are equivalent to their non-"_nomg" variants, except that they ignore get-magic. Those ending in "_flags" allow one to specify whether get-magic is processed.
sv_2bool_flags SvTRUE_nomg sv_2nv_flags SvNV_nomg sv_cmp_flags sv_cmp_locale_flags sv_eq_flags sv_collxfrm_flags
In some of these cases, the non-"_flags" functions have been replaced with wrappers around the new functions.
pv/pvs/sv versions of existing functions
Many functions ending with pvn now have equivalent "pv/pvs/sv" versions.
List op-building functions
List op-building functions have been added to the API. See op_append_elem, op_append_list, and op_prepend_elem in perlapi.
"LINKLIST"
The LINKLIST macro, part of op building that constructs the execution-order op chain, has been added to the API.
Localisation functions
The "save_freeop", "save_op", "save_pushi32ptr" and "save_pushptrptr" functions have been added to the API.
Stash names
A stash can now have a list of effective names in addition to its usual name. The first effective name can be accessed via the "HvENAME" macro, which is now the recommended name to use in MRO linearisations ("HvNAME" being a fallback if there is no "HvENAME").
These names are added and deleted via "hv_ename_add" and "hv_ename_delete". These two functions are not part of the API.
New functions for finding and removing magic
The "mg_findext()" and "sv_unmagicext()" functions have been added to the API. They allow extension authors to find and remove magic attached to scalars based on both the magic type and the magic virtual table, similar to how sv_magicext() attaches magic of a certain type and with a given virtual table to a scalar. This eliminates the need for extensions to walk the list of "MAGIC" pointers of an "SV" to find the magic that belongs to them.
"find_rundefsv"
This function returns the SV representing $_, whether it's lexical or dynamic.
"Perl_croak_no_modify"
Perl_croak_no_modify() is short-hand for "Perl_croak("%s", PL_no_modify)".
"PERL_STATIC_INLINE" define
The "PERL_STATIC_INLINE" define has been added to provide the best-guess incantation to use for static inline functions, if the C compiler supports C99-style static inline. If it doesn't, it'll give a plain "static".
"HAS_STATIC_INLINE" can be used to check if the compiler actually supports inline functions.
New "pv_escape" option for hexadecimal escapes
A new option, "PERL_PV_ESCAPE_NONASCII", has been added to "pv_escape" to dump all characters above ASCII in hexadecimal. Before, one could get all characters as hexadecimal or the Latin1 non-ASCII as octal.
"lex_start"
"lex_start" has been added to the API, but is considered experimental.
op_scope() and op_lvalue()
The op_scope() and op_lvalue() functions have been added to the API, but are considered experimental.
"PERL_POLLUTE" has been removed
The option to define "PERL_POLLUTE" to expose older 5.005 symbols for backwards compatibility has been removed. Its use was always discouraged, and MakeMaker contains a more specific escape hatch:
perl Makefile.PL POLLUTE=1
This can be used for modules that have not been upgraded to 5.6 naming conventions (and really should be completely obsolete by now).
Check API compatibility when loading XS modules
When Perl's API changes in incompatible ways (which usually happens between major releases), XS modules compiled for previous versions of Perl will no longer work. They need to be recompiled against the new Perl.
The "XS_APIVERSION_BOOTCHECK" macro has been added to ensure that modules are recompiled and to prevent users from accidentally loading modules compiled for old perls into newer perls. That macro, which is called when loading every newly compiled extension, compares the API version of the running perl with the version a module has been compiled for and raises an exception if they don't match.
Perl_fetch_cop_label
The first argument of the C API function "Perl_fetch_cop_label" has changed from "struct refcounted_he *" to "COP *", to insulate the user from implementation details.
This API function was marked as "may change", and likely isn't in use outside the core. (Neither an unpacked CPAN nor Google's codesearch finds any other references to it.)
GvCV() and GvGP() are no longer lvalues
The new GvCV_set() and GvGP_set() macros are now provided to replace assignment to those two macros.
This allows a future commit to eliminate some backref magic between GV and CVs, which will require complete control over assignment to the "gp_cv" slot.
CvGV() is no longer an lvalue
Under some circumstances, the CvGV() field of a CV is now reference-counted. To ensure consistent behaviour, direct assignment to it, for example "CvGV(cv) = gv" is now a compile-time error. A new macro, "CvGV_set(cv,gv)" has been introduced to run this operation safely. Note that modification of this field is not part of the public API, regardless of this new macro (and despite its being listed in this section).
CvSTASH() is no longer an lvalue
The CvSTASH() macro can now only be used as an rvalue. CvSTASH_set() has been added to replace assignment to CvSTASH(). This is to ensure that backreferences are handled properly. These macros are not part of the API.
Calling conventions for "newFOROP" and "newWHILEOP"
The way the parser handles labels has been cleaned up and refactored. As a result, the newFOROP() constructor function no longer takes a parameter stating what label is to go in the state op.
The newWHILEOP() and newFOROP() functions no longer accept a line number as a parameter.
Flags passed to "uvuni_to_utf8_flags" and "utf8n_to_uvuni"
Some of the flags parameters to uvuni_to_utf8_flags() and utf8n_to_uvuni() have changed. This is a result of Perl's now allowing internal storage and manipulation of code points that are problematic in some situations. Hence, the default actions for these functions has been complemented to allow these code points. The new flags are documented in perlapi. Code that requires the problematic code points to be rejected needs to change to use the new flags. Some flag names are retained for backward source compatibility, though they do nothing, as they are now the default. However the flags "UNICODE_ALLOW_FDD0", "UNICODE_ALLOW_FFFF", "UNICODE_ILLEGAL", and "UNICODE_IS_ILLEGAL" have been removed, as they stem from a fundamentally broken model of how the Unicode non-character code points should be handled, which is now described in "Non-character code points" in perlunicode. See also the Unicode section under "Selected Bug Fixes".
It attempted to provide an API to compile code down to an optree, but failed to bind correctly to lexicals in the enclosing scope. It's not possible to fix this problem within the constraints of its parameters and return value.
Use the new "find_rundefsv" function or the "UNDERBAR" macro instead. They directly return the right SV representing $_, whether it's lexical or dynamic.
For compatibility, they are still defined for external "XS" code. Only extensions defining "PERL_CORE" must be updated now.
Stack unwinding
The protocol for unwinding the C stack at the last stage of a "die" has changed how it identifies the target stack frame. This now uses a separate variable "PL_restartjmpenv", where previously it relied on the "blk_eval.cur_top_env" pointer in the "eval" context frame that has nominally just been discarded. This change means that code running during various stages of Perl-level unwinding no longer needs to take care to avoid destroying the ghost frame.
Scope stack entries
The format of entries on the scope stack has been changed, resulting in a reduction of memory usage of about 10%. In particular, the memory used by the scope stack to record each active lexical variable has been halved.
Memory allocation for pointer tables
Memory allocation for pointer tables has been changed. Previously "Perl_ptr_table_store" allocated memory from the same arena system as "SV" bodies and "HE"s, with freed memory remaining bound to those arenas until interpreter exit. Now it allocates memory from arenas private to the specific pointer table, and that memory is returned to the system when "Perl_ptr_table_free" is called. Additionally, allocation and release are both less CPU intensive.
"UNDERBAR"
The "UNDERBAR" macro now calls "find_rundefsv". "dUNDERBAR" is now a noop but should still be used to ensure past and future compatibility.
String comparison routines renamed
The "ibcmp_*" functions have been renamed and are now called "foldEQ", "foldEQ_locale", and "foldEQ_utf8". The old names are still available as macros.
"chop" and "chomp" implementations merged
The opcode bodies for "chop" and "chomp" and for "schop" and "schomp" have been merged. The implementation functions Perl_do_chop() and Perl_do_chomp(), never part of the public API, have been merged and moved to a static function in pp.c. This shrinks the Perl binary slightly, and should not affect any code outside the core (unless it is relying on the order of side-effects when "chomp" is passed a list of values).
$ perl -we 'open(my $f, ">", \my $x); binmode($f, "scalar")' Use of uninitialized value in binmode at -e line 1.
When "binmode(FH, ":crlf")" pushes the ":crlf" layer on top of the stack, it no longer enables crlf layers lower in the stack so as to avoid unexpected results [perl #38456].
Opening a file in ":raw" mode now does what it advertises to do (first open the file, then "binmode" it), instead of simply leaving off the top layer [perl #80764].
The three layers ":pop", ":utf8", and ":bytes" didn't allow stacking when opening a file. For example this:
open(FH, ">:pop:perlio", "some.file") or die $!;
would throw an "Invalid argument" error. This has been fixed in this release [perl #82484].
$text =~ ( 1 ? /phoo/ : /bear/)
to turn into
$text =~ /phoo/
at compile time. Now it correctly matches against $_ [perl #20444].
*d = *a; print $d[0]; undef *d; print $d[0];
Perl 5.10.0 introduced a new internal mechanism for caching MROs (method resolution orders, or lists of parent classes; aka "isa" caches) to make method lookup faster (so @ISA arrays would not have to be searched repeatedly). Unfortunately, this brought with it quite a few bugs. Almost all of these have been fixed now, along with a few MRO-related bugs that existed before 5.10.0:
"undef *Foo::ISA" would even stop a new @Foo::ISA array from updating caches.
In addition, various other bugs related to typeglobs and stashes have been fixed:
for $x (...) { *x = *y; }
sub { $_[0] = *foo }->($hash{key}); # $_[0] would have been the string "*main::foo"
It also happened when a glob was assigned to, or returned from, an element of a tied array or hash [perl #36051].
local *@; eval { die bless [] }; # puts an object in $@ sub DESTROY { local $@; # boom }
Now the glob entries are cleared before any destructors are called. This also means that destructors can vivify entries in the glob. So Perl tries again and, if the entries are re-created too many times, dies with a "panic: gp_free ..." error message.
There are two known exceptions:
"\N{LATIN SMALL LIGATURE FFI}" =~ /ffi/ui
and
"ffi" =~ /\N{LATIN SMALL LIGATURE FFI}/ui
are both true. Previously, there were many bugs with this feature. What hasn't been fixed are the places where the pattern contains the multiple characters, but the characters are split up by other things, such as in
"\N{LATIN SMALL LIGATURE FFI}" =~ /(f)(f)i/ui
or
"\N{LATIN SMALL LIGATURE FFI}" =~ /ffi*/ui
or
"\N{LATIN SMALL LIGATURE FFI}" =~ /[a-f][f-m][g-z]/ui
None of these match.
Also, this matching doesn't fully conform to the current Unicode Standard, which asks that the matching be made upon the NFD (Normalization Form Decomposed) of the text. However, as of this writing (April 2010), the Unicode Standard is currently in flux about what they will recommend doing with regard in such scenarios. It may be that they will throw out the whole concept of multi-character matches. [perl #71736].
Because "<> as glob" was parsed differently from "<> as filehandle" from 5.6 onwards, something like "<$foo[0]>" did not handle overloading, even if $foo[0] was an overloaded object. This was contrary to the documentation for overload, and meant that "<>" could not be used as a general overloaded iterator operator.
Now directory handles are cloned properly on Windows and on systems that have a "fchdir" function. On other systems, new threads simply do not inherit directory handles from their parent threads [perl #75154].
@a = %h = (list with some duplicate keys);
This has now been fixed [perl #31865].
Perl now frees only the affected slots of the GV, rather than freeing the GV itself. This makes sure that there are no dangling refs or corrupted state during destruction.
push @a, "foo", $b = bar->import;
would assign "foo" to $b [perl #63790].
This is a list of significant unresolved issues which are regressions from earlier versions of Perl or which affect widely-used CPAN modules.
A similar issue may occur in other modules that provide functions which take a block as their first argument, like
foo { ... $_ ...} list
See also: <https://github.com/Perl/perl5/issues/9798>
You can now use the keys(), values(), and each() builtins on arrays; previously you could use them only on hashes. See perlfunc for details. This is actually a change introduced in perl 5.12.0, but it was missed from that release's perl5120delta.
split() no longer modifies @_ when called in scalar or void context. In void context it now produces a "Useless use of split" warning. This was also a perl 5.12.0 change that missed the perldelta.
Randy Kobes, creator of http://kobesearch.cpan.org/ and contributor/maintainer to several core Perl toolchain modules, passed away on September 18, 2010 after a battle with lung cancer. The community was richer for his involvement. He will be missed.
Perl 5.14.0 represents one year of development since Perl 5.12.0 and contains nearly 550,000 lines of changes across nearly 3,000 files from 150 authors and committers.
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.14.0:
Aaron Crane, Abhijit Menon-Sen, Abigail, AEvar Arnfjoerd` Bjarmason, Alastair Douglas, Alexander Alekseev, Alexander Hartmaier, Alexandr Ciornii, Alex Davies, Alex Vandiver, Ali Polatel, Allen Smith, Andreas Koenig, Andrew Rodland, Andy Armstrong, Andy Dougherty, Aristotle Pagaltzis, Arkturuz, Arvan, A. Sinan Unur, Ben Morrow, Bo Lindbergh, Boris Ratner, Brad Gilbert, Bram, brian d foy, Brian Phillips, Casey West, Charles Bailey, Chas. Owens, Chip Salzenberg, Chris 'BinGOs' Williams, chromatic, Craig A. Berry, Curtis Jewell, Dagfinn Ilmari Mannsaaker, Dan Dascalescu, Dave Rolsky, David Caldwell, David Cantrell, David Golden, David Leadbeater, David Mitchell, David Wheeler, Eric Brine, Father Chrysostomos, Fingle Nark, Florian Ragwitz, Frank Wiegand, Franz Fasching, Gene Sullivan, George Greer, Gerard Goossen, Gisle Aas, Goro Fuji, Grant McLean, gregor herrmann, H.Merijn Brand, Hongwen Qiu, Hugo van der Sanden, Ian Goodacre, James E Keenan, James Mastros, Jan Dubois, Jay Hannah, Jerry D. Hedden, Jesse Vincent, Jim Cromie, Jirka HruXka, John Peacock, Joshua ben Jore, Joshua Pritikin, Karl Williamson, Kevin Ryde, kmx, Lars DXXXXXX XXX, Larwan Berke, Leon Brocard, Leon Timmermans, Lubomir Rintel, Lukas Mai, Maik Hentsche, Marty Pauley, Marvin Humphrey, Matt Johnson, Matt S Trout, Max Maischein, Michael Breen, Michael Fig, Michael G Schwern, Michael Parker, Michael Stevens, Michael Witten, Mike Kelly, Moritz Lenz, Nicholas Clark, Nick Cleaton, Nick Johnston, Nicolas Kaiser, Niko Tyni, Noirin Shirley, Nuno Carvalho, Paul Evans, Paul Green, Paul Johnson, Paul Marquess, Peter J. Holzer, Peter John Acklam, Peter Martini, Philippe Bruhat (BooK), Piotr Fusik, Rafael Garcia-Suarez, Rainer Tammer, Reini Urban, Renee Baecker, Ricardo Signes, Richard Moehn, Richard Soderberg, Rob Hoelz, Robin Barker, Ruslan Zakirov, Salvador Fandin~o, Salvador Ortiz Garcia, Shlomi Fish, Sinan Unur, Sisyphus, Slaven Rezic, Steffen Mueller, Steve Hay, Steven Schubiger, Steve Peters, Sullivan Beck, Tatsuhiko Miyagawa, Tim Bunce, Todd Rinaldo, Tom Christiansen, Tom Hukins, Tony Cook, Tye McQueen, Vadim Konovalov, Vernon Lyon, Vincent Pit, Walt Mankowski, Wolfram Humann, Yves Orton, Zefram, and Zsban Ambrus.
This is woefully incomplete as it's automatically generated from version control history. In particular, it doesn't include the names of the (very much appreciated) contributors who reported issues in previous versions of Perl that helped make Perl 5.14.0 better. For a more complete list of all of Perl's historical contributors, please see the "AUTHORS" file in the Perl 5.14.0 distribution.
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.
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 http://rt.perl.org/perlbug/ . 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 are 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 use this address for security issues in the Perl core only, 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.
2022-02-19 | perl v5.34.1 |