This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add qr/\b{gcb}/
[perl5.git] / pod / perl5217delta.pod
1 =encoding utf8
2
3 =head1 NAME
4
5 perl5217delta - what is new for perl v5.21.7
6
7 =head1 DESCRIPTION
8
9 This document describes differences between the 5.21.6 release and the 5.21.7
10 release.
11
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.
14
15 =head1 Core Enhancements
16
17 =head2 faster array and hash lookups
18
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.
22
23 =head2 C<fileno> now works on directory handles
24
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.
31
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.
34
35 =head1 Incompatible Changes
36
37 =head2 C<&> and C<\&> prototypes accepts only subs
38
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]
42 [perl #123062]
43
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.
46 [perl #77860]
47
48 =head2 C<use encoding> is now lexical
49
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.
53
54 =head2 List slices returning empty lists
55
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]
59
60 =head1 Deprecations
61
62 =head2 Setting C<${^ENCODING}> to anything but C<undef>
63
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.
69
70 =head1 Performance Enhancements
71
72 =over 4
73
74 =item *
75
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.
79
80 =item *
81
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
85 run time.
86
87 =back
88
89 =head1 Modules and Pragmata
90
91 =head2 Updated Modules and Pragmata
92
93 =over 4
94
95 =item *
96
97 The PathTools module collection has been upgraded from 3.52 to 3.53.
98
99 Don't turn leading C<//> into C</> on Cygwin. [perl #122635]
100
101 =item *
102
103 L<Archive::Tar> has been upgraded from version 2.02 to 2.04.
104
105 =item *
106
107 L<arybase> has been upgraded from version 0.08 to 0.09.
108
109 =item *
110
111 L<B> has been upgraded from version 1.53 to 1.54.
112
113 Nulled COPs are now of class C<B::COP>, rather than C<B::OP>.
114
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
118 C<qr//blahblah> op.
119
120 B::PMOP now provides a C<pmregexp> method returning a B::REGEXP object.
121
122 Two new classes, B::PADNAME and B::PADNAMELIST, have been introduced.
123
124 =item *
125
126 L<B::Concise> has been upgraded from version 0.995 to 0.996.
127
128 =item *
129
130 L<B::Deparse> has been upgraded from version 1.30 to 1.31.
131
132 BEGIN blocks at the end of the enclosing scope are now deparsed in the
133 right place.  [perl #77452]
134
135 BEGIN blocks were sometimes deparsed as __ANON__, but are now always called
136 BEGIN.
137
138 Lexical subroutines are now fully deparsed.  [perl #116553]
139
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.
142
143 C<Anything =~ y///r> with C</r> no longer omits the left-hand operand.
144
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]
149
150 C<$;> at the end of a statement no longer loses its semicolon.
151 [perl #123357]
152
153 Some cases of subroutine declarations stored in the stash in shorthand form
154 were being omitted.
155
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.)
159
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.
163
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
166 optional.
167
168 Whitespace is no longer escaped in regular expressions, because it was
169 getting erroneously escaped within C<(?x:...)> sections.
170
171 C<sub foo { foo() }> is now deparsed with those mandatory parentheses.
172
173 C</@array/> is now deparsed as a regular expression, and not just
174 C<@array>.
175
176 C</@{-}/>, C</@{+}/> and C<$#{1}> are now deparsed with the braces, which
177 are mandatory in these cases.
178
179 In deparsing feature bundles, B::Deparse was emitting C<no feature;> first
180 instead of C<no feature ':all';>.  This has been fixed.
181
182 C<chdir FH> is now deparsed without quotation marks.
183
184 C<\my @a> is now deparsed without parentheses.  (Parenthese would flatten
185 the array.)
186
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.
189
190 C<< use constant QR =E<gt> qr/.../flags >> followed by C<"" =~ QR> is no longer
191 without the flags.
192
193 =item *
194
195 L<charnames> has been upgraded from version 1.41 to 1.43.
196
197 =item *
198
199 L<Compress::Raw::Bzip2> has been upgraded from version 2.066 to 2.067.
200
201 =item *
202
203 L<Compress::Raw::Zlib> has been upgraded from version 2.066 to 2.067.
204
205 =item *
206
207 L<Data::Dumper> has been upgraded from version 2.154 to 2.155.
208
209 =item *
210
211 L<DB_File> has been upgraded from version 1.831 to 1.834.
212
213 =item *
214
215 L<Devel::Peek> has been upgraded from version 1.19 to 1.20.
216
217 =item *
218
219 L<Devel::PPPort> has been upgraded from version 3.24 to 3.25.
220
221 =item *
222
223 L<DynaLoader> has been upgraded from version 1.28 to 1.29.
224
225 =item *
226
227 L<Encode> has been upgraded from version 2.64 to 2.67.
228
229 =item *
230
231 L<Errno> has been upgraded from version 1.21 to 1.22.
232
233 =item *
234
235 L<ExtUtils::CBuilder> has been upgraded from version 0.280220 to 0.280221.
236
237 =item *
238
239 L<ExtUtils::MakeMaker> has been upgraded from version 7.02 to 7.04.
240
241 =item *
242
243 L<ExtUtils::ParseXS> has been upgraded from version 3.26 to 3.27.
244
245 Only declare C<file> unused if we actually define it.
246
247 Improve generated C<RETVAL> code generation to avoid repeated
248 references to C<ST(0)>.  [perl #123278]
249
250 Broaden and document the C</OBJ$/> to C</REF$/> typemap optimization
251 for the C<DESTROY> method.  [perl #123418]
252
253 =item *
254
255 L<feature> has been upgraded from version 1.38 to 1.39.
256
257 =item *
258
259 L<File::Spec> has been upgraded from version 3.51 to 3.54.
260
261 =item *
262
263 L<Filter::Util::Call> has been upgraded from version 1.49 to 1.51.
264
265 =item *
266
267 L<HTTP::Tiny> has been upgraded from version 0.051 to 0.053.
268
269 =item *
270
271 L<IO> has been upgraded from version 1.34 to 1.35.
272
273 =item *
274
275 The IO::Compress module collection has been upgraded from version 2.066 to 2.067.
276
277 =item *
278
279 L<IO::Socket::IP> has been upgraded from version 0.32 to 0.34.
280
281 =item *
282
283 L<Locale::Codes> has been upgraded from version 3.32 to 3.33.
284
285 =item *
286
287 L<Locale::Maketext> has been upgraded from version 1.25 to 1.26.
288
289 =item *
290
291 L<Module::CoreList> has been upgraded from version 5.20141120 to 5.20141220.
292
293 =item *
294
295 L<mro> has been upgraded from version 1.16 to 1.17.
296
297 =item *
298
299 L<NDBM_File> has been upgraded from version 1.13 to 1.14.
300
301 =item *
302
303 L<Opcode> has been upgraded from version 1.29 to 1.30.
304
305 =item *
306
307 L<PerlIO::scalar> has been upgraded from version 0.20 to 0.21.
308
309 Reading from a position well past the end of the scalar now correctly
310 returns end of file.  [perl #123443]
311
312 Seeking to a negative position still fails, but no longer leaves the
313 file position set to a negation location.
314
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.
317
318 =item *
319
320 L<Pod::Escapes> has been upgraded from version 1.06 to 1.07.
321
322 =item *
323
324 L<POSIX> has been upgraded from version 1.46 to 1.48.
325
326 =item *
327
328 L<SDBM_File> has been upgraded from version 1.11 to 1.12.
329
330 =item *
331
332 L<Storable> has been upgraded from version 2.51 to 2.52.
333
334 =item *
335
336 L<strict> has been upgraded from version 1.08 to 1.09.
337
338 =item *
339
340 L<Sys::Hostname> has been upgraded from version 1.19 to 1.20.
341
342 =item *
343
344 L<Test::Simple> has been upgraded from version 1.301001_075 to 1.301001_090.
345
346 =item *
347
348 L<threads> has been upgraded from version 1.96 to 1.96_001.
349
350 =item *
351
352 L<Unicode::Collate> has been upgraded from version 1.07 to 1.09.
353
354 =item *
355
356 L<XSLoader> has been upgraded from version 0.19 to 0.20
357
358 Don't test twice for bootstrap file.
359
360 =back
361
362 =head1 Diagnostics
363
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>.
367
368 =head2 Changes to Existing Diagnostics
369
370 =over 4
371
372 =item *
373
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.
376
377 =back
378
379 =head1 Platform Support
380
381 =head2 Platform-Specific Notes
382
383 =head3 Win32
384
385 =over
386
387 =item *
388
389 Intel C builds are now always built with C99 mode on.
390
391 =back
392
393 =head1 Internal Changes
394
395 =over 4
396
397 =item *
398
399 The PADNAME and PADNAMELIST types are now separate types, and no longer
400 simply aliases for SV and AV.  [perl #123223]
401
402 =item *
403
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
407 removed.
408
409 =item *
410
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
413 existing convention.
414
415 =item *
416
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).
422
423 =item *
424
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>.
433
434 =back
435
436 =head1 Selected Bug Fixes
437
438 =over 4
439
440 =item *
441
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]
446
447 =item *
448
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]
452
453 =item *
454
455 Non-ASCII lexical sub names (use in error messages) on longer have extra
456 junk on the end.
457
458 =item *
459
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]
463
464 =item *
465
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]
470
471 =item *
472
473 C<scalar()> now propagates lvalue context, so that
474 C<for(scalar($#foo)) { ... }> can modify C<$#foo> through C<$_>.
475
476 =item *
477
478 C<qr/@array(?{block})/> no longer dies with "Bizarre copy of ARRAY".
479 [#123344]
480
481 =item *
482
483 C<eval '$variable'> in nested named subroutines would sometimes look up a
484 global variable even with a lexical variable in scope.
485
486 =item *
487
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]
492
493 =item *
494
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.
498
499 =item *
500
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.
504
505 =item *
506
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.
509 [perl #123020]
510
511 =back
512
513 =head1 Acknowledgements
514
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
517 authors.
518
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.
521
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:
525
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,
532 Tony Cook.
533
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
537 tracker.
538
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.
542
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.
545
546 =head1 Reporting Bugs
547
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.
552
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.
557
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
566 CPAN.
567
568 =head1 SEE ALSO
569
570 The F<Changes> file for an explanation of how to view exhaustive details on
571 what changed.
572
573 The F<INSTALL> file for how to build Perl.
574
575 The F<README> file for general stuff.
576
577 The F<Artistic> and F<Copying> files for copyright information.
578
579 =cut