5 perldelta - what is new for perl v5.27.6
9 This document describes differences between the 5.27.5 release and the 5.27.6
12 If you are upgrading from an earlier release such as 5.27.4, first read
13 L<perl5275delta>, which describes differences between 5.27.4 and 5.27.5.
15 =head1 Core Enhancements
17 =head2 Initialisation of aggregate state variables
19 A persistent lexical array or hash variable can now be initialized,
20 by an expression such as C<state @a = qw(x y z)>. Initialization of a
21 list of persistent lexical variables is still not possible.
23 =head2 Full-size inode numbers
25 On platforms where inode numbers are of a type larger than perl's native
26 integer numerical types, L<stat|perlfunc/stat> will preserve the full
27 content of large inode numbers by returning them in the form of strings of
28 decimal digits. Exact comparison of inode numbers can thus be achieved by
29 comparing with C<eq> rather than C<==>. Comparison with C<==>, and other
30 numerical operations (which are usually meaningless on inode numbers),
31 work as well as they did before, which is to say they fall back to
32 floating point, and ultimately operate on a fairly useless rounded inode
33 number if the real inode number is too big for the floating point format.
35 =head1 Incompatible Changes
37 =head2 Yada-yada is now strictly a statement
39 By the time of its initial stable release in Perl 5.12, the C<...>
40 (yada-yada) operator was explicitly intended to serve as a statement,
41 not an expression. However, the original implementation was confused
42 on this point, leading to inconsistent parsing. The operator was
43 accidentally accepted in a few situations where it did not serve as a
44 complete statement, such as
49 The parsing has now been made consistent, permitting yada-yada only as
50 a statement. Affected code can use C<do{...}> to put a yada-yada into
51 an arbitrary expression context.
53 =head2 Subroutines no longer need typeglobs
55 Perl 5.22.0 introduced an optimization allowing subroutines to be stored in
56 packages as simple sub refs, not requiring a full typeglob (thus
57 potentially saving large amounts of memeory). However, the optimization
58 was flawed: it only applied to the main package.
60 This optimization has now been extended to all packages. This may break
61 compatibility with introspection code that looks inside stashes and expects
62 everything in them to be a typeglob.
64 When this optimization happens, the typeglob still notionally exists, so
65 accessing it will cause the stash entry to be upgraded to a typeglob. The
66 optimization does not apply to XSUBs or exported subroutines, and calling a
67 method will undo it, since method calls cache things in typeglobs.
69 (This change actually happened in perl 5.27.5 but was omitted from its perldelta.)
71 [perl #129916] [perl #132252]
73 =head2 Sort algorithm can no longer be specified
75 Since Perl 5.8, the L<sort> pragma has had subpragmata C<_mergesort>,
76 C<_quicksort>, and C<_qsort> that can be used to specify which algorithm
77 perl should use to implement the L<sort|perlfunc/sort> builtin.
78 This was always considered a dubious feature that might not last,
79 hence the underscore spellings, and they were documented as not being
80 portable beyond Perl 5.8. These subpragmata have now been deleted,
81 and any attempt to use them is an error. The L<sort> pragma otherwise
82 remains, and the algorithm-neutral C<stable> subpragma can be used to
83 control sorting behaviour.
86 =head1 Performance Enhancements
92 Many string concatenation expressions are now considerably faster, due
93 to the introduction internally of a C<multiconcat> opcode which combines
94 multiple concatenations, and optionally a C<=> or C<.=>, into a single
95 action. For example, apart from retrieving C<$s>, C<$a> and C<$b>, this
96 whole expression is now handled as a single op:
100 As a special case, if the LHS of an assignment is a lexical variable or
101 C<my $s>, the op itself handles retrieving the lexical variable, which
104 In general, the more the expression includes a mix of constant strings and
105 variable expressions, the longer the expression, and the more it mixes
106 together non-utf8 and utf8 strings, the more marked the performance
107 improvement. For example on a C<x86_64> system, this code has been
108 benchmarked running four times faster:
111 my $a = "ab\x{100}cde";
113 my $c = "\x{101}klmn";
115 for my $i (1..10_000_000) {
117 $s .= "foo=$a bar=$b baz=$c";
120 In addition, C<sprintf> expressions which have a constant format
121 containing only C<%s> and C<%%> format elements, and which have a fixed
122 number of arguments, are now also optimised into a C<multiconcat> op.
126 Subroutines in packages no longer need to be stored in typeglobs, saving
127 large amounts of memory. See L</Subroutines no longer need typeglobs>
128 under L</Incompatible Changes>, above.
132 =head1 Modules and Pragmata
134 Key highlights in this release across several modules:
136 =head2 Removal of use vars
138 The usage of C<use vars> has been discouraged since the introduction of C<our> in
139 Perl 5.6.0. Where possible the usage of this pragma has now been removed from
140 the Perl source code.
142 This had a slight effect (for the better) on the output of WARNING_BITS in B::Deparse.
144 =head2 Use of DynaLoader changed to XSLoader in many modules
146 XSLoader is more modern, and most modules already require perl 5.6 or greater, so
147 no functionality is lost by switching. In some cases, we have also made changes to
148 the local implementation that may not be reflected in the version on CPAN due
149 to a desire to maintain more backwards compatibility.
151 =head2 Updated Modules and Pragmata
157 L<Attribute::Handlers> has been upgraded from version 1.00 to 1.01.
161 L<attributes> has been upgraded from version 0.31 to 0.32.
165 L<B> has been upgraded from version 1.70 to 1.72.
169 L<B::Concise> has been upgraded from version 1.002 to 1.003.
173 L<B::Deparse> has been upgraded from version 1.43 to 1.45.
177 L<base> has been upgraded from version 2.26 to 2.27.
181 L<blib> has been upgraded from version 1.06 to 1.07.
185 L<Carp> has been upgraded from version 1.43 to 1.44.
187 If a package on the call stack contains a constant named C<ISA>, Carp no
188 longer throws a "Not a GLOB reference" error.
192 L<Compress::Raw::Zlib> has been upgraded from version 2.074 to 2.075.
194 This addresses a security vulnerability in older versions of the 'zlib' library
195 (which is bundled with Compress-Raw-Zlib).
199 L<Config::Extensions> has been upgraded from version 0.01 to 0.02.
203 L<Devel::PPPort> has moved from cpan-first to perl-first maintenance
205 Primary responsibility for the code in Devel::PPPort has moved into core perl.
206 In a practical sense there should be no change except that hopefully it will
207 stay more up to date with changes made to symbols in perl, rather than needing
208 to be updated after the fact.
212 L<DynaLoader> has been upgraded from version 1.42 to 1.44.
216 L<experimental> has been upgraded from version 0.016 to 0.017.
220 L<ExtUtils::CBuilder> has been upgraded from version 0.280228 to 0.280229.
224 L<ExtUtils::Embed> has been upgraded from version 1.34 to 1.35.
228 L<ExtUtils::Miniperl> has been upgraded from version 1.06 to 1.07.
232 L<ExtUtils::ParseXS> has been upgraded from version 3.35 to 3.36.
236 L<ExtUtils::Typemaps> has been upgraded from version 3.35 to 3.36.
240 L<ExtUtils::XSSymSet> has been upgraded from version 1.3 to 1.4.
244 L<fields> has been upgraded from version 2.23 to 2.24.
248 L<File::Copy> has been upgraded from version 2.32 to 2.33. It will now use
249 Time::HiRes utime where available (perl #132401).
253 L<File::Spec> has been upgraded from version 3.68 to 3.70.
257 L<File::stat> has been upgraded from version 1.07 to 1.08.
261 L<FileCache> has been upgraded from version 1.09 to 1.10.
265 L<Filter::Simple> has been upgraded from version 0.94 to 0.95.
269 L<Hash::Util::FieldHash> has been upgraded from version 1.19 to 1.20.
273 L<I18N::Langinfo> has been upgraded from version 0.14 to 0.15.
277 L<I18N::LangTags> has been upgraded from version 0.42 to 0.43.
281 The libnet distribution has been upgraded from version 3.10 to 3.11.
285 L<Locale::Maketext> has been upgraded from version 1.28 to 1.29.
289 L<Module::CoreList> has been upgraded from version 5.20171020 to 5.20171120.
293 L<Net::Ping> has been upgraded from version 2.55 to 2.62.
297 L<ODBM_File> has been upgraded from version 1.14 to 1.15.
301 L<Opcode> has been upgraded from version 1.40 to 1.41.
305 L<Pod::Html> has been upgraded from version 1.2202 to 1.2203.
309 L<POSIX> has been upgraded from version 1.78 to 1.80.
313 L<re> has been upgraded from version 0.35 to 0.36.
317 L<SelfLoader> has been upgraded from version 1.24 to 1.25.
321 L<Socket> has been upgraded from version 2.020_03 to 2.020_04.
325 L<sort> has been upgraded from version 2.03 to 2.04.
329 L<Storable> has been upgraded from version 2.64 to 2.65.
333 L<Test> has been upgraded from version 1.30 to 1.31.
337 L<Test::Simple> has been upgraded from version 1.302103 to 1.302111.
341 L<threads> has been upgraded from version 2.18 to 2.19.
345 L<Tie::Array> has been upgraded from version 1.06 to 1.07.
349 L<Tie::StdHandle> has been upgraded from version 4.4 to 4.5.
353 L<Time::gmtime> has been upgraded from version 1.03 to 1.04.
357 L<Time::HiRes> has been upgraded from version 1.9746 to 1.9747.
361 L<Time::localtime> has been upgraded from version 1.02 to 1.03.
365 L<Unicode::Collate> has been upgraded from version 1.19 to 1.23.
369 L<Unicode::Normalize> has been upgraded from version 1.25 to 1.26.
373 L<User::grent> has been upgraded from version 1.01 to 1.02.
377 L<User::pwent> has been upgraded from version 1.00 to 1.01.
381 L<VMS::DCLsym> has been upgraded from version 1.08 to 1.09.
385 L<VMS::Stdio> has been upgraded from version 2.42 to 2.44.
389 L<warnings> has been upgraded from version 1.37 to 1.38.
393 L<XS::Typemap> has been upgraded from version 0.15 to 0.16.
397 L<XSLoader> has been upgraded from version 0.27 to 0.28.
403 =head2 Changes to Existing Documentation
405 We have attempted to update the documentation to reflect the changes
406 listed in this document. If you find any we have missed, send email
407 to L<perlbug@perl.org|mailto:perlbug@perl.org>.
409 Additionally, the following selected changes have been made:
413 =item * L<perldiag/Variable length lookbehind not implemented in regex m/%s/>
415 This now gives more ideas as to workarounds to the issue that was
416 introduced in Perl 5.18 (but not documented explicitly in its perldelta)
417 for the fact that some Unicode C</i> rules cause a few sequences such as
421 to be considered variable length, and hence disallowed.
423 =item * "Use of state $_ is experimental" in L<perldiag>
425 This entry has been removed, as the experimental support of this construct was
426 removed in perl 5.24.0.
430 The section on reference counting in L<perlguts> has been heavily revised,
431 to describe references in the way a programmer needs to think about them
432 rather than in terms of the physical data structures.
436 The section "Truth and Falsehood" in L<perlsyn> has been removed from
437 that document, where it didn't belong, and merged into the existing
438 paragraph on the same topic in L<perldata>.
442 The description of the C<x> operator in L<perlop> has been clarified. [perl #132460]
446 L<perluniprops> has been updated to note that C<\p{Word}> now includes
447 code points matching the C<\p{Join_Control}> property. The change to
448 the property was made in Perl 5.18, but not documented until now. There
449 are currently only two code points that match this property U+200C (ZERO
450 WIDTH NON-JOINER) and U+200D (ZERO WIDTH JOINER).
454 The entry for C<$+> in perlvar has been expanded upon to describe handling of
455 multiply-named capturing groups.
459 L<perlop> has been updated to note that C<qw>'s whitespace rules differ from that of
460 C<split>'s in that only ASCII whitespace is used.
464 L<POSIX> has been updated with some more cautions about using locale-specific
465 functions in threaded applications.
471 The following additions or changes have been made to diagnostic output,
472 including warnings and fatal error messages. For the complete list of
473 diagnostic messages, see L<perldiag>.
475 =head2 Changes to Existing Diagnostics
481 The diagnostic C<Initialization of state variables in list context
482 currently forbidden> has changed to C<Initialization of state variables
483 in list currently forbidden>, because list-context initialization of
484 single aggregate state variables is now permitted.
488 =head1 Utility Changes
496 C<--help> and C<--version> options have been added.
500 =head1 Configuration and Compilation
504 =item C89 requirement
506 Perl has been documented as requiring a C89 compiler to build since October
507 1998. A variety of simplifications have now been made to Perl's internals to
508 rely on the features specified by the C89 standard. We believe that this
509 internal change hasn't altered the set of platforms that Perl builds on, but
510 please report a bug if Perl now has new problems building on your platform.
516 =item HAS_BUILTIN_ADD_OVERFLOW
518 =item HAS_BUILTIN_MUL_OVERFLOW
520 =item HAS_BUILTIN_SUB_OVERFLOW
522 =item HAS_THREAD_SAFE_NL_LANGINFO_L
524 =item HAS_LOCALECONV_L
546 For the past few years we have released perl using three different archive
547 formats: bzip (C<.bz2>), LZMA2 (C<.xz>) and gzip (C<.gz>). Since xz compresses
548 better and decompresses faster, and gzip is more compatible and uses less memory,
549 we have dropped the C<.bz2> archive format with this release.
550 (If this poses a problem, do let us know; see L</Reporting Bugs>, below.)
552 =head1 Platform Support
554 =head2 Discontinued Platforms
558 =item PowerUX / Power MAX OS
560 Compiler hints and other support for these apparently long-defunct platforms has been removed.
564 =head2 Platform-Specific Notes
570 Visual C++ compiler version detection has been improved to work on non-English
575 =head1 Internal Changes
581 A new optimisation phase has been added to the compiler,
582 C<optimize_optree()>, which does a top-down scan of a complete optree
583 just before the peephole optimiser is run. This phase is not currently
588 An C<OP_MULTICONCAT> op has been added. At C<optimize_optree()> time, a
589 chain of C<OP_CONCAT> and C<OP_CONST> ops, together optionally with an
590 C<OP_STRINGIFY> and/or C<OP_SASSIGN>, are combined into a single
591 C<OP_MULTICONCAT> op. The op is of type C<UNOP_AUX>, and the aux array
592 contains the argument count, plus a pointer to a constant string and a set
593 of segment lengths. For example with
595 my $x = "foo=$foo, bar=$bar\n";
597 the constant string would be C<"foo=, bar=\n"> and the segment lengths
598 would be (4,6,1). If the string contains characters such as C<\x80>, whose
599 representation changes under utf8, two sets of strings plus lengths are
600 precomputed and stored.
604 Direct access to L<C<PL_keyword_plugin>|perlapi/PL_keyword_plugin> is not
605 safe in the presence of multithreading. A new
606 L<C<wrap_keyword_plugin>|perlapi/wrap_keyword_plugin> function has been
607 added to allow XS modules to safely define custom keywords even when
608 loaded from a thread, analogous to L<C<PL_check>|perlapi/PL_check> /
609 L<C<wrap_op_checker>|perlapi/wrap_op_checker>.
613 =head1 Selected Bug Fixes
619 C<stat()>, C<lstat()>, and file test operators now fail if given a
620 filename containing a nul character, in the same way that C<open()>
625 C<stat()>, C<lstat()>, and file test operators now reliably set C<$!> when
626 failing due to being applied to a closed or otherwise invalid file handle.
630 File test operators for Unix permission bits that don't exist on a
631 particular platform, such as C<-k> (sticky bit) on Windows, now check that
632 the file being tested exists before returning the blanket false result,
633 and yield the appropriate errors if the argument doesn't refer to a file.
637 The in-place reverse optimisation now correctly strengthens weak
638 references using the L<C<sv_rvunweaken()>|perlapi/sv_rvunweaken>
643 Fixed a read before buffer when parsing a range starting with C<\N{}>
644 at the beginning of the character set for the transliteration
645 operator. [perl #132245]
649 Fixed a leaked SV when parsing an empty C<\N{}> at compile-time.
654 Calling C<do $path> on a directory or block device now yields a meaningful
655 error code in C<$!>. [perl #125774]
659 Regexp substitution using an overloaded replacement value that provides
660 a tainted stringification now correctly taints the resulting string.
665 Lexical sub declarations in C<do> blocks such as C<do { my sub lex; 123 }>
666 could corrupt the stack, erasing items already on the stack in the
667 enclosing statement. This has been fixed. [perl #132442]
671 =head1 Errata From Previous Releases
677 L</Subroutines no longer need typeglobs> under L</Incompatible Changes>, above,
678 was made for perl 5.27.5 but was mistakenly omitted from its perldelta.
682 =head1 Acknowledgements
684 XXX Generate this with:
686 perl Porting/acknowledgements.pl v5.27.5..HEAD
688 =head1 Reporting Bugs
690 If you find what you think is a bug, you might check the perl bug database
691 at L<https://rt.perl.org/> . There may also be information at
692 L<http://www.perl.org/> , the Perl Home Page.
694 If you believe you have an unreported bug, please run the L<perlbug> program
695 included with your release. Be sure to trim your bug down to a tiny but
696 sufficient test case. Your bug report, along with the output of C<perl -V>,
697 will be sent off to perlbug@perl.org to be analysed by the Perl porting team.
699 If the bug you are reporting has security implications which make it
700 inappropriate to send to a publicly archived mailing list, then see
701 L<perlsec/SECURITY VULNERABILITY CONTACT INFORMATION>
702 for details of how to report the issue.
706 If you wish to thank the Perl 5 Porters for the work we had done in Perl 5,
707 you can do so by running the C<perlthanks> program:
711 This will send an email to the Perl 5 Porters list with your show of thanks.
715 The F<Changes> file for an explanation of how to view exhaustive details on
718 The F<INSTALL> file for how to build Perl.
720 The F<README> file for general stuff.
722 The F<Artistic> and F<Copying> files for copyright information.