5 perl5217delta - what is new for perl v5.21.7
9 This document describes differences between the 5.21.6 release and the 5.21.7
12 If you are upgrading from an earlier release such as 5.21.5, first read
13 L<perl5216delta>, which describes differences between 5.21.5 and 5.21.6.
15 =head1 Core Enhancements
17 =head2 faster array and hash lookups
19 Array and hash lookups (especially nested ones) that use only constants
20 or simple variables as keys, are now considerably faster. See
21 L</Internal Changes> for more details.
23 =head2 C<fileno> now works on directory handles
25 When the relevant support is available in the operating system, the
26 C<fileno> builtin now works on directory handles, yielding the
27 underlying file descriptor in the same way as for filehandles. On
28 operating systems without such support, C<fileno> on a directory handle
29 continues to return the undefined value, as before, but also sets C<$!> to
30 indicate that the operation is not supported.
32 Currently, this uses either a C<dd_fd> member in the OS C<DIR>
33 structure, or a dirfd(3) function as specified by POSIX.1-2008.
35 =head1 Incompatible Changes
37 =head2 C<&> and C<\&> prototypes accepts only subs
39 The C<&> prototype character now accepts only anonymous subs (C<sub {...}>)
40 and things beginning with C<\&>. Formerly it erroneously also allowed
41 C<undef> and references to array, hashes, and lists. [perl #4539]
44 The C<\&> prototype was allowing subroutine calls, whereas now it only
45 allows subroutines. C<&foo> is permitted. C<&foo()> and C<foo()> are not.
48 =head2 C<use encoding> is now lexical
50 The L<encoding> pragma's effect is now limited to lexical scope. This
51 pragma is deprecated, but in the meantime, it could adversely affect
52 unrelated modules that are included in the same program.
54 =head2 List slices returning empty lists
56 List slices return an empty list now only if the original list was empty
57 (or if there are no indices). Formerly, a list slice would return an empty
58 list if all indices fell outside the original list. [perl #114498]
62 =head2 Setting C<${^ENCODING}> to anything but C<undef>
64 This variable allows Perl scripts to be written in a non-ASCII,
65 non-UTF-8 encoding. However, it affects all modules globally, leading
66 to wrong answers and segmentation faults. New scripts should be written
67 in UTF-8; old scripts should be converted to UTF-8, which is easily done
68 with the L<encoding> pragma.
70 =head1 Performance Enhancements
76 Win32 Perl uses 8 KB less of per-process memory than before for every perl
77 process of this version. This data is now memory mapped from disk and shared
78 between perl processes from the same perl binary.
82 If method and class names are known at compile time, hashes are precomputed
83 to speed up run-time method lookup. Also, compound method names like
84 C<SUPER::new> are parsed at compile time, to save having to parse them at
89 =head1 Modules and Pragmata
91 =head2 Updated Modules and Pragmata
97 The PathTools module collection has been upgraded from 3.52 to 3.53.
99 Don't turn leading C<//> into C</> on Cygwin. [perl #122635]
103 L<Archive::Tar> has been upgraded from version 2.02 to 2.04.
107 L<arybase> has been upgraded from version 0.08 to 0.09.
111 L<B> has been upgraded from version 1.53 to 1.54.
113 Nulled COPs are now of class C<B::COP>, rather than C<B::OP>.
115 B::REGEXP objects now provide a C<qr_anoncv> method for accessing the
116 implicit CV associated with C<qr//> things containing code blocks, and a
117 C<compflags> method that returns the pertinent flags originating from the
120 B::PMOP now provides a C<pmregexp> method returning a B::REGEXP object.
122 Two new classes, B::PADNAME and B::PADNAMELIST, have been introduced.
126 L<B::Concise> has been upgraded from version 0.995 to 0.996.
130 L<B::Deparse> has been upgraded from version 1.30 to 1.31.
132 BEGIN blocks at the end of the enclosing scope are now deparsed in the
133 right place. [perl #77452]
135 BEGIN blocks were sometimes deparsed as __ANON__, but are now always called
138 Lexical subroutines are now fully deparsed. [perl #116553]
140 Deparsing of C<$lexical =~ //> was accidentally broken in 1.30 (perl
141 5.21.6), omitting the C<$lexical =~>, but has now been fixed.
143 C<Anything =~ y///r> with C</r> no longer omits the left-hand operand.
145 The op trees that make up regexp code blocks are now deparsed for real.
146 Formerly, the original string that made up the regular expression was used.
147 That caused problems with C<qr/(?{E<lt>E<lt>heredoc})/> and multiline code blocks,
148 which were deparsed incorrectly. [perl #123217] [perl #115256]
150 C<$;> at the end of a statement no longer loses its semicolon.
153 Some cases of subroutine declarations stored in the stash in shorthand form
156 Non-ASCII characters are now consistently escaped in strings, instead of
157 some of the time. (There are still outstanding problems with regular
158 expressions and identifiers that have not been fixed.)
160 When prototype sub calls are deparsed with C<&> (e.g., under the B<-P>
161 option), C<scalar> is now added where appropriate, to force the scalar
162 context implied by the prototype.
164 C<require(foo())>, C<do(foo())>, C<goto(foo())> and similar constructs with
165 loop controls are now deparsed correctly. The outer parentheses are not
168 Whitespace is no longer escaped in regular expressions, because it was
169 getting erroneously escaped within C<(?x:...)> sections.
171 C<sub foo { foo() }> is now deparsed with those mandatory parentheses.
173 C</@array/> is now deparsed as a regular expression, and not just
176 C</@{-}/>, C</@{+}/> and C<$#{1}> are now deparsed with the braces, which
177 are mandatory in these cases.
179 In deparsing feature bundles, B::Deparse was emitting C<no feature;> first
180 instead of C<no feature ':all';>. This has been fixed.
182 C<chdir FH> is now deparsed without quotation marks.
184 C<\my @a> is now deparsed without parentheses. (Parenthese would flatten
187 C<system> and C<exec> followed by a block are now deparsed correctly.
188 Formerly there was an erroneous C<do> before the block.
190 C<< use constant QR =E<gt> qr/.../flags >> followed by C<"" =~ QR> is no longer
195 L<charnames> has been upgraded from version 1.41 to 1.43.
199 L<Compress::Raw::Bzip2> has been upgraded from version 2.066 to 2.067.
203 L<Compress::Raw::Zlib> has been upgraded from version 2.066 to 2.067.
207 L<Data::Dumper> has been upgraded from version 2.154 to 2.155.
211 L<DB_File> has been upgraded from version 1.831 to 1.834.
215 L<Devel::Peek> has been upgraded from version 1.19 to 1.20.
219 L<Devel::PPPort> has been upgraded from version 3.24 to 3.25.
223 L<DynaLoader> has been upgraded from version 1.28 to 1.29.
227 L<Encode> has been upgraded from version 2.64 to 2.67.
231 L<Errno> has been upgraded from version 1.21 to 1.22.
235 L<ExtUtils::CBuilder> has been upgraded from version 0.280220 to 0.280221.
239 L<ExtUtils::MakeMaker> has been upgraded from version 7.02 to 7.04.
243 L<ExtUtils::ParseXS> has been upgraded from version 3.26 to 3.27.
245 Only declare C<file> unused if we actually define it.
247 Improve generated C<RETVAL> code generation to avoid repeated
248 references to C<ST(0)>. [perl #123278]
250 Broaden and document the C</OBJ$/> to C</REF$/> typemap optimization
251 for the C<DESTROY> method. [perl #123418]
255 L<feature> has been upgraded from version 1.38 to 1.39.
259 L<File::Spec> has been upgraded from version 3.51 to 3.54.
263 L<Filter::Util::Call> has been upgraded from version 1.49 to 1.51.
267 L<HTTP::Tiny> has been upgraded from version 0.051 to 0.053.
271 L<IO> has been upgraded from version 1.34 to 1.35.
275 The IO::Compress module collection has been upgraded from version 2.066 to 2.067.
279 L<IO::Socket::IP> has been upgraded from version 0.32 to 0.34.
283 L<Locale::Codes> has been upgraded from version 3.32 to 3.33.
287 L<Locale::Maketext> has been upgraded from version 1.25 to 1.26.
291 L<Module::CoreList> has been upgraded from version 5.20141120 to 5.20141220.
295 L<mro> has been upgraded from version 1.16 to 1.17.
299 L<NDBM_File> has been upgraded from version 1.13 to 1.14.
303 L<Opcode> has been upgraded from version 1.29 to 1.30.
307 L<PerlIO::scalar> has been upgraded from version 0.20 to 0.21.
309 Reading from a position well past the end of the scalar now correctly
310 returns end of file. [perl #123443]
312 Seeking to a negative position still fails, but no longer leaves the
313 file position set to a negation location.
315 C<eof()> on a C<PerlIO::scalar> handle now properly returns true when
316 the file position is past the 2GB mark on 32-bit systems.
320 L<Pod::Escapes> has been upgraded from version 1.06 to 1.07.
324 L<POSIX> has been upgraded from version 1.46 to 1.48.
328 L<SDBM_File> has been upgraded from version 1.11 to 1.12.
332 L<Storable> has been upgraded from version 2.51 to 2.52.
336 L<strict> has been upgraded from version 1.08 to 1.09.
340 L<Sys::Hostname> has been upgraded from version 1.19 to 1.20.
344 L<Test::Simple> has been upgraded from version 1.301001_075 to 1.301001_090.
348 L<threads> has been upgraded from version 1.96 to 1.96_001.
352 L<Unicode::Collate> has been upgraded from version 1.07 to 1.09.
356 L<XSLoader> has been upgraded from version 0.19 to 0.20
358 Don't test twice for bootstrap file.
364 The following additions or changes have been made to diagnostic output,
365 including warnings and fatal error messages. For the complete list of
366 diagnostic messages, see L<perldiag>.
368 =head2 Changes to Existing Diagnostics
374 "Variable %s will not stay shared" has been changed to say "Subroutine"
375 when it is actually a lexical sub that will not stay shared.
379 =head1 Platform Support
381 =head2 Platform-Specific Notes
389 Intel C builds are now always built with C99 mode on.
393 =head1 Internal Changes
399 The PADNAME and PADNAMELIST types are now separate types, and no longer
400 simply aliases for SV and AV. [perl #123223]
404 Pad names are now always UTF8. The C<PadnameUTF8> macro always returns
405 true. Previously, this was effectively the case already, but any support
406 for two different internal representations of pad names has now been
411 The C<OP_SIBLING> and C<OP_HAS_SIBLING> macros added in an earlier 5.21.x
412 release have been renamed C<OpSIBLING> and C<OpHAS_SIBLING>, following the
417 A new op class, C<UNOP_AUX>, has been added. This is a subclass of
418 C<UNOP> with an C<op_aux> field added, which points to an array of unions
419 of C<UV>, C<SV*> etc. It is intended for where an op needs to store more data
420 than a simple C<op_sv> or whatever. Currently the only op of this type is
421 C<OP_MULTIDEREF> (see below).
425 A new op has been added, C<OP_MULTIDEREF>, which performs one or more
426 nested array and hash lookups where the key is a constant or simple
427 variable. For example the expression C<$a[0]{$k}[$i]>, which previously
428 involved ten C<rv2Xv>, C<Xelem>, C<gvsv> and C<const> ops is now performed
429 by a single C<multideref> op. It can also handle C<local>, C<exists> and
430 C<delete>. A non-simple index expression, such as C<[$i+1]> is still done
431 using C<aelem/helem>, and single-level array lookup with a small constant
432 index is still done using C<aelemfast>.
436 =head1 Selected Bug Fixes
442 On Win32, restoring in a child pseudo-process a variable that was
443 C<local()>ed in a parent pseudo-process before the C<fork> happened caused
444 memory corruption and a crash in the child pseudo-process (and therefore OS
445 process). [perl #40565]
449 Calling C<write> on a format with a C<^**> field could produce a panic
450 in sv_chop() if there were insufficient arguments or if the variable
451 used to fill the field was empty. [perl #123245]
455 Non-ASCII lexical sub names (use in error messages) on longer have extra
460 The C<\@> subroutine prototype no longer flattens parenthesized arrays
461 (taking a reference to each element), but takes a reference to the array
462 itself. [perl #47363]
466 A block containing nothing except a C-style C<for> loop could corrupt the
467 stack, causing lists outside the block to lose elements or have elements
468 overwritten. This could happen with C<map { for(...){...} } ...> and with
469 lists containing C<do { for(...){...} }>. [perl #123286]
473 C<scalar()> now propagates lvalue context, so that
474 C<for(scalar($#foo)) { ... }> can modify C<$#foo> through C<$_>.
478 C<qr/@array(?{block})/> no longer dies with "Bizarre copy of ARRAY".
483 C<eval '$variable'> in nested named subroutines would sometimes look up a
484 global variable even with a lexical variable in scope.
488 In perl 5.20.0, C<sort CORE::fake> where 'fake' is anything other than a
489 keyword started chopping of the last 6 characters and treating the result
490 as a sort sub name. The previous behaviour of treating "CORE::fake" as a
491 sort sub name has been restored. [perl #123410]
495 Outside of C<use utf8>, a single-character Latin-1 lexical variable is
496 disallowed. The error message for it, "Can't use global $foo...", was
497 giving garbage instead of the variable name.
501 C<readline> on a nonexistent handle was causing C<${^LAST_FH}> to produce a
502 reference to an undefined scalar (or fail an assertion). Now
503 C<${^LAST_FH}> ends up undefined.
507 C<(...)x...> in void context now applies scalar context to the left-hand
508 argument, instead of the context the current sub was called in.
513 =head1 Acknowledgements
515 Perl 5.21.7 represents approximately 4 weeks of development since Perl 5.21.6
516 and contains approximately 97,000 lines of changes across 640 files from 30
519 Excluding auto-generated files, documentation and release tools, there were
520 approximately 26,000 lines of changes to 400 .pm, .t, .c and .h files.
522 Perl continues to flourish into its third decade thanks to a vibrant community
523 of users and developers. The following people are known to have contributed the
524 improvements that became Perl 5.21.7:
526 Aaron Crane, Aristotle Pagaltzis, Chad Granum, Chris 'BinGOs' Williams, Craig
527 A. Berry, Dagfinn Ilmari Mannsåker, Daniel Dragan, David Mitchell, Eric
528 Herman, Father Chrysostomos, H.Merijn Brand, Hugo van der Sanden, James
529 Raspass, Jarkko Hietaniemi, Jim Cromie, Karen Etheridge, Karl Williamson, kmx,
530 Lukas Mai, Matthew Horsfall, Max Maischein, Petr Písař, Ricardo Signes,
531 Shlomi Fish, Steffen Müller, Steve Hay, Sullivan Beck, syber, Todd Rinaldo,
534 The list above is almost certainly incomplete as it is automatically generated
535 from version control history. In particular, it does not include the names of
536 the (very much appreciated) contributors who reported issues to the Perl bug
539 Many of the changes included in this version originated in the CPAN modules
540 included in Perl's core. We're grateful to the entire CPAN community for
541 helping Perl to flourish.
543 For a more complete list of all of Perl's historical contributors, please see
544 the F<AUTHORS> file in the Perl source distribution.
546 =head1 Reporting Bugs
548 If you find what you think is a bug, you might check the articles recently
549 posted to the comp.lang.perl.misc newsgroup and the perl bug database at
550 https://rt.perl.org/ . There may also be information at
551 http://www.perl.org/ , the Perl Home Page.
553 If you believe you have an unreported bug, please run the L<perlbug> program
554 included with your release. Be sure to trim your bug down to a tiny but
555 sufficient test case. Your bug report, along with the output of C<perl -V>,
556 will be sent off to perlbug@perl.org to be analysed by the Perl porting team.
558 If the bug you are reporting has security implications, which make it
559 inappropriate to send to a publicly archived mailing list, then please send it
560 to perl5-security-report@perl.org. This points to a closed subscription
561 unarchived mailing list, which includes all the core committers, who will be
562 able to help assess the impact of issues, figure out a resolution, and help
563 co-ordinate the release of patches to mitigate or fix the problem across all
564 platforms on which Perl is supported. Please only use this address for
565 security issues in the Perl core, not for modules independently distributed on
570 The F<Changes> file for an explanation of how to view exhaustive details on
573 The F<INSTALL> file for how to build Perl.
575 The F<README> file for general stuff.
577 The F<Artistic> and F<Copying> files for copyright information.