This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
2476ad1decdda8695faafdd4dfec15d348623788
[perl5.git] / pod / perldelta.pod
1 =encoding utf8
2
3 =head1 NAME
4
5 [ this is a template for a new perldelta file.  Any text flagged as XXX needs
6 to be processed before release. ]
7
8 perldelta - what is new for perl v5.17.7
9
10 =head1 DESCRIPTION
11
12 This document describes differences between the 5.17.6 release and the 5.17.7
13 release.
14
15 If you are upgrading from an earlier release such as 5.17.5, first read
16 L<perl5176delta>, which describes differences between 5.17.5 and 5.17.6.
17
18 =head1 Notice
19
20 XXX Any important notices here
21
22 =head1 Core Enhancements
23
24 =head2 $&, $` and $' are no longer slow
25
26 These three infamous variables have been redeemed and no longer slow down
27 your program when used.  Hence, the /p regular expression flag now does
28 nothing.
29
30 =head1 Security
31
32 XXX Any security-related notices go here.  In particular, any security
33 vulnerabilities closed should be noted here rather than in the
34 L</Selected Bug Fixes> section.
35
36 [ List each security issue as a =head2 entry ]
37
38 =head1 Incompatible Changes
39
40 =head2 readline() with C<$/ = \N> now reads N characters, not N bytes
41
42 Previously, when reading from a stream with I/O layers such as
43 C<encoding>, the readline() function, otherwise known as the C<< <> >>
44 operator, would read I<N> bytes from the top-most layer. [perl #79960]
45
46 Now, I<N> characters are read instead.
47
48 There is no change in behaviour when reading from streams with no
49 extra layers, since bytes map exactly to characters.
50
51 =head2 Lexical subroutine warnings have moved
52
53 The warning about the use of an experimental feature emitted when lexical
54 subroutines (added in 5.17.4) are used now happens when the subroutine
55 itself is declared, not when the "lexical_subs" feature is activated via
56 C<use feature>.
57
58 This stops C<use feature ':all'> from warning, but causes
59 C<my sub foo; my sub bar> to warn twice.
60
61 =head2 Overridden C<glob> is now passed one argument
62
63 C<glob> overrides used to be passed a magical undocumented second argument
64 that identified the caller.  Nothing on CPAN was using this, and it got in
65 the way of a bug fix, so it was removed.  If you really need to identify
66 the caller, see L<Devel::Callsite> on CPAN.
67
68 =head1 Deprecations
69
70 XXX Any deprecated features, syntax, modules etc. should be listed here.  In
71 particular, deprecated modules should be listed here even if they are listed as
72 an updated module in the L</Modules and Pragmata> section.
73
74 [ List each deprecation as a =head2 entry ]
75
76 =head2 Lexical $_ is now deprecated
77
78 Since it was introduced in Perl 5.10, it has caused much confusion with no
79 obvious solution:
80
81 =over
82
83 =item *
84
85 Various modules (e.g., List::Util) expect callback routines to use the
86 global $_.  C<use List::Util 'first'; my $_; first { $_ == 1 } @list> does
87 not work as one would expect.
88
89 =item *
90
91 A C<my $_> declaration earlier in the same file can cause confusing closure
92 warnings.
93
94 =item *
95
96 The "_" subroutine prototype character allows called subroutines to access
97 your lexical $_, so it is not really private after all.
98
99 =item *
100
101 Nevertheless, subroutines with a "(@)" prototype and methods cannot access
102 the caller's lexical $_, unless they are written in XS.
103
104 =item *
105
106 But even XS routines cannot access a lexical $_ declared, not in the
107 calling subroutine, but in an outer scope, iff that subroutine happened not
108 to mention $_ or use any operators that default to $_.
109
110 =back
111
112 =head2 Various XS-callable functions are now deprecated
113
114 The following functions will be removed from a future version of Perl,
115 and should not be used.  With participating C compilers (e.g., gcc),
116 compiling any file that uses any of these will generate a warning.
117 These were not intended for public use; there are equivalent, faster,
118 macros for most of them.  See L<perlapi/Character classes>:
119 C<is_uni_ascii>,
120 C<is_uni_ascii_lc>,
121 C<is_uni_blank>,
122 C<is_uni_blank_lc>,
123 C<is_uni_cntrl>,
124 C<is_uni_cntrl_lc>,
125 C<is_uni_idfirst_lc>,
126 C<is_uni_space>,
127 C<is_uni_space_lc>,
128 C<is_uni_xdigit>,
129 C<is_uni_xdigit_lc>,
130 C<is_utf8_ascii>,
131 C<is_utf8_blank>,
132 C<is_utf8_cntrl>,
133 C<is_utf8_idcont>,
134 C<is_utf8_idfirst>,
135 C<is_utf8_perl_space>,
136 C<is_utf8_perl_word>,
137 C<is_utf8_posix_digit>,
138 C<is_utf8_space>,
139 C<is_utf8_xdigit>.
140 C<is_utf8_xidcont>,
141 C<is_utf8_xidfirst>,
142 C<to_uni_lower_lc>,
143 C<to_uni_title_lc>,
144 and
145 C<to_uni_upper_lc>.
146
147 =head1 Performance Enhancements
148
149 XXX Changes which enhance performance without changing behaviour go here.
150 There may well be none in a stable release.
151
152 [ List each enhancement as a =item entry ]
153
154 =over 4
155
156 =item *
157
158 Perl has a new copy-on-write mechanism that avoids the need to copy the
159 internal string buffer when assigning from one scalar to another.  This
160 makes copying large strings appear much faster.  Modifying one of the two
161 (or more) strings after an assignment will force a copy internally.  This
162 makes it unnecessary to pass strings by reference for efficiency.
163
164 =back
165
166 =head1 Modules and Pragmata
167
168 XXX All changes to installed files in F<cpan/>, F<dist/>, F<ext/> and F<lib/>
169 go here.  If Module::CoreList is updated, generate an initial draft of the
170 following sections using F<Porting/corelist-perldelta.pl>, which prints stub
171 entries to STDOUT.  Results can be pasted in place of the '=head2' entries
172 below.  A paragraph summary for important changes should then be added by hand.
173 In an ideal world, dual-life modules would have a F<Changes> file that could be
174 cribbed.
175
176 [ Within each section, list entries as a =item entry ]
177
178 =head2 New Modules and Pragmata
179
180 =over 4
181
182 =item *
183
184 XXX
185
186 =back
187
188 =head2 Updated Modules and Pragmata
189
190 =over 4
191
192 =item *
193
194 L<File::DosGlob> has been upgraded from version 1.08 to 1.09.  The internal
195 cache of file names that it keeps for each caller is now freed when that
196 caller is freed.  This means
197 C<< use File::DosGlob 'glob'; eval 'scalar <*>' >> no longer leaks memory.
198
199 =item *
200
201 L<File::Glob> has been upgraded from version 1.18 to 1.19.  File::Glob has
202 had exactly the same fix as File::DosGlob.  Since it is what Perl's own
203 C<glob> operator itself uses (except on VMS), this means
204 C<< eval 'scalar <*>' >> no longer leaks.
205
206 =item *
207
208 L<GDBM_File> has been upgraded from version 1.14 to 1.15. The undocumented
209 optional fifth parameter to C<TIEHASH> has been removed. This was intended
210 to provide control of the callback used by C<gdbm*> functions in case of
211 fatal errors (such as filesystem problems), but did not work (and could
212 never have worked). No code on CPAN even attempted to use it. The callback
213 is now always the previous default, C<croak>. Problems on some platforms with
214 how the C<C> C<croak> function is called have also been resolved.
215
216 =back
217
218 =head2 Removed Modules and Pragmata
219
220 =over 4
221
222 =item *
223
224 XXX
225
226 =back
227
228 =head1 Documentation
229
230 XXX Changes to files in F<pod/> go here.  Consider grouping entries by
231 file and be sure to link to the appropriate page, e.g. L<perlfunc>.
232
233 =head2 New Documentation
234
235 XXX Changes which create B<new> files in F<pod/> go here.
236
237 =head3 L<XXX>
238
239 XXX Description of the purpose of the new file here
240
241 =head2 Changes to Existing Documentation
242
243 XXX Changes which significantly change existing files in F<pod/> go here.
244 However, any changes to F<pod/perldiag.pod> should go in the L</Diagnostics>
245 section.
246
247 =head3 L<perlapi/Character classes>
248
249 =over 4
250
251 =item *
252
253 There are quite a few macros callable from XS modules that classify
254 characters into things like alphabetic, punctuation, etc.  More of these
255 are now documented, including ones which work on characters whose code
256 points are outside the Latin-1 range.
257
258 =back
259
260 =head1 Diagnostics
261
262 The following additions or changes have been made to diagnostic output,
263 including warnings and fatal error messages.  For the complete list of
264 diagnostic messages, see L<perldiag>.
265
266 XXX New or changed warnings emitted by the core's C<C> code go here.  Also
267 include any changes in L<perldiag> that reconcile it to the C<C> code.
268
269 =head2 New Diagnostics
270
271 XXX Newly added diagnostic messages go under here, separated into New Errors
272 and New Warnings
273
274 =head3 New Errors
275
276 =over 4
277
278 =item *
279
280 XXX L<message|perldiag/"message">
281
282 =back
283
284 =head3 New Warnings
285
286 =over 4
287
288 =item *
289
290 XXX L<message|perldiag/"message">
291
292 =back
293
294 =head2 Changes to Existing Diagnostics
295
296 XXX Changes (i.e. rewording) of diagnostic messages go here
297
298 =over 4
299
300 =item *
301
302 L<Constant(%s): Call to &{$^H{%s}} did not return a defined value|perldiag/Constant(%s): Call to &{$^H{%s}} did not return a defined value>
303
304 Constant overloading that returns C<undef> results in this error message.
305 For numeric constants, it used to say "Constant(undef)".  "undef" has been
306 replaced with the number itself. 
307
308 =back
309
310 =head1 Utility Changes
311
312 XXX Changes to installed programs such as F<perlbug> and F<xsubpp> go here.
313 Most of these are built within the directories F<utils> and F<x2p>.
314
315 [ List utility changes as a =head3 entry for each utility and =item
316 entries for each change
317 Use L<XXX> with program names to get proper documentation linking. ]
318
319 =head3 L<XXX>
320
321 =over 4
322
323 =item *
324
325 XXX
326
327 =back
328
329 =head1 Configuration and Compilation
330
331 XXX Changes to F<Configure>, F<installperl>, F<installman>, and analogous tools
332 go here.  Any other changes to the Perl build process should be listed here.
333 However, any platform-specific changes should be listed in the
334 L</Platform Support> section, instead.
335
336 [ List changes as a =item entry ].
337
338 =over 4
339
340 =item *
341
342 XXX
343
344 =back
345
346 =head1 Testing
347
348 XXX Any significant changes to the testing of a freshly built perl should be
349 listed here.  Changes which create B<new> files in F<t/> go here as do any
350 large changes to the testing harness (e.g. when parallel testing was added).
351 Changes to existing files in F<t/> aren't worth summarizing, although the bugs
352 that they represent may be covered elsewhere.
353
354 [ List each test improvement as a =item entry ]
355
356 =over 4
357
358 =item *
359
360 XXX
361
362 =back
363
364 =head1 Platform Support
365
366 XXX Any changes to platform support should be listed in the sections below.
367
368 [ Within the sections, list each platform as a =item entry with specific
369 changes as paragraphs below it. ]
370
371 =head2 New Platforms
372
373 XXX List any platforms that this version of perl compiles on, that previous
374 versions did not.  These will either be enabled by new files in the F<hints/>
375 directories, or new subdirectories and F<README> files at the top level of the
376 source tree.
377
378 =over 4
379
380 =item XXX-some-platform
381
382 XXX
383
384 =back
385
386 =head2 Discontinued Platforms
387
388 =over 4
389
390 =item BeOS
391
392 Support for BeOS has been removed.
393
394 =back
395
396 =head2 Platform-Specific Notes
397
398 XXX List any changes for specific platforms.  This could include configuration
399 and compilation changes or changes in portability/compatibility.  However,
400 changes within modules for platforms should generally be listed in the
401 L</Modules and Pragmata> section.
402
403 =over 4
404
405 =item XXX-some-platform
406
407 XXX
408
409 =back
410
411 =head1 Internal Changes
412
413 XXX Changes which affect the interface available to C<XS> code go here.  Other
414 significant internal changes for future core maintainers should be noted as
415 well.
416
417 [ List each change as a =item entry ]
418
419 =over 4
420
421 =item *
422
423 SvUPGRADE() is no longer an expression. Originally this macro (and its
424 underlying function, sv_upgrade()) were documented as boolean, although
425 in reality they always croaked on error and never returned false. In 2005
426 the documentation was updated to specify a void return value, but
427 SvUPGRADE() was left always returning 1 for backwards compatibility. This
428 has now been removed, and SvUPGRADE() is now a statement with no return
429 value.
430
431 So this is now a syntax error:
432
433     if (!SvUPGRADE(sv)) { croak(...); }
434
435 If you have code like that, simply replace it with
436
437     SvUPGRADE(sv);
438
439 or to to avoid compiler warnings with older perls, possibly
440
441     (void)SvUPGRADE(sv);
442
443 =item *
444
445 Perl has a new copy-on-write mechanism that allows any SvPOK scalar to be
446 upgraded to a copy-on-write scalar.  A reference count on the string buffer
447 is stored in the string buffer itself.
448
449 This breaks a few XS modules by allowing copy-on-write scalars to go
450 through code paths that never encountered them before.
451
452 This behaviour can still be disabled by running F<Configure> with
453 B<-Accflags=-DPERL_NO_COW>.  This option will probably be removed in Perl
454 5.20.
455
456 =item *
457
458 Copy-on-write no longer uses the SvFAKE and SvREADONLY flags.  Hence,
459 SvREADONLY indicates a true read-only SV.
460
461 Use the SvIsCOW macro (as before) to identify a copy-on-write scalar.
462
463 =item *
464
465 C<PL_sawampersand> is now a constant.  The switch this variable provided
466 (to enable/disable the pre-match copy depending on whether C<$&> had been
467 seen) has been removed and replaced with copy-on-write, eliminating a few
468 bugs.
469
470 The previous behaviour can still be enabled by running F<Configure> with
471 B<-Accflags=-DPERL_SAWAMPERSAND>.
472
473 =item *
474
475 PL_glob_index is gone.
476
477 =back
478
479 =head1 Selected Bug Fixes
480
481 XXX Important bug fixes in the core language are summarized here.  Bug fixes in
482 files in F<ext/> and F<lib/> are best summarized in L</Modules and Pragmata>.
483
484 [ List each fix as a =item entry ]
485
486 =over 4
487
488 =item *
489
490 C<sort {undef} ...> under fatal warnings no longer crashes.  It started
491 crashing in Perl 5.16.
492
493 =item *
494
495 Stashes blessed into each other
496 (C<bless \%Foo::, 'Bar'; bless \%Bar::, 'Foo'>) no longer result in double
497 frees.  This bug started happening in Perl 5.16.
498
499 =item *
500
501 Numerous memory leaks have been fixed, mostly involving fatal warnings and
502 syntax errors.
503
504 =item *
505
506 Lexical constants (C<my sub answer () { 42 }>) no longer cause double
507 frees.
508
509 =item *
510
511 Constant subroutine redefinition warns by default, but lexical constants
512 were accidentally exempt from default warnings.  This has been corrected.
513
514 =item *
515
516 Some failed regular expression matches such as C<'f' =~ /../g> were not
517 resetting C<pos>.  Also, "match-once" patterns (C<m?...?g>) failed to reset
518 it, too, when invoked a second time [perl #23180].
519
520 =item *
521
522 Accessing C<$&> after a pattern match now works if it had not been seen
523 before the match.  I.e., this applies to C<${'&'}> (under C<no strict>) and
524 C<eval '$&'>.  The same applies to C<$'> and C<$`> [perl #4289].
525
526 =item *
527
528 Several bugs involving C<local *ISA> and C<local *Foo::> causing stale
529 MRO caches have been fixed.  
530
531 =item *
532
533 Defining a subroutine when its typeglob has been aliased no longer results
534 in stale method caches.  This bug was introduced in Perl 5.10.
535
536 =item *
537
538 Localising a typeglob containing a subroutine when the typeglob's package
539 has been deleted from its parent stash no longer produces an error.  This
540 bug was introduced in Perl 5.14.
541
542 =item *
543
544 Under some circumstances, C<local *method=...> would fail to reset method
545 caches upon scope exit.
546
547 =item *
548
549 C</[.foo.]/> is no longer an error, but produces a warning (as before) and
550 is treated as C</[.fo]/> [perl #115818].
551
552 =item *
553
554 C<goto $tied_var> now calls FETCH before deciding what type of goto
555 (subroutine or label) this is.
556
557 =item *
558
559 Renaming packages through glob assignment
560 (C<*Foo:: = *Bar::; *Bar:: = *Baz::>) in combination with C<m?...?> and
561 C<reset> no longer makes threaded builds crash.
562
563 =item *
564
565 An earlier release in the 5.17.x series could crash if user code prevented
566 _charnames from loading via C<$INC{'_charnames.pm'}++>.
567
568 =back
569
570 =head1 Known Problems
571
572 XXX Descriptions of platform agnostic bugs we know we can't fix go here.  Any
573 tests that had to be C<TODO>ed for the release would be noted here.  Unfixed
574 platform specific bugs also go here.
575
576 [ List each fix as a =item entry ]
577
578 =over 4
579
580 =item *
581
582 XXX
583
584 =back
585
586 =head1 Obituary
587
588 XXX If any significant core contributor has died, we've added a short obituary
589 here.
590
591 =head1 Acknowledgements
592
593 XXX Generate this with:
594
595   perl Porting/acknowledgements.pl v5.17.6..HEAD
596
597 =head1 Reporting Bugs
598
599 If you find what you think is a bug, you might check the articles recently
600 posted to the comp.lang.perl.misc newsgroup and the perl bug database at
601 http://rt.perl.org/perlbug/ .  There may also be information at
602 http://www.perl.org/ , the Perl Home Page.
603
604 If you believe you have an unreported bug, please run the L<perlbug> program
605 included with your release.  Be sure to trim your bug down to a tiny but
606 sufficient test case.  Your bug report, along with the output of C<perl -V>,
607 will be sent off to perlbug@perl.org to be analysed by the Perl porting team.
608
609 If the bug you are reporting has security implications, which make it
610 inappropriate to send to a publicly archived mailing list, then please send it
611 to perl5-security-report@perl.org.  This points to a closed subscription
612 unarchived mailing list, which includes all the core committers, who will be
613 able to help assess the impact of issues, figure out a resolution, and help
614 co-ordinate the release of patches to mitigate or fix the problem across all
615 platforms on which Perl is supported.  Please only use this address for
616 security issues in the Perl core, not for modules independently distributed on
617 CPAN.
618
619 =head1 SEE ALSO
620
621 The F<Changes> file for an explanation of how to view exhaustive details on
622 what changed.
623
624 The F<INSTALL> file for how to build Perl.
625
626 The F<README> file for general stuff.
627
628 The F<Artistic> and F<Copying> files for copyright information.
629
630 =cut