This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update epigraphs.pod
[perl5.git] / pod / perldelta.pod
CommitLineData
44691e6f
AB
1=encoding utf8
2
3=head1 NAME
4
4dc623f0 5perldelta - what is new for perl v5.21.7
c68523cb 6
238894db 7=head1 DESCRIPTION
c68523cb 8
4dc623f0 9This document describes differences between the 5.21.6 release and the 5.21.7
238894db 10release.
c68523cb 11
4dc623f0
CBW
12If you are upgrading from an earlier release such as 5.21.5, first read
13L<perl5216delta>, which describes differences between 5.21.5 and 5.21.6.
8435afd1 14
4dc623f0 15=head1 Core Enhancements
518159a1 16
2ec11c70
DM
17=head2 faster array and hash lookups
18
19Array and hash lookups (especially nested ones) that use only constants
20or simple variables as keys, are now considerably faster. See
21L</Internal Changes> for more details.
22
67f2cc75
AC
23=head2 C<fileno> now works on directory handles
24
25When the relevant support is available in the operating system, the
26C<fileno> builtin now works on directory handles, yielding the
27underlying file descriptor in the same way as for filehandles. On
28operating systems without such support, C<fileno> on a directory handle
29continues to return the undefined value, as before, but also sets C<$!> to
30indicate that the operation is not supported.
31
32Currently, this uses either a C<dd_fd> member in the OS C<DIR>
33structure, or a dirfd(3) function as specified by POSIX.1-2008.
34
4dc623f0 35=head1 Incompatible Changes
295f7815 36
aafa61ee 37=head2 C<&> and C<\&> prototypes accepts only subs
3f22ed99
FC
38
39The C<&> prototype character now accepts only anonymous subs (C<sub {...}>)
40and things beginning with C<\&>. Formerly it erroneously also allowed
41C<undef> and references to array, hashes, and lists. [perl #4539]
42[perl #123062]
43
aafa61ee
FC
44The C<\&> prototype was allowing subroutine calls, whereas now it only
45allows subroutines. C<&foo> is permitted. C<&foo()> and C<foo()> are not.
46[perl #77860]
47
ef8784b7
FC
48=head2 C<use encoding> is now lexical
49
50The L<encoding> pragma's effect is now limited to lexical scope. This
51pragma is deprecated, but in the meantime, it could adversely affect
52unrelated modules that are included in the same program.
53
0a7766ab
FC
54=head2 List slices returning empty lists
55
56List 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
58list if all indices fell outside the original list. [perl #114498]
59
4dc623f0 60=head1 Deprecations
5b306eef 61
c0659f73
KW
62=head2 Setting C<${^ENCODING}> to anything but C<undef>
63
64This variable allows Perl scripts to be written in a non-ASCII,
65non-UTF-8 encoding. However, it affects all modules globally, leading
66to wrong answers and segmentation faults. New scripts should be written
67in UTF-8; old scripts should be converted to UTF-8, which is easily done
68with the L<encoding> pragma.
69
4dc623f0 70=head1 Performance Enhancements
6ed80d55 71
4dc623f0 72=over 4
6ed80d55
CBW
73
74=item *
75
2adef77e
DD
76Win32 Perl uses 8 KB less of per-process memory than before for every perl
77process of this version. This data is now memory mapped from disk and shared
78between perl processes from the same perl binary.
6ed80d55 79
b9208905
FC
80=item *
81
82If method and class names are known at compile time, hashes are precomputed
83to speed up run-time method lookup. Also, compound method names like
84C<SUPER::new> are parsed at compile time, to save having to parse them at
85run time.
86
4dc623f0 87=back
f4e81f96 88
4dc623f0 89=head1 Modules and Pragmata
bb6a367a 90
60dde9d3 91=head2 Updated Modules and Pragmata
6ed80d55 92
4dc623f0 93=over 4
f348c3d8
A
94
95=item *
96
60dde9d3 97The PathTools module collection has been upgraded from 3.52 to 3.53.
7635ad4d 98
60dde9d3 99Don't turn leading C<//> into C</> on Cygwin. [perl #122635]
7635ad4d 100
60dde9d3 101=item *
7635ad4d 102
60dde9d3
MM
103L<Archive::Tar> has been upgraded from version 2.02 to 2.04.
104
105=item *
106
107L<arybase> has been upgraded from version 0.08 to 0.09.
f348c3d8 108
6ed80d55 109=item *
f348c3d8 110
cd3802ac
FC
111L<B> has been upgraded from version 1.53 to 1.54.
112
113Nulled COPs are now of class C<B::COP>, rather than C<B::OP>.
114
d6c13051 115B::REGEXP objects now provide a C<qr_anoncv> method for accessing the
430bd3ea
FC
116implicit CV associated with C<qr//> things containing code blocks, and a
117C<compflags> method that returns the pertinent flags originating from the
118C<qr//blahblah> op.
d6c13051 119
02a0bddf
FC
120B::PMOP now provides a C<pmregexp> method returning a B::REGEXP object.
121
128f4e12
FC
122Two new classes, B::PADNAME and B::PADNAMELIST, have been introduced.
123
cd3802ac
FC
124=item *
125
60dde9d3
MM
126L<B::Concise> has been upgraded from version 0.995 to 0.996.
127
128=item *
129
7cf50cd1
FC
130L<B::Deparse> has been upgraded from version 1.30 to 1.31.
131
132BEGIN blocks at the end of the enclosing scope are now deparsed in the
133right place. [perl #77452]
134
5371f1f7
FC
135BEGIN blocks were sometimes deparsed as __ANON__, but are now always called
136BEGIN.
137
73fc9720
FC
138Lexical subroutines are now fully deparsed. [perl #116553]
139
9d67d695
FC
140Deparsing of C<$lexical =~ //> was accidentally broken in 1.30 (perl
1415.21.6), omitting the C<$lexical =~>, but has now been fixed.
142
92e6b96d
FC
143C<Anything =~ y///r> with C</r> no longer omits the left-hand operand.
144
aa9bed36
FC
145The op trees that make up regexp code blocks are now deparsed for real.
146Formerly, the original string that made up the regular expression was used.
60dde9d3 147That caused problems with C<qr/(?{E<lt>E<lt>heredoc})/> and multiline code blocks,
aa9bed36
FC
148which were deparsed incorrectly. [perl #123217] [perl #115256]
149
9d6cb1a5
FC
150C<$;> at the end of a statement no longer loses its semicolon.
151[perl #123357]
152
d5ced743
FC
153Some cases of subroutine declarations stored in the stash in shorthand form
154were being omitted.
155
3b7745ab
FC
156Non-ASCII characters are now consistently escaped in strings, instead of
157some of the time. (There are still outstanding problems with regular
158expressions and identifiers that have not been fixed.)
159
a2fb0b75
FC
160When prototype sub calls are deparsed with C<&> (e.g., under the B<-P>
161option), C<scalar> is now added where appropriate, to force the scalar
162context implied by the prototype.
163
3aba4f3d
FC
164C<require(foo())>, C<do(foo())>, C<goto(foo())> and similar constructs with
165loop controls are now deparsed correctly. The outer parentheses are not
166optional.
167
a899f84c
FC
168Whitespace is no longer escaped in regular expressions, because it was
169getting erroneously escaped within C<(?x:...)> sections.
170
98ad19a5
FC
171C<sub foo { foo() }> is now deparsed with those mandatory parentheses.
172
649cbf53
FC
173C</@array/> is now deparsed as a regular expression, and not just
174C<@array>.
175
dc5249b4
FC
176C</@{-}/>, C</@{+}/> and C<$#{1}> are now deparsed with the braces, which
177are mandatory in these cases.
178
68cb1d5a
FC
179In deparsing feature bundles, B::Deparse was emitting C<no feature;> first
180instead of C<no feature ':all';>. This has been fixed.
181
48817e79
FC
182C<chdir FH> is now deparsed without quotation marks.
183
b5c00acd
TC
184C<\my @a> is now deparsed without parentheses. (Parenthese would flatten
185the array.)
186
03d75a2a
FC
187C<system> and C<exec> followed by a block are now deparsed correctly.
188Formerly there was an erroneous C<do> before the block.
189
60dde9d3 190C<< use constant QR =E<gt> qr/.../flags >> followed by C<"" =~ QR> is no longer
76aa1ab7
FC
191without the flags.
192
7cf50cd1
FC
193=item *
194
60dde9d3 195L<charnames> has been upgraded from version 1.41 to 1.43.
af292847 196
190f5bb6
TC
197=item *
198
60dde9d3 199L<Compress::Raw::Bzip2> has been upgraded from version 2.066 to 2.067.
b045b8b5
TC
200
201=item *
202
60dde9d3 203L<Compress::Raw::Zlib> has been upgraded from version 2.066 to 2.067.
190f5bb6 204
ba31029d
TR
205=item *
206
60dde9d3 207L<Data::Dumper> has been upgraded from version 2.154 to 2.155.
b045b8b5 208
60dde9d3 209=item *
ba31029d 210
60dde9d3 211L<DB_File> has been upgraded from version 1.831 to 1.834.
aa67537d 212
4c7a0d98
DD
213=item *
214
60dde9d3 215L<Devel::Peek> has been upgraded from version 1.19 to 1.20.
4c7a0d98 216
60dde9d3 217=item *
4c7a0d98 218
60dde9d3 219L<Devel::PPPort> has been upgraded from version 3.24 to 3.25.
f4eedc6b 220
60dde9d3 221=item *
f4eedc6b 222
60dde9d3 223L<DynaLoader> has been upgraded from version 1.28 to 1.29.
f348c3d8 224
6ed80d55
CBW
225=item *
226
60dde9d3 227L<Encode> has been upgraded from version 2.64 to 2.67.
f348c3d8 228
60dde9d3 229=item *
f348c3d8 230
60dde9d3 231L<Errno> has been upgraded from version 1.21 to 1.22.
f348c3d8 232
60dde9d3 233=item *
f348c3d8 234
60dde9d3 235L<ExtUtils::CBuilder> has been upgraded from version 0.280220 to 0.280221.
f348c3d8 236
60dde9d3 237=item *
f348c3d8 238
60dde9d3 239L<ExtUtils::MakeMaker> has been upgraded from version 7.02 to 7.04.
6ed80d55 240
60dde9d3 241=item *
f348c3d8 242
60dde9d3 243L<ExtUtils::ParseXS> has been upgraded from version 3.26 to 3.27.
f348c3d8 244
60dde9d3 245Only declare C<file> unused if we actually define it.
4dc623f0 246
60dde9d3
MM
247Improve generated C<RETVAL> code generation to avoid repeated
248references to C<ST(0)>. [perl #123278]
84d03adf 249
60dde9d3
MM
250Broaden and document the C</OBJ$/> to C</REF$/> typemap optimization
251for the C<DESTROY> method. [perl #123418]
ff433f2d 252
4cd408ba
TC
253=item *
254
60dde9d3 255L<feature> has been upgraded from version 1.38 to 1.39.
6ed80d55 256
60dde9d3 257=item *
6ed80d55 258
60dde9d3 259L<File::Spec> has been upgraded from version 3.51 to 3.54.
6ed80d55 260
60dde9d3 261=item *
f348c3d8 262
60dde9d3 263L<Filter::Util::Call> has been upgraded from version 1.49 to 1.51.
ab0b796c 264
60dde9d3 265=item *
8c6180a9 266
60dde9d3 267L<HTTP::Tiny> has been upgraded from version 0.051 to 0.053.
8c6180a9
KW
268
269=item *
270
60dde9d3 271L<IO> has been upgraded from version 1.34 to 1.35.
0561e60b 272
60dde9d3 273=item *
dd200dff 274
60dde9d3 275The IO::Compress module collection has been upgraded from version 2.066 to 2.067.
dd200dff 276
73e793fc
FC
277=item *
278
60dde9d3 279L<IO::Socket::IP> has been upgraded from version 0.32 to 0.34.
73e793fc 280
60dde9d3 281=item *
8c6180a9 282
60dde9d3 283L<Locale::Codes> has been upgraded from version 3.32 to 3.33.
0561e60b 284
60dde9d3 285=item *
4a328228 286
60dde9d3 287L<Locale::Maketext> has been upgraded from version 1.25 to 1.26.
4cd408ba 288
1861205d
FC
289=item *
290
60dde9d3 291L<Module::CoreList> has been upgraded from version 5.20141120 to 5.20141220.
1861205d 292
60dde9d3 293=item *
40a81b59 294
60dde9d3 295L<mro> has been upgraded from version 1.16 to 1.17.
2a395b86 296
60dde9d3 297=item *
2a395b86 298
60dde9d3 299L<NDBM_File> has been upgraded from version 1.13 to 1.14.
12d22d1f 300
60dde9d3 301=item *
2a395b86 302
60dde9d3 303L<Opcode> has been upgraded from version 1.29 to 1.30.
2a395b86
PM
304
305=item *
306
60dde9d3 307L<PerlIO::scalar> has been upgraded from version 0.20 to 0.21.
bb8c7e27 308
60dde9d3
MM
309Reading from a position well past the end of the scalar now correctly
310returns end of file. [perl #123443]
bb8c7e27 311
60dde9d3
MM
312Seeking to a negative position still fails, but no longer leaves the
313file position set to a negation location.
bb8c7e27 314
60dde9d3
MM
315C<eof()> on a C<PerlIO::scalar> handle now properly returns true when
316the file position is past the 2GB mark on 32-bit systems.
aa292ef2 317
60dde9d3 318=item *
83b69bfd 319
60dde9d3 320L<Pod::Escapes> has been upgraded from version 1.06 to 1.07.
83b69bfd
DD
321
322=item *
323
60dde9d3 324L<POSIX> has been upgraded from version 1.46 to 1.48.
13adb056 325
60dde9d3 326=item *
83b69bfd 327
60dde9d3 328L<SDBM_File> has been upgraded from version 1.11 to 1.12.
391823f2 329
60dde9d3 330=item *
6ff8f256 331
60dde9d3 332L<Storable> has been upgraded from version 2.51 to 2.52.
80cc3290 333
60dde9d3
MM
334=item *
335
336L<strict> has been upgraded from version 1.08 to 1.09.
db98db4e 337
8818afe8
TC
338=item *
339
60dde9d3 340L<Sys::Hostname> has been upgraded from version 1.19 to 1.20.
9d22ccf6 341
60dde9d3 342=item *
480961b6 343
60dde9d3 344L<Test::Simple> has been upgraded from version 1.301001_075 to 1.301001_090.
480961b6 345
60dde9d3 346=item *
94c9bf90 347
60dde9d3 348L<threads> has been upgraded from version 1.96 to 1.96_001.
94c9bf90 349
60dde9d3 350=item *
8af808bf 351
60dde9d3 352L<Unicode::Collate> has been upgraded from version 1.07 to 1.09.
8af808bf 353
60dde9d3 354=item *
fdcaecb7 355
60dde9d3 356L<XSLoader> has been upgraded from version 0.19 to 0.20
fdcaecb7 357
60dde9d3 358Don't test twice for bootstrap file.
2af7c6b6 359
4dc623f0 360=back
2af7c6b6 361
60dde9d3 362=head1 Diagnostics
c0b32823 363
60dde9d3
MM
364The following additions or changes have been made to diagnostic output,
365including warnings and fatal error messages. For the complete list of
366diagnostic messages, see L<perldiag>.
367
368=head2 Changes to Existing Diagnostics
c0b32823 369
4dc623f0 370=over 4
b1a4e8b3 371
60dde9d3 372=item *
b1a4e8b3 373
60dde9d3
MM
374"Variable %s will not stay shared" has been changed to say "Subroutine"
375when it is actually a lexical sub that will not stay shared.
9e26817d 376
4dc623f0 377=back
9e26817d 378
60dde9d3
MM
379=head1 Platform Support
380
4dc623f0 381=head2 Platform-Specific Notes
70cee83f 382
312159d9 383=head3 Win32
70cee83f 384
312159d9 385=over
e5fbfbc1 386
312159d9 387=item *
e5fbfbc1 388
312159d9 389Intel C builds are now always built with C99 mode on.
353075a0 390
4dc623f0 391=back
353075a0 392
4dc623f0 393=head1 Internal Changes
9f122eef 394
4dc623f0 395=over 4
9f122eef
FC
396
397=item *
398
14f5a3e3
FC
399The PADNAME and PADNAMELIST types are now separate types, and no longer
400simply aliases for SV and AV. [perl #123223]
c7f058f0 401
cd96a1b6
FC
402=item *
403
404Pad names are now always UTF8. The C<PadnameUTF8> macro always returns
405true. Previously, this was effectively the case already, but any support
406for two different internal representations of pad names has now been
407removed.
408
bd2aa467
FC
409=item *
410
411The C<OP_SIBLING> and C<OP_HAS_SIBLING> macros added in an earlier 5.21.x
412release have been renamed C<OpSIBLING> and C<OpHAS_SIBLING>, following the
413existing convention.
414
2ec11c70
DM
415=item *
416
417A new op class, C<UNOP_AUX>, has been added. This is a subclass of
418C<UNOP> with an C<op_aux> field added, which points to an array of unions
3f08cda2 419of C<UV>, C<SV*> etc. It is intended for where an op needs to store more data
2ec11c70
DM
420than a simple C<op_sv> or whatever. Currently the only op of this type is
421C<OP_MULTIDEREF> (see below).
422
423=item *
424
425A new op has been added, C<OP_MULTIDEREF>, which performs one or more
426nested array and hash lookups where the key is a constant or simple
427variable. For example the expression C<$a[0]{$k}[$i]>, which previously
428involved ten C<rv2Xv>, C<Xelem>, C<gvsv> and C<const> ops is now performed
429by a single C<multideref> op. It can also handle C<local>, C<exists> and
430C<delete>. A non-simple index expression, such as C<[$i+1]> is still done
3f08cda2 431using C<aelem/helem>, and single-level array lookup with a small constant
2ec11c70
DM
432index is still done using C<aelemfast>.
433
4dc623f0 434=back
c7f058f0 435
4dc623f0 436=head1 Selected Bug Fixes
0ef4323a 437
4dc623f0 438=over 4
c263379c 439
ff90be78
TC
440=item *
441
452466a5
FC
442On Win32, restoring in a child pseudo-process a variable that was
443C<local()>ed in a parent pseudo-process before the C<fork> happened caused
444memory corruption and a crash in the child pseudo-process (and therefore OS
64eb3958 445process). [perl #40565]
ff90be78 446
3e669301
KW
447=item *
448
279aef25
TC
449Calling C<write> on a format with a C<^**> field could produce a panic
450in sv_chop() if there were insufficient arguments or if the variable
451used to fill the field was empty. [perl #123245]
452
00ba25b8
FC
453=item *
454
455Non-ASCII lexical sub names (use in error messages) on longer have extra
456junk on the end.
457
567291b6
FC
458=item *
459
460The C<\@> subroutine prototype no longer flattens parenthesized arrays
461(taking a reference to each element), but takes a reference to the array
462itself. [perl #47363]
463
fcfb7b86
FC
464=item *
465
466A block containing nothing except a C-style C<for> loop could corrupt the
467stack, causing lists outside the block to lose elements or have elements
468overwritten. This could happen with C<map { for(...){...} } ...> and with
469lists containing C<do { for(...){...} }>. [perl #123286]
470
8bb83ec2
FC
471=item *
472
473C<scalar()> now propagates lvalue context, so that
474C<for(scalar($#foo)) { ... }> can modify C<$#foo> through C<$_>.
475
1318b6d7
FC
476=item *
477
478C<qr/@array(?{block})/> no longer dies with "Bizarre copy of ARRAY".
479[#123344]
480
6f67fbfe
FC
481=item *
482
483C<eval '$variable'> in nested named subroutines would sometimes look up a
484global variable even with a lexical variable in scope.
485
070733df
FC
486In perl 5.20.0, C<sort CORE::fake> where 'fake' is anything other than a
487keyword started chopping of the last 6 characters and treating the result
488as a sort sub name. The previous behaviour of treating "CORE::fake" as a
489sort sub name has been restored. [perl #123410]
490
219f8441
FC
491=item *
492
493Outside of C<use utf8>, a single-character Latin-1 lexical variable is
494disallowed. The error message for it, "Can't use global $foo...", was
495giving garbage instead of the variable name.
496
5747f88b
FC
497=item *
498
499C<readline> on a nonexistent handle was causing C<${^LAST_FH}> to produce a
500reference to an undefined scalar (or fail an assertion). Now
501C<${^LAST_FH}> ends up undefined.
502
61a8c397
FC
503=item *
504
505C<(...)x...> in void context now applies scalar context to the left-hand
506argument, instead of the context the current sub was called in.
507[perl #123020]
508
86372193 509=back
bb8c7e27 510
60dde9d3 511=head1 Acknowledgements
28a42920 512
60dde9d3
MM
513Perl 5.21.7 represents approximately 4 weeks of development since Perl 5.21.6
514and contains approximately 97,000 lines of changes across 640 files from 30
515authors.
f5630681 516
60dde9d3
MM
517Excluding auto-generated files, documentation and release tools, there were
518approximately 26,000 lines of changes to 400 .pm, .t, .c and .h files.
3a085d00 519
60dde9d3
MM
520Perl continues to flourish into its third decade thanks to a vibrant community
521of users and developers. The following people are known to have contributed the
522improvements that became Perl 5.21.7:
01d42a22 523
60dde9d3
MM
524Aaron Crane, Aristotle Pagaltzis, Chad Granum, Chris 'BinGOs' Williams, Craig
525A. Berry, Dagfinn Ilmari Mannsåker, Daniel Dragan, David Mitchell, Eric
526Herman, Father Chrysostomos, H.Merijn Brand, Hugo van der Sanden, James
527Raspass, Jarkko Hietaniemi, Jim Cromie, Karen Etheridge, Karl Williamson, kmx,
528Lukas Mai, Matthew Horsfall, Max Maischein, Petr Písař, Ricardo Signes,
529Shlomi Fish, Steffen M├╝ller, Steve Hay, Sullivan Beck, syber, Todd Rinaldo,
530Tony Cook.
6ed80d55 531
60dde9d3
MM
532The list above is almost certainly incomplete as it is automatically generated
533from version control history. In particular, it does not include the names of
534the (very much appreciated) contributors who reported issues to the Perl bug
535tracker.
01d42a22 536
60dde9d3
MM
537Many of the changes included in this version originated in the CPAN modules
538included in Perl's core. We're grateful to the entire CPAN community for
539helping Perl to flourish.
01d42a22 540
60dde9d3
MM
541For a more complete list of all of Perl's historical contributors, please see
542the F<AUTHORS> file in the Perl source distribution.
f5b73711 543
44691e6f
AB
544=head1 Reporting Bugs
545
e08634c5
SH
546If you find what you think is a bug, you might check the articles recently
547posted to the comp.lang.perl.misc newsgroup and the perl bug database at
238894db 548https://rt.perl.org/ . There may also be information at
7ef8b31d 549http://www.perl.org/ , the Perl Home Page.
44691e6f 550
e08634c5
SH
551If you believe you have an unreported bug, please run the L<perlbug> program
552included with your release. Be sure to trim your bug down to a tiny but
553sufficient test case. Your bug report, along with the output of C<perl -V>,
554will be sent off to perlbug@perl.org to be analysed by the Perl porting team.
44691e6f
AB
555
556If the bug you are reporting has security implications, which make it
e08634c5
SH
557inappropriate to send to a publicly archived mailing list, then please send it
558to perl5-security-report@perl.org. This points to a closed subscription
559unarchived mailing list, which includes all the core committers, who will be
560able to help assess the impact of issues, figure out a resolution, and help
f9001595 561co-ordinate the release of patches to mitigate or fix the problem across all
e08634c5
SH
562platforms on which Perl is supported. Please only use this address for
563security issues in the Perl core, not for modules independently distributed on
564CPAN.
44691e6f
AB
565
566=head1 SEE ALSO
567
e08634c5
SH
568The F<Changes> file for an explanation of how to view exhaustive details on
569what changed.
44691e6f
AB
570
571The F<INSTALL> file for how to build Perl.
572
573The F<README> file for general stuff.
574
575The F<Artistic> and F<Copying> files for copyright information.
576
577=cut