5 perl5160delta - what is new for perl v5.16.0
9 This document describes differences between the 5.14.0 release and
12 If you are upgrading from an earlier release such as 5.12.0, first read
13 L<perl5140delta>, which describes differences between 5.12.0 and
18 As described in L<perlpolicy>, the release of Perl 5.16.0 marks the
19 official end of support for Perl 5.12. Users of Perl 5.12 or earlier
20 should consider upgrading to a more recent release of Perl.
22 =head1 Core Enhancements
24 =head2 C<use I<VERSION>>
26 As of this release, version declarations like C<use v5.16> now disable
27 all features before enabling the new feature bundle. This means that
28 the following holds true:
31 # only 5.16 features enabled here
33 # only 5.14 features enabled here (not 5.16)
35 C<use v5.12> and higher continue to enable strict, but explicit C<use
36 strict> and C<no strict> now override the version declaration, even
43 There is a new ":default" feature bundle that represents the set of
44 features enabled before any version declaration or C<use feature> has
45 been seen. Version declarations below 5.10 now enable the ":default"
46 feature set. This does not actually change the behaviour of C<use
47 v5.8>, because features added to the ":default" set are those that were
48 traditionally enabled by default, before they could be turned off.
50 C<< no feature >> now resets to the default feature set. To disable all
51 features (which is likely to be a pretty special-purpose request, since
52 it presumably won't match any named set of semantics) you can now
53 write C<< no feature ':all' >>.
55 C<$[> is now disabled under C<use v5.16>. It is part of the default
56 feature set and can be turned on or off explicitly with C<use feature
61 The new C<__SUB__> token, available under the C<current_sub> feature
62 (see L<feature>) or C<use v5.16>, returns a reference to the current
63 subroutine, making it easier to write recursive closures.
65 =head2 New and Improved Built-ins
67 =head3 More consistent C<eval>
69 The C<eval> operator sometimes treats a string argument as a sequence of
70 characters and sometimes as a sequence of bytes, depending on the
71 internal encoding. The internal encoding is not supposed to make any
72 difference, but there is code that relies on this inconsistency.
74 The new C<unicode_eval> and C<evalbytes> features (enabled under C<use
75 5.16.0>) resolve this. The C<unicode_eval> feature causes C<eval
76 $string> to treat the string always as Unicode. The C<evalbytes>
77 features provides a function, itself called C<evalbytes>, which
78 evaluates its argument always as a string of bytes.
80 These features also fix oddities with source filters leaking to outer
83 See L<feature> for more detail.
85 =head3 C<substr> lvalue revamp
87 =for comment Does this belong here, or under Incomptable Changes?
89 When C<substr> is called in lvalue or potential lvalue context with two
90 or three arguments, a special lvalue scalar is returned that modifies
91 the original string (the first argument) when assigned to.
93 Previously, the offsets (the second and third arguments) passed to
94 C<substr> would be converted immediately to match the string, negative
95 offsets being translated to positive and offsets beyond the end of the
96 string being truncated.
98 Now, the offsets are recorded without modification in the special
99 lvalue scalar that is returned, and the original string is not even
100 looked at by C<substr> itself, but only when the returned lvalue is
103 These changes result in an incompatible change:
105 If the original string changes length after the call to C<substr> but
106 before assignment to its return value, negative offsets will remember
107 their position from the end of the string, affecting code like this:
109 my $string = "string";
110 my $lvalue = \substr $string, -4, 2;
111 print $lvalue, "\n"; # prints "ri"
112 $string = "bailing twine";
113 print $lvalue, "\n"; # prints "wi"; used to print "il"
115 The same thing happens with an omitted third argument. The returned
116 lvalue will always extend to the end of the string, even if the string
119 Since this change also allowed many bugs to be fixed (see
120 L</Fixes to the C<substr> operator>), and since the behaviour
121 of negative offsets has never been specified, so the
122 change was deemed acceptable.
124 =head3 Return value of C<tied>
126 The value returned by C<tied> on a tied variable is now the actual
127 scalar that holds the object to which the variable is tied. This
128 allows ties to be weakened with C<Scalar::Util::weaken(tied
131 =head2 Unicode Support
133 =head3 Supports (I<almost>) Unicode 6.1
135 Besides the addition of whole new scripts, and new characters in
136 existing scripts, this new version of Unicode, as always, makes some
137 changes to existing characters. One change that may trip up some
138 applications is that the General Category of two characters in the
139 Latin-1 range, PILCROW SIGN and SECTION SIGN, has been changed from
140 Other_Symbol to Other_Punctuation. The same change has been made for
141 a character in each of Tibetan, Ethiopic, and Aegean.
142 The code points U+3248..U+324F (CIRCLED NUMBER TEN ON BLACK SQUARE
143 through CIRCLED NUMBER EIGHTY ON BLACK SQUARE) have had their General
144 Category changed from Other_Symbol to Other_Numeric. The Line Break
145 property has changes for Hebrew and Japanese; and as a consequence of
146 other changes in 6.1, the Perl regular expression construct C<\X> now
147 works differently for some characters in Thai and Lao.
149 New aliases (synonyms) have been defined for many property values;
150 these, along with the previously existing ones, are all cross-indexed in
153 The return value of C<charnames::viacode()> is affected by other
156 Code point Old Name New Name
157 U+000A LINE FEED (LF) LINE FEED
158 U+000C FORM FEED (FF) FORM FEED
159 U+000D CARRIAGE RETURN (CR) CARRIAGE RETURN
160 U+0085 NEXT LINE (NEL) NEXT LINE
161 U+008E SINGLE-SHIFT 2 SINGLE-SHIFT-2
162 U+008F SINGLE-SHIFT 3 SINGLE-SHIFT-3
163 U+0091 PRIVATE USE 1 PRIVATE USE-1
164 U+0092 PRIVATE USE 2 PRIVATE USE-2
165 U+2118 SCRIPT CAPITAL P WEIERSTRASS ELLIPTIC FUNCTION
167 Perl will accept any of these names as input, but
168 C<charnames::viacode()> now returns the new name of each pair. The
169 change for U+2118 is considered by Unicode to be a correction, that is
170 the original name was a mistake (but again, it will remain forever valid
171 to use it to refer to U+2118). But most of these changes are the
172 fallout of the mistake Unicode 6.0 made in naming a character used in
173 Japanese cell phones to be "BELL", which conflicts with the longstanding
174 industry use of (and Unicode's recommendation to use) that name
175 to mean the ASCII control character at U+0007. As a result, that name
176 has been deprecated in Perl since v5.14; and any use of it will raise a
177 warning message (unless turned off). The name "ALERT" is now the
178 preferred name for this code point, with "BEL" being an acceptable short
179 form. The name for the new cell phone character, at code point U+1F514,
180 remains undefined in this version of Perl (hence we don't quite
181 implement all of Unicode 6.1), but starting in v5.18, BELL will mean
182 this character, and not U+0007.
184 Unicode has taken steps to make sure that this sort of mistake does not
185 happen again. The Standard now includes all the generally accepted
186 names and abbreviations for control characters, whereas previously it
187 didn't (though there were recommended names for most of them, which Perl
188 used). This means that most of those recommended names are now
189 officially in the Standard. Unicode did not recommend names for the
190 four code points listed above between U+008E and U+008F, and in
191 standardizing them Unicode subtly changed the names that Perl had
192 previously given them, by replacing the final blank in each name by a
193 hyphen. Unicode also officially accepts names that Perl had deprecated,
194 such as FILE SEPARATOR. Now the only deprecated name is BELL.
195 Finally, Perl now uses the new official names instead of the old
196 (now considered obsolete) names for the first four code points in the
197 list above (the ones which have the parentheses in them).
199 Now that the names have been placed in the Unicode standard, these kinds
200 of changes should not happen again, though corrections, such as to
201 U+2118, are still possible.
203 Unicode also added some name abbreviations, which Perl now accepts:
205 TAB for CHARACTER TABULATION;
206 NEW LINE, END OF LINE, NL, and EOL for LINE FEED;
207 LOCKING-SHIFT ONE for SHIFT OUT;
208 LOCKING-SHIFT ZERO for SHIFT IN;
209 and ZWNBSP for ZERO WIDTH NO-BREAK SPACE.
211 More details on this version of Unicode are provided in
212 L<http://www.unicode.org/versions/Unicode6.1.0/>.
214 =head3 C<use charnames> is no longer needed for C<\N{I<name>}>
216 When C<\N{I<name>}> is encountered, the C<charnames> module is now
217 automatically loaded when needed as if the C<:full> and C<:short>
218 options had been specified. See L<charnames> for more information.
220 =head3 C<\N{...}> can now have Unicode loose name matching
222 This is described in the C<charnames> item in
223 L</Updated Modules and Pragmata> below.
225 =head3 Unicode Symbol Names
227 Perl now has proper support for Unicode in symbol names. It used to be
228 that C<*{$foo}> would ignore the internal UTF8 flag and use the bytes of
229 the underlying representation to look up the symbol. That meant that
230 C<*{"\x{100}"}> and C<*{"\xc4\x80"}> would return the same thing. All
231 these parts of Perl have been fixed to account for Unicode:
237 Method names (including those passed to C<use overload>)
241 Typeglob names (including names of variables, subroutines and filehandles)
253 Symbolic dereferencing
257 Second argument to C<bless()> and C<tie()>
261 Return value of C<ref()>
265 Subroutine prototypes
273 Various warnings and error messages that mention variable names or values,
278 In addition, a parsing bug has been fixed that prevented C<*{é}> from
279 implicitly quoting the name, but instead interpreted it as C<*{+é}>, which
280 would cause a strict violation.
282 C<*{"*a::b"}> automatically strips off the * if it is followed by an ASCII
283 letter. That has been extended to all Unicode identifier characters.
285 One-character non-ASCII non-punctuation variables (like C<$é>) are now
286 subject to "Used only once" warnings. They used to be exempt, as they
287 was treated as punctuation variables.
289 Also, single-character Unicode punctuation variables (like $‰) are now
290 supported [perl #69032].
292 =head3 Improved ability to mix locales and Unicode, including UTF-8 locales
294 An optional parameter has been added to C<use locale>
296 use locale ':not_characters';
298 which tells Perl to use all but the C<LC_CTYPE> and C<LC_COLLATE>
299 portions of the current locale. Instead, the character set is assumed
300 to be Unicode. This allows locales and Unicode to be seamlessly mixed,
301 including the increasingly frequent UTF-8 locales. When using this
302 hybrid form of locales, the C<:locale> layer to the L<open> pragma can
303 be used to interface with the file system, and there are CPAN modules
304 available for ARGV and environment variable conversions.
306 Full details are in L<perllocale>.
308 =head3 New function C<fc> and corresponding escape sequence C<\F> for Unicode foldcase
310 Unicode foldcase is an extension to lowercase that gives better results
311 when comparing two strings case-insensitively. It has long been used
312 internally in regular expression C</i> matching. Now it is available
313 explicitly through the new C<fc> function call (enabled by
314 S<C<"use feature 'fc'">>, or C<use v5.16>, or explicitly callable via
315 C<CORE::fc>) or through the new C<\F> sequence in double-quotish
318 Full details are in L<perlfunc/fc>.
320 =head3 The Unicode C<Script_Extensions> property is now supported.
322 New in Unicode 6.0, this is an improved C<Script> property. Details
323 are in L<perlunicode/Scripts>.
327 =head3 Improved typemaps for Some Builtin Types
329 Most XS authors will be aware that there is a longstanding bug in the
330 OUTPUT typemap for T_AVREF (C<AV*>), T_HVREF (C<HV*>), T_CVREF (C<CV*>),
331 and T_SVREF (C<SVREF> or C<\$foo>) that requires manually decrementing
332 the reference count of the return value instead of the typemap taking
333 care of this. For backwards-compatibility, this cannot be changed in the
334 default typemaps. But we now provide additional typemaps
335 C<T_AVREF_REFCOUNT_FIXED>, etc. that do not exhibit this bug. Using
336 them in your extension is as simple as having one line in your
339 HV* T_HVREF_REFCOUNT_FIXED
341 =head3 C<is_utf8_char()>
343 The XS-callable function C<is_utf8_char()>, when presented with
344 malformed UTF-8 input, can read up to 12 bytes beyond the end of the
345 string. This cannot be fixed without changing its API. It is not
346 called from CPAN. The documentation now describes how to use it
349 =head3 Added C<is_utf8_char_buf()>
351 This function is designed to replace the deprecated L</is_utf8_char()>
352 function. It includes an extra parameter to make sure it doesn't read
353 past the end of the input buffer.
355 =head3 Other C<is_utf8_foo()> functions, as well as C<utf8_to_foo()>, etc.
357 Most of the other XS-callable functions that take UTF-8 encoded input
358 implicitly assume that the UTF-8 is valid (not malformed) in regards to
359 buffer length. Do not do things such as change a character's case or
360 see if it is alphanumeric without first being sure that it is valid
361 UTF-8. This can be safely done for a whole string by using one of the
362 functions C<is_utf8_string()>, C<is_utf8_string_loc()>, and
363 C<is_utf8_string_loclen()>.
367 Many new functions have been added to the API for manipulating lexical
368 pads. See L<perlapi/Pad Data Structures> for more information.
370 =head2 Changes to Special Variables
372 =head3 C<$$> can be assigned to
374 C<$$> was made read-only in Perl 5.8.0. But only sometimes: C<local $$>
375 would make it writable again. Some CPAN modules were using C<local $$> or
376 XS code to bypass the read-only check, so there is no reason to keep C<$$>
377 read-only. (This change also allowed a bug to be fixed while maintaining
378 backward compatibility.)
380 =head3 C<$^X> converted to an absolute path on FreeBSD, OS X and Solaris
382 C<$^X> is now converted to an absolute path on OS X, FreeBSD (without
383 needing F</proc> mounted) and Solaris 10 and 11. This augments the
384 previous approach of using F</proc> on Linux, FreeBSD and NetBSD
385 (in all cases, where mounted).
387 This makes relocatable perl installations more useful on these platforms.
388 (See "Relocatable @INC" in F<INSTALL>)
390 =head2 Debugger Changes
392 =head3 Features inside the debugger
394 The current Perl's L<feature> bundle is now enabled for commands entered
395 in the interactive debugger.
397 =head3 New option for the debugger's B<t> command
399 The B<t> command in the debugger, which toggles tracing mode, now
400 accepts a numeric argument that determines how many levels of subroutine
403 =head3 C<enable> and C<disable>
405 The debugger now has C<disable> and C<enable> commands for disabling
406 existing breakpoints and re-enabling them. See L<perldebug>.
408 =head3 Breakpoints with file names
410 The debugger's "b" command for setting breakpoints now allows a line
411 number to be prefixed with a file name. See
412 L<perldebug/"b [file]:[line] [condition]">.
414 =head2 The C<CORE> Namespace
416 =head3 The C<CORE::> prefix
418 The C<CORE::> prefix can now be used on keywords enabled by
419 L<feature.pm|feature>, even outside the scope of C<use feature>.
421 =head3 Subroutines in the C<CORE> namespace
423 Many Perl keywords are now available as subroutines in the CORE namespace.
424 This allows them to be aliased:
426 BEGIN { *entangle = \&CORE::tie }
427 entangle $variable, $package, @args;
429 And for prototypes to be bypassed:
431 sub mytie(\[%$*@]$@) {
432 my ($ref, $pack, @args) = @_;
437 Some of these cannot be called through references or via C<&foo> syntax,
438 but must be called as barewords.
440 See L<CORE> for details.
444 =head3 Anonymous handles
446 Automatically generated file handles are now named __ANONIO__ when the
447 variable name cannot be determined, rather than $__ANONIO__.
449 =head3 Autoloaded sort Subroutines
451 Custom sort subroutines can now be autoloaded [perl #30661]:
454 @sorted = sort foo @list; # uses AUTOLOAD
456 =head3 C<continue> no longer requires the "switch" feature
458 The C<continue> keyword has two meanings. It can introduce a C<continue>
459 block after a loop, or it can exit the current C<when> block. Up till now,
460 the latter meaning was only valid with the "switch" feature enabled, and
461 was a syntax error otherwise. Since the main purpose of feature.pm is to
462 avoid conflicts with user-defined subroutines, there is no reason for
463 C<continue> to depend on it.
465 =head3 DTrace probes for interpreter phase change
467 The C<phase-change> probes will fire when the interpreter's phase
468 changes, which tracks the C<${^GLOBAL_PHASE}> variable. C<arg0> is
469 the new phase name; C<arg1> is the old one. This is useful mostly
470 for limiting your instrumentation to one or more of: compile time,
471 run time, destruct time.
473 =head3 C<__FILE__()> Syntax
475 The C<__FILE__>, C<__LINE__> and C<__PACKAGE__> tokens can now be written
476 with an empty pair of parentheses after them. This makes them parse the
477 same way as C<time>, C<fork> and other built-in functions.
479 =head3 The C<\$> prototype accepts any scalar lvalue
481 The C<\$> and C<\[$]> subroutine prototypes now accept any scalar lvalue
482 argument. Previously they only accepted scalars beginning with C<$> and
483 hash and array elements. This change makes them consistent with the way
484 the built-in C<read> and C<recv> functions (among others) parse their
485 arguments. This means that one can override the built-in functions with
486 custom subroutines that parse their arguments the same way.
488 =head3 C<_> in subroutine prototypes
490 The C<_> character in subroutine prototypes is now allowed before C<@> or
495 =head2 Use C<is_utf8_char_buf()> and not C<is_utf8_char()>
497 The latter function is now deprecated because its API is insufficient to
498 guarantee that it doesn't read (up to 12 bytes in the worst case) beyond
499 the end of its input string. See
500 L<is_utf8_char_buf()|/Added is_utf8_char_buf()>.
502 =head2 C<File::Glob::bsd_glob()> memory error with GLOB_ALTDIRFUNC (CVE-2011-2728).
504 Calling C<File::Glob::bsd_glob> with the unsupported flag
505 GLOB_ALTDIRFUNC would cause an access violation / segfault. A Perl
506 program that accepts a flags value from an external source could expose
507 itself to denial of service or arbitrary code execution attacks. There
508 are no known exploits in the wild. The problem has been corrected by
509 explicitly disabling all unsupported flags and setting unused function
510 pointers to null. Bug reported by Clément Lecigne.
512 =head2 Privileges are now set correctly when assigning to C<$(>
514 A hypothetical bug (probably non-exploitable in practice) due to the
515 incorrect setting of the effective group ID while setting C<$(> has been
516 fixed. The bug would only have affected systems that have C<setresgid()>
517 but not C<setregid()>, but no such systems are known of.
521 =head2 Don't read the Unicode data base files in F<lib/unicore>
523 It is now deprecated to directly read the Unicode data base files.
524 These are stored in the F<lib/unicore> directory. Instead, you should
525 use the new functions in L<Unicode::UCD>. These provide a stable API,
526 and give complete information.
528 Perl may at some point in the future change or remove the files. The
529 file most likely for applications to have used is
530 F<lib/unicore/ToDigit.pl>. L<Unicode::UCD/prop_invmap()> can be used to
531 get at its data instead.
533 =head2 C<is_utf8_char()>
535 This function is deprecated because it could read beyond the end of the
536 input string. Use the new L<is_utf8_char_buf()|/Added is_utf8_char_buf()>
539 =head1 Future Deprecations
541 This section serves as a notice of features that are I<likely> to be
542 removed or L<deprecated|perlpolicy/deprecated> in the next release of
543 perl (5.18.0). If your code depends on these features, you should
544 contact the Perl 5 Porters via the L<mailing
545 list|http://lists.perl.org/list/perl5-porters.html> or L<perlbug> to
546 explain your use case and inform the deprecation process.
550 These modules may be marked as deprecated I<from the core>. This only
551 means that they will no longer be installed by default with the core
552 distribution, but will remain available on the CPAN.
570 Pod::Parser, Pod::LaTeX
586 =head2 Platforms with no supporting programmers:
588 These platforms will probably have their
589 special build support removed during the
590 5.17.0 development series.
628 =head2 Other Future Deprecations
634 Swapping of $< and $>
636 For more information about this future deprecation, see L<the relevant RT
637 ticket|https://rt.perl.org/rt3/Ticket/Display.html?id=96212>.
645 Unescaped literal C<< "{" >> in regular expressions.
647 It is planned starting in v5.20 to require a literal C<"{"> to be
648 escaped by, for example, preceding it with a backslash. In v5.18, a
649 deprecated warning message will be emitted for all such uses. Note that
650 this only affects patterns which are to match a literal C<"{">. Other
651 uses of this character, such as part of a quantifier or sequence like in
652 the ones below are completely unaffected:
658 The removal of this will allow extensions to pattern syntax, and better
659 error checking of existing syntax. See L<perlre/Quantifiers> for an
664 =head1 Incompatible Changes
666 =head2 Special blocks called in void context
668 Special blocks (C<BEGIN>, C<CHECK>, C<INIT>, C<UNITCHECK>, C<END>) are now
669 called in void context. This avoids wasteful copying of the result of the
670 last statement [perl #108794].
672 =head2 The C<overloading> pragma and regexp objects
674 With C<no overloading>, regular expression objects returned by C<qr//> are
675 now stringified as "Regexp=REGEXP(0xbe600d)" instead of the regular
676 expression itself [perl #108780].
678 =head2 Two XS typemap Entries removed
680 Two presumably unused XS typemap entries have been removed from the
681 core typemap: T_DATAUNIT and T_CALLBACK. If you are, against all odds,
682 a user of these, please see the instructions on how to regain them
685 =head2 Unicode 6.1 has incompatibilities with Unicode 6.0
687 These are detailed in L</Supports (almost) Unicode 6.1> above.
688 You can compile this version of Perl to use Unicode 6.0. See
689 L<perlunicode/Hacking Perl to work on earlier Unicode versions (for very serious hackers only)>.
691 =head2 Borland compiler
693 All support for the Borland compiler has been dropped. The code had not
694 worked for a long time anyway.
696 =head2 Certain deprecated Unicode properties are no longer supported by default
698 Perl should never have exposed certain Unicode properties that are used
699 by Unicode internally and not meant to be publicly available. Use of
700 these has generated deprecated warning messages since Perl 5.12. The
701 removed properties are Other_Alphabetic,
702 Other_Default_Ignorable_Code_Point, Other_Grapheme_Extend,
703 Other_ID_Continue, Other_ID_Start, Other_Lowercase, Other_Math, and
706 Perl may be recompiled to include any or all of them; instructions are
708 L<perluniprops/Unicode character properties that are NOT accepted by Perl>.
710 =head2 Dereferencing IO thingies as typeglobs
712 The C<*{...}> operator, when passed a reference to an IO thingy (as in
713 C<*{*STDIN{IO}}>), creates a new typeglob containing just that IO object.
714 Previously, it would stringify as an empty string, but some operators would
715 treat it as undefined, producing an "uninitialized" warning.
716 Now it stringifies as __ANONIO__ [perl #96326].
718 =head2 User-defined case changing operations.
720 This feature was deprecated in Perl 5.14, and has now been removed.
721 The CPAN module L<Unicode::Casing> provides better functionality without
722 the drawbacks that this feature had, as are detailed in the 5.14
724 L<http://perldoc.perl.org/5.14.0/perlunicode.html#User-Defined-Case-Mappings-%28for-serious-hackers-only%29>
726 =head2 XSUBs are now 'static'
728 XSUB C functions are now 'static', that is, they are not visible from
729 outside the compilation unit. Users can use the new C<XS_EXTERNAL(name)>
730 and C<XS_INTERNAL(name)> macros to pick the desired linking behaviour.
731 The ordinary C<XS(name)> declaration for XSUBs will continue to declare
732 non-'static' XSUBs for compatibility, but the XS compiler,
733 C<ExtUtils::ParseXS> (C<xsubpp>) will emit 'static' XSUBs by default.
734 C<ExtUtils::ParseXS>'s behaviour can be reconfigured from XS using the
735 C<EXPORT_XSUB_SYMBOLS> keyword. See L<perlxs> for details.
737 =head2 Weakening read-only references
739 Weakening read-only references is no longer permitted. It should never
740 have worked anyway, and in some cases could result in crashes.
742 =head2 Tying scalars that hold typeglobs
744 Attempting to tie a scalar after a typeglob was assigned to it would
745 instead tie the handle in the typeglob's IO slot. This meant that it was
746 impossible to tie the scalar itself. Similar problems affected C<tied> and
747 C<untie>: C<tied $scalar> would return false on a tied scalar if the last
748 thing returned was a typeglob, and C<untie $scalar> on such a tied scalar
751 We fixed this problem before Perl 5.14.0, but it caused problems with some
752 CPAN modules, so we put in a deprecation cycle instead.
754 Now the deprecation has been removed and this bug has been fixed. So
755 C<tie $scalar> will always tie the scalar, not the handle it holds. To tie
756 the handle, use C<tie *$scalar> (with an explicit asterisk). The same
757 applies to C<tied *$scalar> and C<untie *$scalar>.
759 =head2 IPC::Open3 no longer provides C<xfork()>, C<xclose_on_exec()>
762 All three functions were private, undocumented and unexported. They do
763 not appear to be used by any code on CPAN. Two have been inlined and one
766 =head2 C<$$> no longer caches PID
768 Previously, if one called fork(3) from C, Perl's
769 notion of C<$$> could go out of sync with what getpid() returns. By always
770 fetching the value of C<$$> via getpid(), this potential bug is eliminated.
771 Code that depends on the caching behavior will break. As described in
772 L<Core Enhancements|/C<$$> can be assigned to>,
773 C<$$> is now writable, but it will be reset during a
776 =head2 C<$$> and C<getppid()> no longer emulate POSIX semantics under LinuxThreads
778 The POSIX emulation of C<$$> and C<getppid()> under the obsolete
779 LinuxThreads implementation has been removed.
780 This only impacts users of Linux 2.4 and
781 users of Debian GNU/kFreeBSD up to and including 6.0, not the vast
782 majority of Linux installations that use NPTL threads.
784 This means that C<getppid()>, like C<$$>, is now always guaranteed to
785 return the OS's idea of the current state of the process, not perl's
786 cached version of it.
788 See the documentation for L<$$|perlvar/$$> for details.
790 =head2 C<< $< >>, C<< $> >>, C<$(> and C<$)> are no longer cached
792 Similarly to the changes to C<$$> and C<getppid()>, the internal
793 caching of C<< $< >>, C<< $> >>, C<$(> and C<$)> has been removed.
795 When we cached these values our idea of what they were would drift out
796 of sync with reality if someone (e.g., someone embedding perl) called
797 C<sete?[ug]id()> without updating C<PL_e?[ug]id>. Having to deal with
798 this complexity wasn't worth it given how cheap the C<gete?[ug]id()>
801 This change will break a handful of CPAN modules that use the XS-level
802 C<PL_uid>, C<PL_gid>, C<PL_euid> or C<PL_egid> variables.
804 The fix for those breakages is to use C<PerlProc_gete?[ug]id()> to
805 retrieve them (e.g. C<PerlProc_getuid()>), and not to assign to
806 C<PL_e?[ug]id> if you change the UID/GID/EUID/EGID. There is no longer
807 any need to do so since perl will always retrieve the up-to-date
808 version of those values from the OS.
810 =head2 Which Non-ASCII characters get quoted by C<quotemeta> and C<\Q> has changed
812 This is unlikely to result in a real problem, as Perl does not attach
813 special meaning to any non-ASCII character, so it is currently
814 irrelevant which are quoted or not. This change fixes bug [perl #77654] and
815 bring Perl's behavior more into line with Unicode's recommendations.
816 See L<perlfunc/quotemeta>.
818 =head1 Performance Enhancements
824 Improved performance for Unicode properties in regular expressions
826 =for comment Can this be compacted some? -- rjbs, 2012-02-20
828 Matching a code point against a Unicode property is now done via a
829 binary search instead of linear. This means for example that the worst
830 case for a 1000 item property is 10 probes instead of 1000. This
831 inefficiency has been compensated for in the past by permanently storing
832 in a hash the results of a given probe plus the results for the adjacent
833 64 code points, under the theory that near-by code points are likely to
834 be searched for. A separate hash was used for each mention of a Unicode
835 property in each regular expression. Thus, C<qr/\p{foo}abc\p{foo}/>
836 would generate two hashes. Any probes in one instance would be unknown
837 to the other, and the hashes could expand separately to be quite large
838 if the regular expression were used on many different widely-separated
839 code points. This can lead to running out of memory in extreme cases.
840 Now, however, there is just one hash shared by all instances of a given
841 property. This means that if C<\p{foo}> is matched against "A" in one
842 regular expression in a thread, the result will be known immediately to
843 all regular expressions, and the relentless march of using up memory is
848 Version declarations with the C<use> keyword (e.g., C<use 5.012>) are now
849 faster, as they enable features without loading F<feature.pm>.
853 C<local $_> is faster now, as it no longer iterates through magic that it
854 is not going to copy anyway.
858 Perl 5.12.0 sped up the destruction of objects whose classes define
859 empty C<DESTROY> methods (to prevent autoloading), by simply not
860 calling such empty methods. This release takes this optimisation a
861 step further, by not calling any C<DESTROY> method that begins with a
862 C<return> statement. This can be useful for destructors that are only
865 use constant DEBUG => 1;
866 sub DESTROY { return unless DEBUG; ... }
868 Constant-folding will reduce the first statement to C<return;> if DEBUG
869 is set to 0, triggering this optimisation.
873 Assigning to a variable that holds a typeglob or copy-on-write scalar
874 is now much faster. Previously the typeglob would be stringified or
875 the copy-on-write scalar would be copied before being clobbered.
879 Assignment to C<substr> in void context is now more than twice its
880 previous speed. Instead of creating and returning a special lvalue
881 scalar that is then assigned to, C<substr> modifies the original string
886 C<substr> no longer calculates a value to return when called in void
891 Due to changes in L<File::Glob>, Perl's C<glob> function and its C<<
892 <...> >> equivalent are now much faster. The splitting of the pattern
893 into words has been rewritten in C, resulting in speed-ups of 20% in
896 This does not affect C<glob> on VMS, as it does not use File::Glob.
900 The short-circuiting operators C<&&>, C<||>, and C<//>, when chained
901 (such as C<$a || $b || $c>), are now considerably faster to short-circuit,
902 due to reduced optree traversal.
906 The implementation of C<s///r> makes one fewer copy of the scalar's value.
910 C<study> is now a no-op.
914 Recursive calls to lvalue subroutines in lvalue scalar context use less
919 =head1 Modules and Pragmata
921 =head2 Deprecated Modules
925 =item L<Version::Requirements>
927 Version::Requirements is now DEPRECATED, use L<CPAN::Meta::Requirements>,
928 which is a drop-in replacement. It will be deleted from perl.git blead
933 =head2 New Modules and Pragmata
939 L<arybase> -- this new module implements the C<$[> variable.
943 C<PerlIO::mmap> 0.010 has been added to the Perl core.
945 The C<mmap> PerlIO layer is no longer implemented by perl itself, but has
946 been moved out into the new L<PerlIO::mmap> module.
950 =head2 Updated Modules and Pragmata
956 L<XXX> has been upgraded from version 0.69 to version 0.70.
960 =head2 Removed Modules and Pragmata
962 As promised in Perl 5.14.0's release notes, the following modules have
963 been removed from the core distribution, and if needed should be installed
970 C<Devel::DProf> has been removed from the Perl core. Prior version was
975 C<Shell> has been removed from the Perl core. Prior version was 0.72_01.
981 =head2 New Documentation
985 L<perldtrace> describes Perl's DTrace support, listing the provided probes
986 and gives examples of their use.
988 =head3 L<perlexperiment>
990 This document is intended to provide a list of experimental features in
991 Perl. It is still a work in progress.
995 This a new OO tutorial. It focuses on basic OO concepts, and then recommends
996 that readers choose an OO framework from CPAN.
998 =head3 L<perlxstypemap>
1000 The new manual describes the XS typemapping mechanism in unprecedented
1001 detail and combines new documentation with information extracted from
1002 L<perlxs> and the previously unofficial list of all core typemaps.
1004 =head2 Changes to Existing Documentation
1012 The HV API has long accepted negative lengths to indicate that the key is
1013 in UTF8. Now this is documented.
1017 The C<boolSV()> macro is now documented.
1027 C<dbmopen> treats a 0 mode as a special case, that prevents a nonexistent
1028 file from being created. This has been the case since Perl 5.000, but was
1029 never documented anywhere. Now the perlfunc entry mentions it
1034 As an accident of history, C<open $fh, "<:", ...> applies the default
1035 layers for the platform (C<:raw> on Unix, C<:crlf> on Windows), ignoring
1036 whatever is declared by L<open.pm|open>. This seems such a useful feature
1037 it has been documented in L<perlfunc|perlfunc/open> and L<open>.
1041 The entry for C<split> has been rewritten. It is now far clearer than
1052 A new section, L<Autoloading with XSUBs|perlguts/Autoloading with XSUBs>,
1053 has been added, which explains the two APIs for accessing the name of the
1058 Some of the function descriptions in L<perlguts> were confusing, as it was
1059 not clear whether they referred to the function above or below the
1060 description. This has been clarified [perl #91790].
1070 This document has been rewritten from scratch, and its coverage of various OO
1071 concepts has been expanded.
1081 Documentation of the smartmatch operator has been reworked and moved from
1082 perlsyn to perlop where it belongs.
1084 It has also been corrected for the case of C<undef> on the left-hand
1085 side. The list of different smart match behaviours had an item in the
1090 Documentation of the ellipsis statement (C<...>) has been reworked and
1091 moved from perlop to perlsyn.
1095 The explanation of bitwise operators has been expanded to explain how they
1096 work on Unicode strings (5.14.1).
1100 More examples for C<m//g> have been added (5.14.1).
1104 The C<<< <<\FOO >>> here-doc syntax has been documented (5.14.1).
1108 =head3 L<perlpragma>
1114 There is now a standard convention for naming keys in the C<%^H>,
1115 documented under L<Key naming|perlpragma/Key naming>.
1119 =head3 L<perlsec/Laundering and Detecting Tainted Data>
1125 The example function for checking for taintedness contained a subtle
1126 error. C<$@> needs to be localized to prevent its changing this
1127 global's value outside the function. The preferred method to check for
1128 this remains L<Scalar::Util/tainted>.
1138 L<perllol> has been expanded with examples using the new C<push $scalar>
1139 syntax introduced in Perl 5.14.0 (5.14.1).
1149 L<perlmod> now states explicitly that some types of explicit symbol table
1150 manipulation are not supported. This codifies what was effectively already
1151 the case [perl #78074].
1155 =head3 L<perlpodstyle>
1161 The tips on which formatting codes to use have been corrected and greatly
1166 There are now a couple of example one-liners for previewing POD files after
1167 they have been edited.
1177 The C<(*COMMIT)> directive is now listed in the right section
1178 (L<Verbs without an argument|perlre/Verbs without an argument>).
1188 L<perlrun> has undergone a significant clean-up. Most notably, the
1189 B<-0x...> form of the B<-0> flag has been clarified, and the final section
1190 on environment variables has been corrected and expanded (5.14.1).
1200 The ($;) prototype syntax, which has existed for rather a long time, is now
1201 documented in L<perlsub>. It allows a unary function to have the same
1202 precedence as a list operator.
1212 The required syntax for tying handles has been documented.
1222 The documentation for L<$!|perlvar/$!> has been corrected and clarified.
1223 It used to state that $! could be C<undef>, which is not the case. It was
1224 also unclear as to whether system calls set C's C<errno> or Perl's C<$!>
1229 Documentation for L<$$|perlvar/$$> has been amended with additional
1230 cautions regarding changing the process ID.
1234 =head3 Other Changes
1240 L<perlxs> was extended with documentation on inline typemaps.
1244 L<perlref> has a new L<Circular References|perlref/Circular References>
1245 section explaining how circularities may not be freed and how to solve that
1246 with weak references.
1250 Parts of L<perlapi> were clarified, and Perl equivalents of some C
1251 functions have been added as an additional mode of exposition.
1255 A few parts of L<perlre> and L<perlrecharclass> were clarified.
1259 =head2 Removed Documentation
1261 =head3 Old OO Documentation
1263 All the old OO tutorials, perltoot, perltooc, and perlboot, have been
1264 removed. The perlbot (bag of object tricks) document has been removed
1267 =head3 Development Deltas
1269 The perldelta files for development releases are no longer packaged with
1270 perl. These can still be found in the perl source code repository.
1274 The following additions or changes have been made to diagnostic output,
1275 including warnings and fatal error messages. For the complete list of
1276 diagnostic messages, see L<perldiag>.
1278 =head2 New Diagnostics
1286 L<Cannot set tied @DB::args|perldiag/"Cannot set tied @DB::args">
1288 This error occurs when C<caller> tries to set C<@DB::args> but finds it
1289 tied. Before this error was added, it used to crash instead.
1293 L<Cannot tie unreifiable array|perldiag/"Cannot tie unreifiable array">
1295 This error is part of a safety check that the C<tie> operator does before
1296 tying a special array like C<@_>. You should never see this message.
1300 L<&CORE::%s cannot be called directly|perldiag/"&CORE::%s cannot be called directly">
1302 This occurs when a subroutine in the C<CORE::> namespace is called
1303 with C<&foo> syntax or through a reference. Some subroutines
1304 in this package cannot yet be called that way, but must be
1305 called as barewords. See L</Subroutines in the C<CORE> namespace>, above.
1309 L<Source filters apply only to byte streams|perldiag/"Source filters apply only to byte streams">
1311 This new error occurs when you try to activate a source filter (usually by
1312 loading a source filter module) within a string passed to C<eval> under the
1313 C<unicode_eval> feature.
1323 L<defined(@array) is deprecated|perldiag/"defined(@array) is deprecated">
1325 The long-deprecated C<defined(@array)> now also warns for package variables.
1326 Previously it only issued a warning for lexical variables.
1330 L<length() used on %s|perldiag/length() used on %s>
1332 This new warning occurs when C<length> is used on an array or hash, instead
1333 of C<scalar(@array)> or C<scalar(keys %hash)>.
1337 L<lvalue attribute %s already-defined subroutine|perldiag/"lvalue attribute %s already-defined subroutine">
1339 L<attributes.pm|attributes> now emits this warning when the :lvalue
1340 attribute is applied to a Perl subroutine that has already been defined, as
1341 doing so can have unexpected side-effects.
1345 L<overload arg '%s' is invalid|perldiag/"overload arg '%s' is invalid">
1347 This warning, in the "overload" category, is produced when the overload
1348 pragma is given an argument it doesn't recognize, presumably a mistyped
1353 L<$[ used in %s (did you mean $] ?)|perldiag/"$[ used in %s (did you mean $] ?)">
1355 This new warning exists to catch the mistaken use of C<$[> in version
1356 checks. C<$]>, not C<$[>, contains the version number.
1360 L<Useless assignment to a temporary|perldiag/"Useless assignment to a temporary">
1362 Assigning to a temporary scalar returned
1363 from an lvalue subroutine now produces this
1364 warning [perl #31946].
1368 L<Useless use of \E|perldiag/"Useless use of \E">
1370 C<\E> does nothing unless preceded by C<\Q>, C<\L> or C<\U>.
1374 =head2 Removed Errors
1380 "sort is now a reserved word"
1382 This error used to occur when C<sort> was called without arguments,
1383 followed by C<;> or C<)>. (E.g., C<sort;> would die, but C<{sort}> was
1384 OK.) This error message was added in Perl 3 to catch code like
1385 C<close(sort)> which would no longer work. More than two decades later,
1386 this message is no longer appropriate. Now C<sort> without arguments is
1387 always allowed, and returns an empty list, as it did in those cases
1388 where it was already allowed [perl #90030].
1392 =head2 Changes to Existing Diagnostics
1398 The "Applying pattern match..." or similar warning produced when an
1399 array or hash is on the left-hand side of the C<=~> operator now
1400 mentions the name of the variable.
1404 The "Attempt to free non-existent shared string" has had the spelling
1405 of "non-existent" corrected to "nonexistent". It was already listed
1406 with the correct spelling in L<perldiag>.
1410 The error messages for using C<default> and C<when> outside of a
1411 topicalizer have been standardised to match the messages for C<continue>
1412 and loop controls. They now read 'Can't "default" outside a
1413 topicalizer' and 'Can't "when" outside a topicalizer'. They both used
1414 to be 'Can't use when() outside a topicalizer' [perl #91514].
1418 The message, "Code point 0x%X is not Unicode, no properties match it;
1419 all inverse properties do" has been changed to "Code point 0x%X is not
1420 Unicode, all \p{} matches fail; all \P{} matches succeed".
1424 Redefinition warnings for constant subroutines used to be mandatory,
1425 even occurring under C<no warnings>. Now they respect the L<warnings>
1430 The "glob failed" warning message is now suppressible via C<no warnings>
1435 The L<Invalid version format|perldiag/"Invalid version format (%s)">
1436 error message now says "negative version number" within the parentheses,
1437 rather than "non-numeric data", for negative numbers.
1442 L<Possible attempt to put comments in qw() list|perldiag/"Possible attempt to put comments in qw() list">
1444 L<Possible attempt to separate words with commas|perldiag/"Possible attempt to separate words with commas">
1445 are no longer mutually exclusive: the same C<qw> construct may produce
1450 The uninitialized warning for C<y///r> when C<$_> is implicit and
1451 undefined now mentions the variable name, just like the non-/r variation
1456 The 'Use of "foo" without parentheses is ambiguous' warning has been
1457 extended to apply also to user-defined subroutines with a (;$)
1458 prototype, and not just to built-in functions.
1462 Warnings that mention the names of lexical (C<my>) variables with
1463 Unicode characters in them now respect the presence or absence of the
1464 C<:utf8> layer on the output handle, instead of outputting UTF8
1465 regardless. Also, the correct names are included in the strings passed
1466 to C<$SIG{__WARN__}> handlers, rather than the raw UTF8 bytes.
1470 =head1 Utility Changes
1478 L<h2ph> used to generate code of the form
1480 unless(defined(&FOO)) {
1484 But the subroutine is a compile-time declaration, and is hence unaffected
1485 by the condition. It has now been corrected to emit a string C<eval>
1486 around the subroutine [perl #99368].
1496 F<splain> no longer emits backtraces with the first line number repeated.
1500 Uncaught exception from user code:
1501 Cannot fwiddle the fwuddle at -e line 1.
1503 main::baz() called at -e line 1
1504 main::bar() called at -e line 1
1505 main::foo() called at -e line 1
1509 Uncaught exception from user code:
1510 Cannot fwiddle the fwuddle at -e line 1.
1511 main::baz() called at -e line 1
1512 main::bar() called at -e line 1
1513 main::foo() called at -e line 1
1517 Some error messages consist of multiple lines that are listed as separate
1518 entries in L<perldiag>. splain has been taught to find the separate
1519 entries in these cases, instead of simply failing to find the message.
1523 =head3 L<zipdetails>
1529 This is a new utility, included as part of an
1530 L<IO::Compress::Base> upgrade.
1532 L<zipdetails> displays information about the internal record structure
1533 of the zip file. It is not concerned with displaying any details of
1534 the compressed data stored in the zip file.
1538 =head1 Configuration and Compilation
1544 The C<-Dusesitecustomize> and C<-Duserelocatableinc> options now work
1549 F<regexp.h> has been modified for compatibility with GCC's B<-Werror>
1550 option, as used by some projects that include perl's header files (5.14.1).
1554 C<USE_LOCALE{,_COLLATE,_CTYPE,_NUMERIC}> have been added the output of perl -V
1555 as they have affect the behaviour of the interpreter binary (albeit only
1560 The code and tests for L<IPC::Open2> have been moved from F<ext/IPC-Open2>
1561 into F<ext/IPC-Open3>, as C<IPC::Open2::open2()> is implemented as a thin
1562 wrapper around C<IPC::Open3::_open3()>, and hence is very tightly coupled to
1567 The magic types and magic vtables are now generated from data in a new script
1568 F<regen/mg_vtable.pl>, instead of being
1569 maintained by hand. As different EBCDIC
1570 variants can't agree on the code point for '~', the character to code point
1571 conversion is done at build time by F<generate_uudmap> to a new generated header
1572 F<mg_data.h>. C<PL_vtbl_bm> and C<PL_vtbl_fm> are now defined by the
1573 pre-processor as C<PL_vtbl_regexp>, instead of being distinct C variables.
1574 C<PL_vtbl_sig> has been removed.
1578 Building with C<-DPERL_GLOBAL_STRUCT>
1579 works again. This configuration is not
1584 Perl configured with I<MAD> now correctly frees C<MADPROP> structures when
1585 OPs are freed. C<MADPROP>s are now allocated with
1586 C<PerlMemShared_malloc()>
1590 =head1 Platform Support
1592 =head2 Platform-Specific Notes
1600 Since version 1.7, Cygwin supports native UTF-8 paths. If Perl is built
1601 under that environment, directory and filenames will be UTF-8 encoded.
1603 Cygwin does not initialize all original Win32 environment variables. See
1604 F<README.cygwin> for a discussion of the newly-added
1605 C<Cygwin::sync_winenv()> function [perl #110190] and for
1616 Remove unnecessary includes, fix miscellaneous compiler warnings and
1617 close some unclosed comments on F<vms/vms.c>.
1619 Remove sockadapt layer from the VMS build.
1623 Explicit support for VMS versions prior to v7.0 and DEC C versions
1624 prior to v6.0 has been removed.
1628 Since Perl 5.10.1, the home-grown C<stat> wrapper has been unable to
1629 distinguish between a directory name containing an underscore and an
1630 otherwise-identical filename containing a dot in the same position
1631 (e.g., t/test_pl as a directory and t/test.pl as a file). This problem
1636 The build on VMS now allows names of the resulting symbols in C code for
1637 Perl longer than 31 characters. Symbols like
1638 C<Perl__it_was_the_best_of_times_it_was_the_worst_of_times> can now be
1639 created freely without causing the VMS linker to seize up.
1645 Numerous build and test failures on GNU/Hurd have been resolved with hints
1646 for building DBM modules, detection of the library search path, and enabling
1647 of large file support.
1651 Perl is now built with dynamic linking on OpenVOS, the minimum supported
1652 version of which is now Release 17.1.0.
1656 The CC workshop C++ compiler is now detected and used on systems that ship
1659 =head1 Internal Changes
1665 There are now feature bundle hints in C<PL_hints> (C<$^H>) that version
1666 declarations use, to avoid having to load F<feature.pm>. One setting of
1667 the hint bits indicates a "custom" feature bundle, which means that the
1668 entries in C<%^H> still apply. F<feature.pm> uses that.
1670 The C<HINT_FEATURE_MASK> macro is defined in F<perl.h> along with other
1671 hints. Other macros for setting and testing features and bundles are in
1672 the new F<feature.h>. C<FEATURE_IS_ENABLED> (which has moved to
1673 F<feature.h>) is no longer used throughout the codebase, but more specific
1674 macros, e.g., C<FEATURE_SAY_IS_ENABLED>, that are defined in F<feature.h>.
1678 F<lib/feature.pm> is now a generated file, created by the new
1679 F<regen/feature.pl> script, which also generates F<feature.h>.
1683 Tied arrays are now always C<AvREAL>. If C<@_> or C<DB::args> is tied, it
1684 is reified first, to make sure this is always the case.
1688 The C<is_gv_magical_sv> function has been eliminated and merged with
1689 C<gv_fetchpvn_flags>. It used to be called to determine whether a GV
1690 should be autovivified in rvalue context. Now it has been replaced with a
1691 new C<GV_ADDMG> flag (not part of the API).
1695 Padlists are now marked C<AvREAL>; i.e., reference-counted. They have
1696 always been reference-counted, but were not marked real, because F<pad.c>
1697 did its own clean-up, instead of using the usual clean-up code in F<sv.c>.
1698 That caused problems in thread cloning, so now the C<AvREAL> flag is on,
1699 but is turned off in F<pad.c> right before the padlist is freed (after
1700 F<pad.c> has done its custom freeing of the pads).
1704 All the C files that make up the Perl core have been converted to UTF-8.
1708 =head1 Selected Bug Fixes
1710 =head2 Array and hash
1716 A bug has been fixed that would cause a "Use of freed value in iteration"
1717 error if the next two hash elements that would be iterated over are
1718 deleted [perl #85026]. (5.14.1)
1722 Deleting the current hash iterator (the hash element that would be returend
1723 by the next call to C<each>) in void context used not to free it
1728 Deletion of methods via C<delete $Class::{method}> syntax used to update
1729 method caches if called in void context, but not scalar or list context.
1733 When hash elements are deleted in void context, the internal hash entry is
1734 now freed before the value is freed, to prevent destructors called by that
1735 latter freeing from seeing the hash in an inconsistent state. It was
1736 possible to cause double-frees if the destructor freed the hash itself
1741 A C<keys> optimisation in Perl 5.12.0 to make it faster on empty hashes
1742 caused C<each> not to reset the iterator if called after the last element
1747 Freeing deeply nested hashes no longer crashes [perl #44225].
1751 It is possible from XS code to create hashes with elements that have no
1752 values. The hash element and slice operators used to crash
1753 when handling these in lvalue context. They now
1754 produce a "Modification of non-creatable hash value attempted" error
1759 If list assignment to a hash or array triggered destructors that freed the
1760 hash or array itself, a crash would ensue. This is no longer the case
1765 It used to be possible to free the typeglob of a localised array or hash
1766 (e.g., C<local @{"x"}; delete $::{x}>), resulting in a crash on scope exit.
1770 Some core bugs affecting L<Hash::Util> have been fixed: locking a hash
1771 element that is a glob copy no longer causes subsequent assignment to it to
1772 corrupt the glob, and unlocking a hash element that holds a copy-on-write
1773 scalar no longer causes modifications to that scalar to modify other
1774 scalars that were sharing the same string buffer.
1784 The C<newHVhv> XS function now works on tied hashes, instead of crashing or
1785 returning an empty hash.
1789 The C<SvIsCOW> C macro now returns false for read-only copies of typeglobs,
1790 such as those created by:
1793 Hash::Util::lock_value %hash, 'elem';
1795 It used to return true.
1799 The C<SvPVutf8> C function no longer tries to modify its argument,
1800 resulting in errors [perl #108994].
1804 C<SvPVutf8> now works properly with magical variables.
1808 C<SvPVbyte> now works properly non-PVs.
1812 When presented with malformed UTF-8 input, the XS-callable functions
1813 C<is_utf8_string()>, C<is_utf8_string_loc()>, and
1814 C<is_utf8_string_loclen()> could read beyond the end of the input
1815 string by up to 12 bytes. This no longer happens. [perl #32080].
1816 However, currently, C<is_utf8_char()> still has this defect, see
1817 L</is_utf8_char()> above.
1821 The C-level C<pregcomp> function could become confused as to whether the
1822 pattern was in UTF8 if the pattern was an overloaded, tied, or otherwise
1823 magical scalar [perl #101940].
1827 =head2 Compile-time hints
1833 Tying C<%^H> no longer causes perl to crash or ignore the contents of
1834 C<%^H> when entering a compilation scope [perl #106282].
1838 C<eval $string> and C<require> used not to
1839 localise C<%^H> during compilation if it
1840 was empty at the time the C<eval> call itself was compiled. This could
1841 lead to scary side effects, like C<use re "/m"> enabling other flags that
1842 the surrounding code was trying to enable for its caller [perl #68750].
1846 C<eval $string> and C<require> no longer localise hints (C<$^H> and C<%^H>)
1847 at run time, but only during compilation of the $string or required file.
1848 This makes C<BEGIN { $^H{foo}=7 }> equivalent to
1849 C<BEGIN { eval '$^H{foo}=7' }> [perl #70151].
1853 Creating a BEGIN block from XS code (via C<newXS> or C<newATTRSUB>) would,
1854 on completion, make the hints of the current compiling code the current
1855 hints. This could cause warnings to occur in a non-warning scope.
1859 =head2 Copy-on-write scalars
1861 Copy-on-write or shared hash key scalars
1862 were introduced in 5.8.0, but most Perl code
1863 did not encounter them (they were used mostly internally). Perl
1864 5.10.0 extended them, such that assigning C<__PACKAGE__> or a
1865 hash key to a scalar would make it copy-on-write. Several parts
1866 of Perl were not updated to account for them, but have now been fixed.
1872 C<utf8::decode> had a nasty bug that would modify copy-on-write scalars'
1873 string buffers in place (i.e., skipping the copy). This could result in
1874 hashes having two elements with the same key [perl #91834].
1878 Lvalue subroutines were not allowing COW scalars to be returned. This was
1879 fixed for lvalue scalar context in Perl 5.12.3 and 5.14.0, but list context
1880 was not fixed until this release.
1884 Elements of restricted hashes (see the L<fields> pragma) containing
1885 copy-on-write values couldn't be deleted, nor could such hashes be cleared
1890 Localising a tied variable used to make it read-only if it contained a
1891 copy-on-write string.
1895 Assigning a copy-on-write string to a stash
1896 element no longer causes a double free. Regardless of this change, the
1897 results of such assignments are still undefined.
1901 Assigning a copy-on-write string to a tied variable no longer stops that
1902 variable from being tied if it happens to be a PVMG or PVLV internally.
1906 Doing a substitution on a tied variable returning a copy-on-write
1907 scalar used to cause an assertion failure or an "Attempt to free
1908 nonexistent shared string" warning.
1912 This one is a regression from 5.12: In 5.14.0, the bitwise assignment
1913 operators C<|=>, C<^=> and C<&=> started leaving the left-hand side
1914 undefined if it happened to be a copy-on-write string [perl #108480].
1918 L<Storable>, L<Devel::Peek> and L<PerlIO::scalar> had similar problems.
1919 See L</Updated Modules and Pragmata>, above.
1929 F<dumpvar.pl>, and consequently the C<x> command in the debugger, have been
1930 fixed to handle objects blessed into classes whose names contain "=". The
1931 contents of such objects used not to be dumped [perl #101814].
1935 The "R" command for restarting a debugger session has been fixed to work on
1936 Windows, or any other system lacking a C<POSIX::_SC_OPEN_MAX> constant
1941 The C<#line 42 foo> directive used not to update the arrays of lines used
1942 by the debugger if it occurred in a string eval. This was partially fixed
1943 in 5.14, but it only worked for a single C<#line 42 foo> in each eval. Now
1944 it works for multiple.
1948 When subroutine calls are intercepted by the debugger, the name of the
1949 subroutine or a reference to it is stored in C<$DB::sub>, for the debugger
1950 to access. In some cases (such as C<$foo = *bar; undef *bar; &$foo>)
1951 C<$DB::sub> would be set to a name that could not be used to find the
1952 subroutine, and so the debugger's attempt to call it would fail. Now the
1953 check to see whether a reference is needed is more robust, so those
1954 problems should not happen anymore [rt.cpan.org #69862].
1958 Every subroutine has a filename associated with it that the debugger uses.
1959 The one associated with constant subroutines used to be misallocated when
1960 cloned under threads. Consequently, debugging threaded applications could
1961 result in memory corruption [perl #96126].
1965 =head2 Dereferencing operators
1971 C<defined(${"..."})>, C<defined(*{"..."})>, etc., used to
1972 return true for most, but not all built-in variables, if
1973 they had not been used yet. This bug affected C<${^GLOBAL_PHASE}> and
1974 C<${^UTF8CACHE}>, among others. It also used to return false if the
1975 package name was given as well (C<${"::!"}>) [perl #97978, #97492].
1979 Perl 5.10.0 introduced a similar bug: C<defined(*{"foo"})> where "foo"
1980 represents the name of a built-in global variable used to return false if
1981 the variable had never been used before, but only on the I<first> call.
1982 This, too, has been fixed.
1986 Since 5.6.0, C<*{ ... }> has been inconsistent in how it treats undefined
1987 values. It would die in strict mode or lvalue context for most undefined
1988 values, but would be treated as the empty string (with a warning) for the
1989 specific scalar return by C<undef()> (C<&PL_sv_undef> internally). This
1990 has been corrected. C<undef()> is now treated like other undefined
1991 scalars, as in Perl 5.005.
1995 =head2 Filehandle, last-accessed
1997 Perl has an internal variable that stores the last filehandle to be
1998 accessed. It is used by C<$.> and by C<tell> and C<eof> without
2005 It used to be possible to set this internal variable to a glob copy and
2006 then modify that glob copy to be something other than a glob, and still
2007 have the last-accessed filehandle associated with the variable after
2008 assigning a glob to it again:
2010 my $foo = *STDOUT; # $foo is a glob copy
2011 <$foo>; # $foo is now the last-accessed handle
2012 $foo = 3; # no longer a glob
2013 $foo = *STDERR; # still the last-accessed handle
2015 Now the C<$foo = 3> assignment unsets that internal variable, so there
2016 is no last-accessed filehandle, just as if C<< <$foo> >> had never
2019 This also prevents some unrelated handle from becoming the last-accessed
2020 handle if $foo falls out of scope and the same internal SV gets used for
2021 another handle [perl #97988].
2025 A regression in 5.14 caused these statements not to set that internal
2037 This is now fixed, but C<tell *{ *$fh }> still has the problem, and it
2038 is not clear how to fix it [perl #106536].
2042 =head2 Filetests and C<stat>
2044 The term "filetests" refers to the operators that consist of a hyphen
2045 followed by a single letter: C<-r>, C<-x>, C<-M>, etc. The term "stacked"
2046 when applied to filetests means followed by another filetest operator
2047 sharing the same operand, as in C<-r -x -w $fooo>.
2053 C<stat> produces more consistent warnings. It no longer warns for "_"
2054 [perl #71002] and no longer skips the warning at times for other unopened
2055 handles. It no longer warns about an unopened handle when the operating
2056 system's C<fstat> function fails.
2060 C<stat> would sometimes return negative numbers for large inode numbers,
2061 because it was using the wrong internal C type. [perl #84590]
2065 C<lstat> is documented to fall back to C<stat> (with a warning) when given
2066 a filehandle. When passed an IO reference, it was actually doing the
2067 equivalent of S<C<stat _>> and ignoring the handle.
2071 C<-T _> with no preceding C<stat> used to produce a
2072 confusing "uninitialized" warning, even though there
2073 is no visible uninitialized value to speak of.
2077 C<-T>, C<-B>, C<-l> and C<-t> now work
2078 when stacked with other filetest operators
2083 In 5.14.0, filetest ops (C<-r>, C<-x>, etc.) started calling FETCH on a
2084 tied argument belonging to the previous argument to a list operator, if
2085 called with a bareword argument or no argument at all. This has been
2086 fixed, so C<push @foo, $tied, -r> no longer calls FETCH on C<$tied>.
2090 In Perl 5.6, C<-l> followed by anything other than a bareword would treat
2091 its argument as a file name. That was changed in 5.8 for glob references
2092 (C<\*foo>), but not for globs themselves (C<*foo>). C<-l> started
2093 returning C<undef> for glob references without setting the last
2094 stat buffer that the "_" handle uses, but only if warnings
2095 were turned on. With warnings off, it was the same as 5.6.
2096 In other words, it was simply buggy and inconsistent. Now the 5.6
2097 behaviour has been restored.
2101 C<-l> followed by a bareword no longer "eats" the previous argument to
2102 the list operator in whose argument list it resides. Hence,
2103 C<print "bar", -l foo> now actually prints "bar", because C<-l>
2108 Perl keeps several internal variables to keep track of the last stat
2109 buffer, from which file(handle) it originated, what type it was, and
2110 whether the last stat succeeded.
2112 There were various cases where these could get out of synch, resulting in
2113 inconsistent or erratic behaviour in edge cases (every mention of C<-T>
2114 applies to C<-B> as well):
2120 C<-T I<HANDLE>>, even though it does a C<stat>, was not resetting the last
2121 stat type, so an C<lstat _> following it would merrily return the wrong
2122 results. Also, it was not setting the success status.
2126 Freeing the handle last used by C<stat> or a filetest could result in
2127 S<C<-T _>> using an unrelated handle.
2131 C<stat> with an IO reference would not reset the stat type or record the
2132 filehandle for S<C<-T _>> to use.
2136 Fatal warnings could cause the stat buffer not to be reset
2137 for a filetest operator on an unopened filehandle or C<-l> on any handle.
2138 Fatal warnings also stopped C<-T> from setting C<$!>.
2142 When the last stat was on an unreadable file, C<-T _> is supposed to
2143 return C<undef>, leaving the last stat buffer unchanged. But it was
2144 setting the stat type, causing C<lstat _> to stop working.
2148 C<-T I<FILENAME>> was not resetting the internal stat buffers for
2153 These have all been fixed.
2163 A number of edge cases have been fixed with formats and C<formline>;
2164 in particular, where the format itself is potentially variable (such as
2165 with ties and overloading), and where the format and data differ in their
2166 encoding. In both these cases, it used to possible for the output to be
2167 corrupted [perl #91032].
2171 C<formline> no longer converts its argument into a string in-place. So
2172 passing a reference to C<formline> no longer destroys the reference
2177 Assignment to C<$^A> (the format output accumulator) now recalculates
2178 the number of lines output.
2182 =head2 C<given> and C<when>
2188 C<given> was not scoping its implicit $_ properly, resulting in memory
2189 leaks or "Variable is not available" warnings [perl #94682].
2193 C<given> was not calling set-magic on the implicit lexical C<$_> that it
2194 uses. This meant, for example, that C<pos> would be remembered from one
2195 execution of the same C<given> block to the next, even if the input were a
2196 different variable [perl #84526].
2200 C<when> blocks are now capable of returning variables declared inside the
2201 enclosing C<given> block [perl #93548].
2205 =head2 The C<glob> operator
2211 On OSes other than VMS, Perl's C<glob> operator (and the C<< <...> >> form)
2212 use L<File::Glob> underneath. L<File::Glob> splits the pattern into words,
2213 before feeding each word to its C<bsd_glob> function.
2215 There were several inconsistencies in the way the split was done. Now
2216 quotation marks (' and ") are always treated as shell-style word delimiters
2217 (that allow whitespace as part of a word) and backslashes are always
2218 preserved, unless they exist to escape quotation marks. Before, those
2219 would only sometimes be the case, depending on whether the pattern
2220 contained whitespace. Also, escaped whitespace at the end of the pattern
2221 is no longer stripped [perl #40470].
2225 C<CORE::glob> now works as a way to call the default globbing function. It
2226 used to respect overrides, despite the C<CORE::> prefix.
2230 Under miniperl (used to configure modules when perl itself is built),
2231 C<glob> now clears %ENV before calling csh, since the latter croaks on some
2232 systems if it does not like the contents of the LS_COLORS enviroment
2233 variable [perl #98662].
2237 =head2 Lvalue subroutines
2243 Explicit return now returns the actual argument passed to return, instead
2244 of copying it [perl #72724, #72706].
2248 Lvalue subroutines used to enforce lvalue syntax (i.e., whatever can go on
2249 the left-hand side of C<=>) for the last statement and the arguments to
2250 return. Since lvalue subroutines are not always called in lvalue context,
2251 this restriction has been lifted.
2255 Lvalue subroutines are less restrictive as to what values can be returned.
2256 It used to croak on values returned by C<shift> and C<delete> and from
2257 other subroutines, but no longer does so [perl #71172].
2261 Empty lvalue subroutines (C<sub :lvalue {}>) used to return C<@_> in list
2262 context. In fact, all subroutines used to, but regular subs were fixed in
2263 Perl 5.8.2. Now lvalue subroutines have been likewise fixed.
2267 Autovivification now works on values returned from lvalue subroutines
2268 [perl #7946], as does returning C<keys> in lvalue context.
2272 Lvalue subroutines used to copy their return values in rvalue context. Not
2273 only was this a waste of CPU cycles, but it also caused bugs. A C<($)>
2274 prototype would cause an lvalue sub to copy its return value [perl #51408],
2275 and C<while(lvalue_sub() =~ m/.../g) { ... }> would loop endlessly
2280 When called in potential lvalue context
2281 (e.g., subroutine arguments or a list
2282 passed to C<for>), lvalue subroutines used to copy
2283 any read-only value that was returned. E.g., C< sub :lvalue { $] } >
2284 would not return C<$]>, but a copy of it.
2288 When called in potential lvalue context, an lvalue subroutine returning
2289 arrays or hashes used to bind the arrays or hashes to scalar variables,
2290 resulting in bugs. This was fixed in 5.14.0 if an array were the first
2291 thing returned from the subroutine (but not for C<$scalar, @array> or
2292 hashes being returned). Now a more general fix has been applied
2297 Method calls whose arguments were all surrounded with C<my()> or C<our()>
2298 (as in C<< $object->method(my($a,$b)) >>) used to force lvalue context on
2299 the subroutine. This would prevent lvalue methods from returning certain
2304 Lvalue sub calls that are not determined to be such at compile time
2305 (C<&$name> or &{"name"}) are no longer exempt from strict refs if they
2306 occur in the last statement of an lvalue subroutine [perl #102486].
2310 Sub calls whose subs are not visible at compile time, if
2311 they occurred in the last statement of an lvalue subroutine,
2312 would reject non-lvalue subroutines and die with "Can't modify non-lvalue
2313 subroutine call" [perl #102486].
2315 Non-lvalue sub calls whose subs I<are> visible at compile time exhibited
2316 the opposite bug. If the call occurred in the last statement of an lvalue
2317 subroutine, there would be no error when the lvalue sub was called in
2318 lvalue context. Perl would blindly assign to the temporary value returned
2319 by the non-lvalue subroutine.
2323 C<AUTOLOAD> routines used to take precedence over the actual sub being
2324 called (i.e., when autoloading wasn't needed), for sub calls in lvalue or
2325 potential lvalue context, if the subroutine was not visible at compile
2330 Applying the C<:lvalue> attribute to an XSUB or to an aliased subroutine
2331 stub with C<< sub foo :lvalue; >> syntax stopped working in Perl 5.12.
2332 This has been fixed.
2336 Applying the :lvalue attribute to subroutine that is already defined does
2337 not work properly, as the attribute changes the way the sub is compiled.
2338 Hence, Perl 5.12 began warning when an attempt is made to apply the
2339 attribute to an already defined sub. In such cases, the attribute is
2342 But the change in 5.12 missed the case where custom attributes are also
2343 present: that case still silently and ineffectively applied the attribute.
2344 That omission has now been corrected. C<sub foo :lvalue :Whatever> (when
2345 C<foo> is already defined) now warns about the :lvalue attribute, and does
2350 A bug affecting lvalue context propagation through nested lvalue subroutine
2351 calls has been fixed. Previously, returning a value in nested rvalue
2352 context would be treated as lvalue context by the inner subroutine call,
2353 resulting in some values (such as read-only values) being rejected.
2363 Arithmetic assignment (C<$left += $right>) involving overloaded objects
2364 that rely on the 'nomethod' override no longer segfault when the left
2365 operand is not overloaded.
2369 Errors that occur when methods cannot be found during overloading now
2370 mention the correct package name, as they did in 5.8.x, instead of
2371 erroneously mentioning the "overload" package, as they have since 5.10.0.
2375 Undefining C<%overload::> no longer causes a crash.
2379 =head2 Prototypes of built-in keywords
2385 The C<prototype> function no longer dies for the C<__FILE__>, C<__LINE__>
2386 and C<__PACKAGE__> directives. It now returns an empty-string prototype
2387 for them, because they are syntactically indistinguishable from nullary
2388 functions like C<time>.
2392 C<prototype> now returns C<undef> for all overridable infix operators,
2393 such as C<eq>, which are not callable in any way resembling functions.
2394 It used to return incorrect prototypes for some and die for others
2399 The prototypes of several built-in functions--C<getprotobynumber>, C<lock>,
2400 C<not> and C<select>--have been corrected, or at least are now closer to
2401 reality than before.
2405 =head2 Regular expressions
2407 =for comment Is it possible to merge some of these items?
2413 C</[[:ascii:]]/> and C</[[:blank:]]/> now use locale rules under
2414 C<use locale> when the platform supports that. Previously, they used
2415 the platform's native character set.
2419 C<m/[[:ascii:]]/i> and C</\p{ASCII}/i> now match identically (when not
2420 under a differing locale). This fixes a regression introduced in 5.14
2421 in which the first expression could match characters outside of ASCII,
2422 such as the KELVIN SIGN.
2426 C</.*/g> would sometimes refuse to match at the end of a string that ends
2427 with "\n". This has been fixed [perl #109206].
2431 Starting with 5.12.0, Perl used to get its internal bookkeeping muddled up
2432 after assigning C<${ qr// }> to a hash element and locking it with
2433 L<Hash::Util>. This could result in double frees, crashes or erratic
2438 The new (in 5.14.0) regular expression modifier C</a> when repeated like
2439 C</aa> forbids the characters outside the ASCII range that match
2440 characters inside that range from matching under C</i>. This did not
2441 work under some circumstances, all involving alternation, such as:
2443 "\N{KELVIN SIGN}" =~ /k|foo/iaa;
2445 succeeded inappropriately. This is now fixed.
2449 5.14.0 introduced some memory leaks in regular expression character
2450 classes such as C<[\w\s]>, which have now been fixed. (5.14.1)
2454 An edge case in regular expression matching could potentially loop.
2455 This happened only under C</i> in bracketed character classes that have
2456 characters with multi-character folds, and the target string to match
2457 against includes the first portion of the fold, followed by another
2458 character that has a multi-character fold that begins with the remaining
2459 portion of the fold, plus some more.
2461 "s\N{U+DF}" =~ /[\x{DF}foo]/i
2463 is one such case. C<\xDF> folds to C<"ss">. (5.14.1)
2467 A few characters in regular expression pattern matches did not
2468 match correctly in some circumstances, all involving C</i>. The
2469 affected characters are:
2470 COMBINING GREEK YPOGEGRAMMENI,
2471 GREEK CAPITAL LETTER IOTA,
2472 GREEK CAPITAL LETTER UPSILON,
2473 GREEK PROSGEGRAMMENI,
2474 GREEK SMALL LETTER IOTA WITH DIALYTIKA AND OXIA,
2475 GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS,
2476 GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND OXIA,
2477 GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS,
2478 LATIN SMALL LETTER LONG S,
2479 LATIN SMALL LIGATURE LONG S T,
2481 LATIN SMALL LIGATURE ST.
2485 A memory leak regression in regular expression compilation
2486 under threading has been fixed.
2490 A regression introduced in 5.13.6 has
2491 been fixed. This involved an inverted
2492 bracketed character class in a regular expression that consisted solely
2493 of a Unicode property. That property wasn't getting inverted outside the
2498 Three problematic Unicode characters now work better in regex pattern matching under C</i>
2500 In the past, three Unicode characters:
2501 LATIN SMALL LETTER SHARP S,
2502 GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS,
2504 GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS,
2505 along with the sequences that they fold to
2506 (including "ss" in the case of LATIN SMALL LETTER SHARP S),
2507 did not properly match under C</i>. 5.14.0 fixed some of these cases,
2508 but introduced others, including a panic when one of the characters or
2509 sequences was used in the C<(?(DEFINE)> regular expression predicate.
2510 The known bugs that were introduced in 5.14 have now been fixed; as well
2511 as some other edge cases that have never worked until now. All these
2512 involve using the characters and sequences outside bracketed character
2513 classes under C</i>. This closes [perl #98546].
2515 There remain known problems when using certain characters with
2516 multi-character folds inside bracketed character classes, including such
2517 constructs as C<qr/[\N{LATIN SMALL LETTER SHARP}a-z]/i>. These
2518 remaining bugs are addressed in [perl #89774].
2522 RT #78266: The regex engine has been leaking memory when accessing
2523 named captures that weren't matched as part of a regex ever since 5.10
2524 when they were introduced, e.g. this would consume over a hundred MB of
2527 for (1..10_000_000) {
2528 if ("foo" =~ /(foo|(?<capture>bar))?/) {
2529 my $capture = $+{capture}
2532 system "ps -o rss $$"'
2536 In 5.14, C</[[:lower:]]/i> and C</[[:upper:]]/i> no longer matched the
2537 opposite case. This has been fixed [perl #101970].
2541 A regular expression match with an overloaded object on the right-hand side
2542 would in some cases stringify the object too many times.
2546 A regression has been fixed that was introduced in 5.14, in C</i>
2547 regular expression matching, in which a match improperly fails if the
2548 pattern is in UTF-8, the target string is not, and a Latin-1 character
2549 precedes a character in the string that should match the pattern.
2554 In case-insensitive regular expression pattern matching, no longer on
2555 UTF-8 encoded strings does the scan for the start of match only look at
2556 the first possible position. This caused matches such as
2557 C<"f\x{FB00}" =~ /ff/i> to fail.
2561 The regexp optimiser no longer crashes on debugging builds when merging
2562 fixed-string nodes with inconvenient contents.
2566 A panic involving the combination of the regular expression modifiers
2567 C</aa> and the C<\b> escape sequence introduced in 5.14.0 has been
2568 fixed [perl #95964].
2572 The combination of the regular expression modifiers C</aa> and the C<\b>
2573 and C<\B> escape sequences did not work properly on UTF-8 encoded
2574 strings. All non-ASCII characters under C</aa> should be treated as
2575 non-word characters, but what was happening was that Unicode rules were
2576 used to determine wordness/non-wordness for non-ASCII characters. This
2577 is now fixed [perl #95968].
2581 C<< (?foo: ...) >> no longer loses passed in character set.
2585 The trie optimisation used to have problems with alternations containing
2586 an empty C<(?:)>, causing C<< "x" =~ /\A(?>(?:(?:)A|B|C?x))\z/ >> not to
2587 match, whereas it should [perl #111842].
2591 Use of lexical (C<my>) variables in code blocks embedded in regular
2592 expressions will no longer result in memory corruption or crashes.
2594 Nevertheless, these code blocks are still experimental, as there are still
2595 problems with the wrong variables being closed over (in loops for instance)
2596 and with abnormal exiting (e.g., C<die>) causing memory corruption.
2600 The C<\h>, C<\H>, C<\v> and C<\V> regular expression metacharacters used to
2601 cause a panic error message when attempting to match at the end of the
2602 string [perl #96354].
2606 The abbreviations for four C1 control characters C<MW> C<PM>, C<RI>, and
2607 C<ST> were previously unrecognized by C<\N{}>, vianame(), and
2612 Mentioning a variable named "&" other than C<$&> (i.e., C<@&> or C<%&>) no
2613 longer stops C<$&> from working. The same applies to variables named "'"
2614 and "`" [perl #24237].
2618 Creating a C<UNIVERSAL::AUTOLOAD> sub no longer stops C<%+>, C<%-> and
2619 C<%!> from working some of the time [perl #105024].
2623 =head2 Smartmatching
2629 C<~~> now correctly handles the precedence of Any~~Object, and is not tricked
2630 by an overloaded object on the left-hand side.
2634 In Perl 5.14.0, C<$tainted ~~ @array> stopped working properly. Sometimes
2635 it would erroneously fail (when C<$tainted> contained a string that occurs
2636 in the array I<after> the first element) or erroneously succeed (when
2637 C<undef> occurred after the first element) [perl #93590].
2641 =head2 The C<sort> operator
2647 C<sort> was not treating C<sub {}> and C<sub {()}> as equivalent when
2648 such a sub was provided as the comparison routine. It used to croak on
2653 C<sort> now works once more with custom sort routines that are XSUBs. It
2654 stopped working in 5.10.0.
2658 C<sort> with a constant for a custom sort routine, although it produces
2659 unsorted results, no longer crashes. It started crashing in 5.10.0.
2663 Warnings emitted by C<sort> when a custom comparison routine returns a
2664 non-numeric value now contain "in sort" and show the line number of the
2665 C<sort> operator, rather than the last line of the comparison routine. The
2666 warnings also occur now only if warnings are enabled in the scope where
2667 C<sort> occurs. Previously the warnings would occur if enabled in the
2668 comparison routine's scope.
2672 C<< sort { $a <=> $b } >>, which is optimised internally, now produces
2673 "uninitialized" warnings for NaNs (not-a-number values), since C<< <=> >>
2674 returns C<undef> for those. This brings it in line with
2675 S<C<< sort { 1; $a <=> $b } >>> and other more complex cases, which are not
2676 optimised [perl #94390].
2680 =head2 The C<substr> operator
2686 Tied (and otherwise magical) variables are no longer exempt from the
2687 "Attempt to use reference as lvalue in substr" warning.
2691 That warning now occurs when the returned lvalue is assigned to, not
2692 when C<substr> itself is called. This only makes a difference if the
2693 return value of C<substr> is referenced and assigned to later.
2697 Passing a substring of a read-only value or a typeglob to a function
2698 (potential lvalue context) no longer causes an immediate "Can't coerce"
2699 or "Modification of a read-only value" error. That error only occurs
2700 if and when the value passed is assigned to.
2702 The same thing happens with the "substr outside of string" error. If
2703 the lvalue is only read, not written to, it is now just a warning, as
2704 with rvalue C<substr>.
2708 C<substr> assignments no longer call FETCH twice if the first argument
2709 is a tied variable, just once.
2713 =head2 Support for embedded nulls
2715 Some parts of Perl did not work correctly with nulls (C<chr 0>) embedded in
2716 strings. That meant that, for instance, C<< $m = "a\0b"; foo->$m >> would
2717 call the "a" method, instead of the actual method name contained in $m.
2718 These parts of perl have been fixed to support nulls:
2728 Typeglob names (including filehandle and subroutine names)
2732 Package names, including the return value of C<ref()>
2736 Typeglob elements (C<*foo{"THING\0stuff"}>)
2744 Various warnings and error messages that mention variable names or values,
2749 One side effect of these changes is that blessing into "\0" no longer
2750 causes C<ref()> to return false.
2752 =head2 Threading bugs
2758 Typeglobs returned from threads are no longer cloned if the parent thread
2759 already has a glob with the same name. This means that returned
2760 subroutines will now assign to the right package variables [perl #107366].
2764 Some cases of threads crashing due to memory allocation during cloning have
2765 been fixed [perl #90006].
2769 Thread joining would sometimes emit "Attempt to free unreferenced scalar"
2770 warnings if C<caller> had been used from the C<DB> package prior to thread
2771 creation [perl #98092].
2775 Locking a subroutine (via C<lock &sub>) is no longer a compile-time error
2776 for regular subs. For lvalue subroutines, it no longer tries to return the
2777 sub as a scalar, resulting in strange side effects like C<ref \$_>
2778 returning "CODE" in some instances.
2780 C<lock &sub> is now a run-time error if L<threads::shared> is loaded (a
2781 no-op otherwise), but that may be rectified in a future version.
2785 =head2 Tied variables
2791 Various cases in which FETCH was being ignored or called too many times
2798 C<PerlIO::get_layers> [perl #97956]
2802 C<$tied =~ y/a/b/>, C<chop $tied> and C<chomp $tied> when $tied holds a
2807 When calling C<local $_> [perl #105912]
2811 Four-argument C<select>
2815 A tied buffer passed to C<sysread>
2823 Three-argument C<open>, the third being a tied file handle
2824 (as in C<< open $fh, ">&", $tied >>)
2828 C<sort> with a reference to a tied glob for the comparison routine.
2832 C<..> and C<...> in list context [perl #53554].
2836 C<${$tied}>, C<@{$tied}>, C<%{$tied}> and C<*{$tied}> where the tied
2837 variable returns a string (C<&{}> was unaffected)
2841 C<defined ${ $tied_variable }>
2845 Various functions that take a filehandle argument in rvalue context
2846 (C<close>, C<readline>, etc.) [perl #97482]
2850 Some cases of dereferencing a complex expression, such as
2851 C<${ (), $tied } = 1>, used to call C<FETCH> multiple times, but now call
2856 C<$tied-E<gt>method> where $tied returns a package name--even resulting in
2857 a failure to call the method, due to memory corruption
2861 Assignments like C<*$tied = \&{"..."}> and C<*glob = $tied>
2865 C<chdir>, C<chmod>, C<chown>, C<utime>, C<truncate>, C<stat>, C<lstat> and
2866 the filetest ops (C<-r>, C<-x>, etc.)
2872 C<caller> sets C<@DB::args> to the subroutine arguments when called from
2873 the DB package. It used to crash when doing so if C<@DB::args> happened to
2874 be tied. Now it croaks instead.
2878 Tying an element of %ENV or C<%^H> and then deleting that element would
2879 result in a call to the tie object's DELETE method, even though tying the
2880 element itself is supposed to be equivalent to tying a scalar (the element
2881 is, of course, a scalar) [perl #67490].
2885 When Perl autovivifies an element of a tied array or hash (which entails
2886 calling STORE with a new reference), it now calls FETCH immediately after
2887 the STORE, instead of assuming that FETCH would have returned the same
2888 reference. This can make it easier to implement tied objects [perl #35865, #43011].
2892 Four-argument C<select> no longer produces its "Non-string passed as
2893 bitmask" warning on tied or tainted variables that are strings.
2897 Localising a tied scalar that returns a typeglob no longer stops it from
2898 being tied till the end of the scope.
2902 Attempting to C<goto> out of a tied handle method used to cause memory
2903 corruption or crashes. Now it produces an error message instead
2908 A bug has been fixed that occurs when a tied variable is used as a
2909 subroutine reference: if the last thing assigned to or returned from the
2910 variable was a reference or typeglob, the C<\&$tied> could either crash or
2911 return the wrong subroutine. The reference case is a regression introduced
2912 in Perl 5.10.0. For typeglobs, it has probably never worked till now.
2916 =head2 Version objects and vstrings
2922 The bitwise complement operator (and possibly other operators, too) when
2923 passed a vstring would leave vstring magic attached to the return value,
2924 even though the string had changed. This meant that
2925 C<< version->new(~v1.2.3) >> would create a version looking like "v1.2.3"
2926 even though the string passed to C<< version->new >> was actually
2927 "\376\375\374". This also caused L<B::Deparse> to deparse C<~v1.2.3>
2928 incorrectly, without the C<~> [perl #29070].
2932 Assigning a vstring to a magic (e.g., tied, C<$!>) variable and then
2933 assigning something else used to blow away all the magic. This meant that
2934 tied variables would come undone, C<$!> would stop getting updated on
2935 failed system calls, C<$|> would stop setting autoflush, and other
2936 mischief would take place. This has been fixed.
2940 C<< version->new("version") >> and C<printf "%vd", "version"> no longer
2941 crash [perl #102586].
2945 Version comparisons, such as those that happen implicitly with C<use
2946 v5.43>, no longer cause locale settings to change [perl #105784].
2950 Version objects no longer cause memory leaks in boolean context
2955 =head2 Warnings, redefinition
2961 Subroutines from the C<autouse> namespace are once more exempt from
2962 redefinition warnings. This used to work in 5.005, but was broken in
2963 5.6 for most subroutines. For subs created via XS that redefine
2964 subroutines from the C<autouse> package, this stopped working in 5.10.
2968 New XSUBs now produce redefinition warnings if they overwrite existing
2969 subs, as they did in 5.8.x. (The C<autouse> logic was reversed in
2970 5.10-14. Only subroutines from the C<autouse> namespace would warn
2975 C<newCONSTSUB> used to use compile-time warning hints, instead of
2976 run-time hints. The following code should never produce a redefinition
2977 warning, but it used to, if C<newCONSTSUB> redefined an existing
2983 some_XS_function_that_calls_new_CONSTSUB();
2988 Redefinition warnings for constant subroutines are on by default (what
2989 are known as severe warnings in L<perldiag>). This was only the case
2990 when it was a glob assignment or declaration of a Perl subroutine that
2991 caused the warning. If the creation of XSUBs triggered the warning, it
2992 was not a default warning. This has been corrected.
2996 The internal check to see whether a redefinition warning should occur
2997 used to emit "uninitialized" warnings in cases like this:
2999 use warnings "uninitialized";
3000 use constant {u => undef, v => undef};
3006 =head2 Warnings, "Uninitialized"
3012 Various functions that take a filehandle argument in rvalue context
3013 (C<close>, C<readline>, etc.) used to warn twice for an undefined handle
3018 C<dbmopen> now only warns once, rather than three times, if the mode
3019 argument is C<undef> [perl #90064].
3023 The C<+=> operator does not usually warn when the left-hand side is
3024 C<undef>, but it was doing so for tied variables. This has been fixed
3029 A bug fix in Perl 5.14 introduced a new bug, causing "uninitialized"
3030 warnings to report the wrong variable if the operator in question had
3031 two operands and one was C<%{...}> or C<@{...}>. This has been fixed
3036 C<..> and C<...> in list context now mention the name of the variable in
3037 "uninitialized" warnings for string (as opposed to numeric) ranges.
3041 =head2 Weak references
3047 Weakening the first argument to an automatically-invoked C<DESTROY> method
3048 could result in erroneous "DESTROY created new reference" errors or
3049 crashes. Now it is an error to weaken a read-only reference.
3053 Weak references to lexical hashes going out of scope were not going stale
3054 (becoming undefined), but continued to point to the hash.
3058 Weak references to lexical variables going out of scope are now broken
3059 before any magical methods (e.g., DESTROY on a tie object) are called.
3060 This prevents such methods from modifying the variable that will be seen
3061 the next time the scope is entered.
3065 Creating a weak reference to an @ISA array or accessing the array index
3066 (C<$#ISA>) could result in confused internal bookkeeping for elements
3067 subsequently added to the @ISA array. For instance, creating a weak
3068 reference to the element itself could push that weak reference on to @ISA;
3069 and elements added after use of C<$#ISA> would be ignored by method lookup
3074 =head2 Other notable fixes
3080 C<quotemeta> now quotes consistently the same non-ASCII characters under
3081 C<use feature 'unicode_strings'>, regardless of whether the string is
3082 encoded in UTF-8 or not, hence fixing the last vestiges (we hope) of the
3083 infamous L<perlunicode/The "Unicode Bug">. [perl #77654].
3085 Which of these code points is quoted has changed, based on Unicode's
3086 recommendations. See L<perlfunc/quotemeta> for details.
3090 When one writes C<open foo || die>, which used to work in Perl 4, a
3091 "Precedence problem" warning is produced. This warning used erroneously to
3092 apply to fully-qualified bareword handle names not followed by C<||>. This
3097 After package aliasing (C<*foo:: = *bar::>), C<select> with 0 or 1 argument
3098 would sometimes return a name that could not be used to refer to the
3099 filehandle, or sometimes it would return C<undef> even when a filehandle
3100 was selected. Now it returns a typeglob reference in such cases.
3104 C<PerlIO::get_layers> no longer ignores some arguments that it thinks are
3105 numeric, while treating others as filehandle names. It is now consistent
3106 for flat scalars (i.e., not references).
3110 Unrecognised switches on C<#!> line
3112 If a switch, such as B<-x>, that cannot occur on the C<#!> line is used
3113 there, perl dies with "Can't emulate...".
3115 It used to produce the same message for switches that perl did not
3116 recognise at all, whether on the command line or the C<#!> line.
3118 Now it produces the "Unrecognized switch" error message [perl #104288].
3122 C<system> now temporarily blocks the SIGCHLD signal handler, to prevent the
3123 signal handler from stealing the exit status [perl #105700].
3127 The %n formatting code for C<printf> and C<sprintf>, which causes the number
3128 of characters to be assigned to the next argument, now actually
3129 assigns the number of characters, instead of the number of bytes.
3131 It also works now with special lvalue functions like C<substr> and with
3132 nonexistent hash and array elements [perl #3471, #103492].
3136 Perl skips copying values returned from a subroutine, for the sake of
3137 speed, if doing so would make no observable difference. Due to faulty
3138 logic, this would happen with the
3139 result of C<delete>, C<shift> or C<splice>, even if the result was
3140 referenced elsewhere. It also did so with tied variables about to be freed
3141 [perl #91844, #95548].
3145 C<utf8::decode> now refuses to modify read-only scalars [perl #91850].
3149 Freeing $_ inside a C<grep> or C<map> block, a code block embedded in a
3150 regular expression, or an @INC filter (a subroutine returned by a
3151 subroutine in @INC) used to result in double frees or crashes
3152 [perl #91880, #92254, #92256].
3156 C<eval> returns C<undef> in scalar context or an empty list in list
3157 context when there is a run-time error. When C<eval> was passed a
3158 string in list context and a syntax error occurred, it used to return a
3159 list containing a single undefined element. Now it returns an empty
3160 list in list context for all errors [perl #80630].
3164 C<goto &func> no longer crashes, but produces an error message, when
3165 the unwinding of the current subroutine's scope fires a destructor that
3166 undefines the subroutine being "goneto" [perl #99850].
3170 Perl now holds an extra reference count on the package that code is
3171 currently compiling in. This means that the following code no longer
3172 crashes [perl #101486]:
3175 BEGIN {*Foo:: = *Bar::}
3180 The C<x> repetition operator no longer crashes on 64-bit builds with large
3181 repeat counts [perl #94560].
3185 Calling C<require> on an implicit C<$_> when C<*CORE::GLOBAL::require> has
3186 been overridden does not segfault anymore, and C<$_> is now passed to the
3187 overriding subroutine [perl #78260].
3191 C<use> and C<require> are no longer affected by the I/O layers active in
3192 the caller's scope (enabled by L<open.pm|open>) [perl #96008].
3196 C<our $::é; $é> (which is invalid) no longer produces the "Compilation
3197 error at lib/utf8_heavy.pl..." error message, which it started emitting in
3198 5.10.0 [perl #99984].
3202 On 64-bit systems, C<read()> now understands large string offsets beyond
3207 Errors that occur when processing subroutine attributes no longer cause the
3208 subroutine's op tree to leak.
3212 Passing the same constant subroutine to both C<index> and C<formline> no
3213 longer causes one or the other to fail [perl #89218]. (5.14.1)
3217 List assignment to lexical variables declared with attributes in the same
3218 statement (C<my ($x,@y) : blimp = (72,94)>) stopped working in Perl 5.8.0.
3219 It has now been fixed.
3223 Perl 5.10.0 introduced some faulty logic that made "U*" in the middle of
3224 a pack template equivalent to "U0" if the input string was empty. This has
3225 been fixed [perl #90160].
3229 Destructors on objects were not called during global destruction on objects
3230 that were not referenced by any scalars. This could happen if an array
3231 element were blessed (e.g., C<bless \$a[0]>) or if a closure referenced a
3232 blessed variable (C<bless \my @a; sub foo { @a }>).
3234 Now there is an extra pass during global destruction to fire destructors on
3235 any objects that might be left after the usual passes that check for
3236 objects referenced by scalars [perl #36347].
3240 Fixed a case where it was possible that a freed buffer may have been read
3241 from when parsing a here document [perl #90128]. (5.14.1)
3245 C<each(I<ARRAY>)> is now wrapped in C<defined(...)>, like C<each(I<HASH>)>,
3246 inside a C<while> condition [perl #90888].
3250 A problem with context propagation when a C<do> block is an argument to
3251 C<return> has been fixed. It used to cause C<undef> to be returned in
3252 some cases of a C<return> inside an C<if> block which itself is followed by
3257 Calling C<index> with a tainted constant no longer causes constants in
3258 subsequently compiled code to become tainted [perl #64804].
3262 Infinite loops like C<1 while 1> used to stop C<strict 'subs'> mode from
3263 working for the rest of the block.t
3267 For list assignments like C<($a,$b) = ($b,$a)>, Perl has to make a copy of
3268 the items on the right-hand side before assignment them to the left. For
3269 efficiency's sake, it assigns the values on the right straight to the items
3270 on the left if no one variable is mentioned on both sides, as in C<($a,$b) =
3271 ($c,$d)>. The logic for determining when it can cheat was faulty, in that
3272 C<&&> and C<||> on the right-hand side could fool it. So C<($a,$b) =
3273 $some_true_value && ($b,$a)> would end up assigning the value of C<$b> to
3278 Perl no longer tries to apply lvalue context to the string in
3279 C<("string", $variable) ||= 1> (which used to be an error). Since the
3280 left-hand side of C<||=> is evaluated in scalar context, that's a scalar
3281 comma operator, which gives all but the last item void context. There is
3282 no such thing as void lvalue context, so it was a mistake for Perl to try
3283 to force it [perl #96942].
3287 C<caller> no longer leaks memory when called from the DB package if
3288 C<@DB::args> was assigned to after the first call to C<caller>. L<Carp>
3289 was triggering this bug [perl #97010].
3293 C<close> and similar filehandle functions, when called on built-in global
3294 variables (like C<$+>), used to die if the variable happened to hold the
3295 undefined value, instead of producing the usual "Use of uninitialized
3300 When autovivified file handles were introduced in Perl 5.6.0, C<readline>
3301 was inadvertently made to autovivify when called as C<readline($foo)> (but
3302 not as C<E<lt>$fooE<gt>>). It has now been fixed never to autovivify.
3306 Calling an undefined anonymous subroutine (e.g., what $x holds after
3307 C<undef &{$x = sub{}}>) used to cause a "Not a CODE reference" error, which
3308 has been corrected to "Undefined subroutine called" [perl #71154].
3312 Causing C<@DB::args> to be freed between uses of C<caller> no longer
3313 results in a crash [perl #93320].
3317 C<setpgrp($foo)> used to be equivalent to C<($foo, setpgrp)>, because
3318 C<setpgrp> was ignoring its argument if there was just one. Now it is
3319 equivalent to C<setpgrp($foo,0)>.
3323 C<shmread> was not setting the scalar flags correctly when reading from
3324 shared memory, causing the existing cached numeric representation in the
3325 scalar to persist [perl #98480].
3329 C<++> and C<--> now work on copies of globs, instead of dying.
3333 C<splice()> doesn't warn when truncating
3335 You can now limit the size of an array using C<splice(@a,MAX_LEN)> without
3336 worrying about warnings.
3340 C<< $$ >> is no longer tainted. Since this value comes directly from
3341 C<< getpid() >>, it is always safe.
3345 The parser no longer leaks a filehandle if STDIN was closed before parsing
3346 started [perl #37033].
3350 C<< die; >> with a non-reference, non-string, or magical (e.g., tainted)
3351 value in $@ now properly propagates that value [perl #111654].
3355 =head1 Known Problems
3361 On Solaris, we have two kinds of failure.
3363 If F<make> is Sun's F<make≥>, we get an error about a badly formed macro
3364 assignment in the F<Makefile>. That happens when F<./Configure> tries to
3365 make depends. F<Configure> then exits 0, but further F<make>-ing fails.
3367 If F<make> is F<gmake>, F<Configure> completes, then we get errors related
3368 to F</usr/include/stdbool.h>
3372 The following CPAN modules have test failures with perl 5.16. Patches have
3373 been submitted for all of these, so hopefully there will be new releases
3380 L<Date::Pcalc> version 6.1
3384 L<Module::CPANTS::Analyse> version 0.85
3386 This fails due to problems in L<Module::Find> 0.10 and L<File::MMagic>
3391 L<PerlIO::Util> version 0.72
3397 =head1 Acknowledgements
3399 XXX Generate this with:
3401 perl Porting/acknowledgements.pl v5.14.0..HEAD
3403 =head1 Reporting Bugs
3405 If you find what you think is a bug, you might check the articles
3406 recently posted to the comp.lang.perl.misc newsgroup and the perl
3407 bug database at L<http://rt.perl.org/perlbug/>. There may also be
3408 information at L<http://www.perl.org/>, the Perl Home Page.
3410 If you believe you have an unreported bug, please run the L<perlbug>
3411 program included with your release. Be sure to trim your bug down
3412 to a tiny but sufficient test case. Your bug report, along with the
3413 output of C<perl -V>, will be sent off to perlbug@perl.org to be
3414 analysed by the Perl porting team.
3416 If the bug you are reporting has security implications, which make it
3417 inappropriate to send to a publicly archived mailing list, then please
3418 send it to perl5-security-report@perl.org. This points to a closed
3419 subscription unarchived mailing list, which includes all the core
3420 committers, who will be able to help assess the impact of issues, figure
3421 out a resolution, and help co-ordinate the release of patches to
3422 mitigate or fix the problem across all platforms on which Perl is
3423 supported. Please only use this address for security issues in the Perl
3424 core, not for modules independently distributed on CPAN.
3428 The F<Changes> file for an explanation of how to view exhaustive details
3431 The F<INSTALL> file for how to build Perl.
3433 The F<README> file for general stuff.
3435 The F<Artistic> and F<Copying> files for copyright information.