This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldelta for e7d0a3fbd9 (tying PVMG COWs)
[perl5.git] / pod / perldelta.pod
1 =encoding utf8
2
3 =for comment
4 This has been completed up to e7d0a3fbd9, except for
5 e032854 khw     [perl #32080] is_utf8_string() reads too far
6 b0f2e9e nwclark Fix two bugs related to pod files outside of pod/ (important enough?)
7
8 =head1 NAME
9
10 [ this is a template for a new perldelta file. Any text flagged as
11 XXX needs to be processed before release. ]
12
13 perldelta - what is new for perl v5.15.6
14
15 =head1 DESCRIPTION
16
17 This document describes differences between the 5.15.5 release and
18 the 5.15.6 release.
19
20 If you are upgrading from an earlier release such as 5.15.4, first read
21 L<perl5155delta>, which describes differences between 5.15.4 and
22 5.15.5.
23
24 =head1 Notice
25
26 XXX Any important notices here
27
28 =head1 Core Enhancements
29
30 XXX New core language features go here. Summarise user-visible core language
31 enhancements. Particularly prominent performance optimisations could go
32 here, but most should go in the L</Performance Enhancements> section.
33
34 [ List each enhancement as a =head2 entry ]
35
36 =head2 C<__SUB__>
37
38 The new C<__SUB__> token, available under the "current_sub" feature (see
39 L<feature>) or C<use v5.15>, returns a reference to the current subroutine,
40 making it easier to write recursive closures.
41
42 =head2 New option for the debugger's B<t> command
43
44 The B<t> command in the debugger, which toggles tracing mode, now accepts a
45 numerical argument that determines how many levels of subroutine calls to
46 trace.
47
48 =head2 Return value of C<tied>
49
50 The value returned by C<tied> on a tied variable is now the actual scalar
51 that holds the object to which the variable is tied.  This allows ties to
52 be weakened with C<Scalar::Util::weaken(tied $tied_variable)>.
53
54 =head1 Security
55
56 XXX Any security-related notices go here.  In particular, any security
57 vulnerabilities closed should be noted here rather than in the
58 L</Selected Bug Fixes> section.
59
60 [ List each security issue as a =head2 entry ]
61
62 =head1 Incompatible Changes
63
64 XXX For a release on a stable branch, this section aspires to be:
65
66     There are no changes intentionally incompatible with 5.XXX.XXX
67     If any exist, they are bugs and reports are welcome.
68
69 [ List each incompatible change as a =head2 entry ]
70
71 =head2 C<substr> lvalue revamp
72
73 When C<substr> is called in lvalue or potential lvalue context with two or
74 three arguments, a special lvalue scalar is returned that modifies the
75 original string (the first argument) when assigned to.
76
77 Previously, the offsets (the second and third arguments) passed to
78 C<substr> would be converted immediately to match the string, negative
79 offsets being translated to positive and offsets beyond the end of the
80 string being truncated.
81
82 Now, the offsets are recorded without modification in the special lvalue
83 scalar that is returned, and the original string is not even looked at by
84 C<substr> itself, but only when the returned lvalue is read or modified.
85
86 These changes result in several incompatible changes and bug fixes:
87
88 =over
89
90 =item *
91
92 If the original string changes length after the call to C<substr> but
93 before assignment to its return value, negative offsets will remember
94 their position from the end of the string, affecting code like this:
95
96     my $string = "string";
97     my $lvalue = \substr $string, -4, 2;
98     print $lvalue, "\n"; # prints "ri"
99     $string = "bailing twine";
100     print $lvalue, "\n"; # prints "wi"; used to print "il"
101
102 The same thing happens with an omitted third argument.  The returned lvalue
103 will always extend to the end of the string, even if the string becomes
104 longer.
105
106 =item *
107
108 Tied (and otherwise magical) variables are no longer exempt from the
109 "Attempt ot use reference as lvalue in substr" warning.
110
111 =item *
112
113 That warning now occurs when the returned lvalue is assigned to, not when
114 C<substr> itself is called.  This only makes a difference if the return
115 value of C<substr> is referenced and assigned to later.
116
117 =item *
118
119 The order in which "uninitialized" warnings occur for arguments to
120 C<substr> has changed.
121
122 =item *
123
124 Passing a substring of a read-only value or a typeglob to a function (potential lvalue context) no longer causes an immediate "Can't coerce" or "Modification of a read-only value" error.  That error only occurs if and
125 when the value passed is assigned to.
126
127 The same thing happens with the "substr outside of string" error.  If the
128 lvalue is only read, not written to, it is now just a warning, as with
129 rvalue C<substr>.
130
131 =item *
132
133 C<substr> assignments no longer call FETCH twice if the first argument is a
134 tied variable, but just once.
135
136 =back
137
138 It was impossible to fix all the bugs without an incompatible change, and
139 the behaviour of negative offsets was never specified, so the change was
140 deemed acceptable.
141
142 =head2 XS API tweak
143
144 The C<newCONSTSUB_flags> C-level function, added in 5.15.4, now has a
145 C<len> parameter.
146
147 =head1 Deprecations
148
149 XXX Any deprecated features, syntax, modules etc. should be listed here.
150 In particular, deprecated modules should be listed here even if they are
151 listed as an updated module in the L</Modules and Pragmata> section.
152
153 [ List each deprecation as a =head2 entry ]
154
155 =head1 Performance Enhancements
156
157 XXX Changes which enhance performance without changing behaviour go here. There
158 may well be none in a stable release.
159
160 [ List each enhancement as a =item entry ]
161
162 =over 4
163
164 =item *
165
166 Perl 5.12.0 sped up the destruction of objects whose classes define empty
167 C<DESTROY> methods (to prevent autoloading), simply by not calling such
168 empty methods.  This release takes this optimisation a step further, by not
169 calling any C<DESTROY> method that begins with an C<return> statement.
170 This can be useful for destructors that are only used for debugging:
171
172     use constant DEBUG => 1;
173     sub DESTROY { return unless DEBUG; ... }
174
175 Constant-folding will reduce the first statement to C<return;> if DEBUG is
176 set to 0, triggering this optimisation.
177
178 =item *
179
180 Assign to a variable that holds a typeglob or copy-on-write scalar is now
181 much faster.  Previously the typeglob would be stringified or the
182 copy-on-write scalar would be copied before being clobbered.
183
184 =item *
185
186 Assignment to a substring in void context is now more than twice its
187 previous speed.  Instead of creating and returning a special lvalue scalar
188 that is then assigned to, C<substr> modifies the original string itself.
189
190 =back
191
192 =head1 Modules and Pragmata
193
194 XXX All changes to installed files in F<cpan/>, F<dist/>, F<ext/> and F<lib/>
195 go here.  If Module::CoreList is updated, generate an initial draft of the
196 following sections using F<Porting/corelist-perldelta.pl>, which prints stub
197 entries to STDOUT.  Results can be pasted in place of the '=head2' entries
198 below.  A paragraph summary for important changes should then be added by hand.
199 In an ideal world, dual-life modules would have a F<Changes> file that could be
200 cribbed.
201
202 [ Within each section, list entries as a =item entry ]
203
204 =head2 New Modules and Pragmata
205
206 =over 4
207
208 =item *
209
210 XXX
211
212 =back
213
214 =head2 Updated Modules and Pragmata
215
216 =over 4
217
218 =item *
219
220 L<Archive::Tar> has been upgraded from version 1.80 to version 1.82.
221
222 Adjustments to handle files >8gb (>0777777777777 octal) and a feature to
223 return the MD5SUM of files in the archive.
224
225 =item *
226
227 L<AutoLoader> has been upgraded from version 5.71 to version 5.72.
228
229 =item *
230
231 L<B::Debug> has been upgraded from version 1.16 to version 1.17.
232
233 =item *
234
235 L<B::Deparse> has been upgraded from version 1.09 to 1.10.
236
237 C<sort(foo(bar))> is now deparsed correctly. (C<sort foo(bar)>, how it used
238 to deparse, makes foo the sort routine, rather than a regular function
239 call.)
240
241 =item *
242
243 L<Compress::Raw::Zlib> has been upgraded from version 2.042 to version 2.045.
244
245 =item *
246
247 L<Compress::Raw::Bzip2> has been upgraded from version 2.042 to version 2.045.
248
249 =item *
250
251 L<CPANPLUS> has been upgraded from version 0.9112 to version 0.9113.
252
253 =item *
254
255 L<Data::Dumper> has been upgraded from version 2.134 to 2.135.
256
257 The XS implementation has been updated to account for the Unicode symbol
258 changes in Perl 5.15.4.  It also knows how to output typeglobs with nulls
259 in their names.
260
261 =item *
262
263 L<ExtUtils::ParseXS> has been upgraded from version 3.05 to version 3.07.
264
265 =item *
266
267 L<IO::Compress::Base> has been upgraded from version 2.042 to version 2.045.
268
269 Added zipdetails utility.
270
271 =item *
272
273 L<Locale::Codes> has been upgraded from version 3.18 to version 3.20.
274
275 The code2XXX, XXX2code, all_XXX_codes, and all_XXX_names functions now support retired codes.
276 All codesets may be specified by a constant or by their name now. Previously,
277 they were specified only by a constant.
278 The alias_code function exists for backward compatibility. It has been replaced by rename_country_code.
279 The alias_code function will be removed sometime after September, 2013.
280 All work is now done in the central module (Locale::Codes). Previously, some was still done in the
281 wrapper modules (Locale::Codes::*) but that is gone now.
282 Added Language Family codes (langfam) as defined in ISO 639-5.
283
284 =item *
285
286 L<Module::Loaded> has been uprgaded from version 0.06 to version 0.08.
287
288 =item *
289
290 L<Pod::LaTeX> has been upgraded from version 0.59 to version 0.60.
291
292 Added another LaTeX escape: --- => -{}-{}-
293
294 Pod::LaTeX doesn't handle -- in PODs specially, passing it directly to
295 LaTeX, which then proceeds to replace it with a single -. This patch
296 replaces ----- with -{}-{}-{}-{}-
297
298 =item *
299
300 L<POSIX> has been upgraded from version 1.26 to 1.27.
301
302 It no longer produces a "Constant subroutine TCSANOW redefined" warning on
303 Windows.
304
305 XXX When did it start producing that warning?  Was it post-5.15.5?  Even if
306 it was not, adding a note will help whoever compiles perl5160delta.
307
308 =item *
309
310 L<Socket> has been upgraded from version 1.94_02 to version 1.96.
311
312 =item *
313
314 L<Unicode::Collate> has been upgraded from version 0.85 to version 0.87.
315
316 Tailored compatibility ideographs as well as unified ideographs for
317 the locales: ja, ko, zh__big5han, zh__gb2312han, zh__pinyin, zh__stroke.
318
319 Now Locale/*.pl files are searched in @INC.
320
321 =item *
322
323 L<UNIVERSAL> has been upgraded from version 1.10 to 1.11.
324
325 Documentation change clarifies return values from UNIVERSAL::VERSION.
326
327 =back
328
329 =head2 Removed Modules and Pragmata
330
331 =over 4
332
333 =item *
334
335 XXX
336
337 =back
338
339 =head1 Documentation
340
341 XXX Changes to files in F<pod/> go here.  Consider grouping entries by
342 file and be sure to link to the appropriate page, e.g. L<perlfunc>.
343
344 =head2 New Documentation
345
346 XXX Changes which create B<new> files in F<pod/> go here.
347
348 =head3 L<XXX>
349
350 XXX Description of the purpose of the new file here
351
352 =head2 Changes to Existing Documentation
353
354 XXX Changes which significantly change existing files in F<pod/> go here.
355 However, any changes to F<pod/perldiag.pod> should go in the L</Diagnostics>
356 section.
357
358 =head3 L<XXX>
359
360 =over 4
361
362 =item *
363
364 XXX Description of the change here
365
366 =back
367
368 =head1 Diagnostics
369
370 The following additions or changes have been made to diagnostic output,
371 including warnings and fatal error messages.  For the complete list of
372 diagnostic messages, see L<perldiag>.
373
374 XXX New or changed warnings emitted by the core's C<C> code go here. Also
375 include any changes in L<perldiag> that reconcile it to the C<C> code.
376
377 [ Within each section, list entries as a =item entry that links to perldiag,
378   e.g.
379
380   =item *
381
382   L<Invalid version object|perldiag/"Invalid version object">
383 ]
384
385 =head2 New Diagnostics
386
387 XXX Newly added diagnostic messages go here
388
389 =head3 New Errors
390
391 =over 4
392
393 =item *
394
395 XXX L<message|perldiag/"message">
396
397 =back
398
399 =head3 New Warnings
400
401 =over 4
402
403 =item *
404
405 XXX L<message|perldiag/"message">
406
407 =back
408
409 =head2 Changes to Existing Diagnostics
410
411 XXX Changes (i.e. rewording) of diagnostic messages go here
412
413 =over 4
414
415 =item *
416
417 Redefinition warnings for constant subroutines used to be mandatory, even
418 occurring under C<no warnings>.  Now they respect the L<warnings> pragma.
419
420 =item *
421
422 The "Attempt to free non-existent shared string" has had the spelling of
423 "non-existent" corrected to "nonexistent".  It was already listed with the
424 correct spelling in L<perldiag>.
425
426 =item *
427
428 The 'Use of "foo" without parentheses is ambiguous' warning has been
429 extended to apply also to user-defined subroutines with a (;$) prototype,
430 and not just to built-in functions.
431
432 =back
433
434 =head1 Utility Changes
435
436 XXX Changes to installed programs such as F<perlbug> and F<xsubpp> go
437 here. Most of these are built within the directories F<utils> and F<x2p>.
438
439 [ List utility changes as a =head3 entry for each utility and =item
440 entries for each change
441 Use L<XXX> with program names to get proper documentation linking. ]
442
443 =head3 L<zipdetails>
444
445 =over 4
446
447 =item *
448
449 L<zipdetails> displays information about the internal record structure of the zip file.
450 It is not concerned with displaying any details of the compressed data stored in the zip file.
451
452 =back
453
454 =head1 Configuration and Compilation
455
456 XXX Changes to F<Configure>, F<installperl>, F<installman>, and analogous tools
457 go here.  Any other changes to the Perl build process should be listed here.
458 However, any platform-specific changes should be listed in the
459 L</Platform Support> section, instead.
460
461 [ List changes as a =item entry ].
462
463 =over 4
464
465 =item *
466
467 F<pod/roffitall> is now build by F<pod/buildtoc>, instead of being shipped
468 with the distribution. Its list of manpages is now generated (and therefore
469 current). See also RT #103202 for an unresolved related issue.
470
471 =item *
472
473 Perl 5.15.5 had a bug in its installation script, which did not install
474 F<unicore/Name.pm>.  This has been corrected [perl #104226].
475
476 XXX Is that Perl version correct?  Is the file path correct?
477
478 =back
479
480 =head1 Testing
481
482 XXX Any significant changes to the testing of a freshly built perl should be
483 listed here.  Changes which create B<new> files in F<t/> go here as do any
484 large changes to the testing harness (e.g. when parallel testing was added).
485 Changes to existing files in F<t/> aren't worth summarising, although the bugs
486 that they represent may be covered elsewhere.
487
488 [ List each test improvement as a =item entry ]
489
490 =over 4
491
492 =item *
493
494 The F<substr.t> and F<substr_thr.t> scripts for testing C<substr> have been
495 moved under F<t/op/>, where they were originally.  They had been moved
496 under F<t/re/> along with the substitution tests when that directory was
497 created.
498
499 =back
500
501 =head1 Platform Support
502
503 XXX Any changes to platform support should be listed in the sections below.
504
505 [ Within the sections, list each platform as a =item entry with specific
506 changes as paragraphs below it. ]
507
508 =head2 New Platforms
509
510 XXX List any platforms that this version of perl compiles on, that previous
511 versions did not. These will either be enabled by new files in the F<hints/>
512 directories, or new subdirectories and F<README> files at the top level of the
513 source tree.
514
515 =over 4
516
517 =item XXX-some-platform
518
519 XXX
520
521 =back
522
523 =head2 Discontinued Platforms
524
525 XXX List any platforms that this version of perl no longer compiles on.
526
527 =over 4
528
529 =item XXX-some-platform
530
531 XXX
532
533 =back
534
535 =head2 Platform-Specific Notes
536
537 XXX List any changes for specific platforms. This could include configuration
538 and compilation changes or changes in portability/compatibility.  However,
539 changes within modules for platforms should generally be listed in the
540 L</Modules and Pragmata> section.
541
542 =over 4
543
544 =item XXX-some-platform
545
546 XXX
547
548 =back
549
550 =head1 Internal Changes
551
552 XXX Changes which affect the interface available to C<XS> code go here.
553 Other significant internal changes for future core maintainers should
554 be noted as well.
555
556 [ List each change as a =item entry ]
557
558 =over 4
559
560 =item *
561
562 XXX
563
564 =back
565
566 =head1 Selected Bug Fixes
567
568 XXX Important bug fixes in the core language are summarised here.
569 Bug fixes in files in F<ext/> and F<lib/> are best summarised in
570 L</Modules and Pragmata>.
571
572 [ List each fix as a =item entry ]
573
574 =over 4
575
576 =item *
577
578 A constant subroutine assigned to a glob whose name contains a null will no
579 longer cause extra globs to pop into existence when the constant is
580 referenced under its new name.
581
582 =item *
583
584 C<sort> was not treating C<sub {}> and C<sub {()}> as equivalent when such
585 a sub was provided as the comparison routine.  It used to croak on
586 C<sub {()}>.
587
588 =item *
589
590 Subroutines from the C<autouse> namespace are once more exempt from
591 redefinition warnings.  This used to work in 5.005, but was broken in 5.6
592 for most subroutines.  For subs created via XS that redefine subroutines
593 from the C<autouse> package, this stopped working in 5.10.
594
595 =item *
596
597 New XSUBs now produce redefinition warnings if they overwrite existing
598 subs, as they did in 5.8.x.  (The C<autouse> logic was reversed in 5.10-14.
599 Only subroutines from the C<autouse> namespace would warn when clobbered.)
600
601 =item *
602
603 Redefinition warnings triggered by the creation of XSUBs now respect
604 Unicode glob names, instead of using the internal representation.  This was
605 missed in 5.15.4, partly because this warning was so hard to trigger.  (See
606 the previous item.)
607
608 =item *
609
610 C<newCONSTSUB> used to use compile-time warning hints, instead of run-time
611 hints.  The following code should never produce a redefinition warning, but
612 it used to, if C<newCONSTSUB> redefine and existing subroutine:
613
614     use warnings;
615     BEGIN {
616         no warnings;
617         some_XS_function_that_calls_new_CONSTSUB();
618     }
619
620 =item *
621
622 Redefinition warnings for constant subroutines are on by default (what are
623 known as severe warnings in L<perldiag>).  This was only the case when it
624 was a glob assignment or declaration of a Perl subroutine that caused the
625 warning.  If the creation of XSUBs triggered the warning, it was not a
626 default warning.  This has been corrected.
627
628 =item *
629
630 The internal check to see whether a redefinition warning should occur used
631 to emit "uninitialized" warnings in cases like this:
632
633     use warnings "uninitialized";
634     use constant {u=>undef,v=>undef};
635     sub foo(){u} sub foo(){v}
636
637 =item *
638
639 A bug fix in Perl 5.14 introduced a new bug, causing "uninitialized"
640 warnings to report the wrong variable if the operator in question has
641 two operands and one is C<%{...}> or C<@{...}>.  This has been fixed
642 [perl #103766].
643
644 =item *
645
646 C<< version->new("version") >> and C<printf "%vd", "version"> no longer
647 crash [perl #102586].
648
649 =item *
650
651 C<$tied =~ y/a/b/>, C<chop $tied> and C<chomp $tied> now call FETCH just
652 once when $tied holds a reference.
653
654 =item *
655
656 Four-argument C<select> now always calls FETCH on tied arguments.  It used
657 to skip the call if the tied argument happened to hold C<undef> or a
658 typeglob.
659
660 =item *
661
662 Four-argument C<select> no longer produces its "Non-string passed as
663 bitmask" warning on tied or tainted variables that are strings.
664
665 =item *
666
667 C<sysread> now always calls FETCH on the buffer passed to it if it is tied.
668 It used to skip the call if the tied variable happened to hold a typeglob.
669
670 =item *
671
672 C<< $tied .= <> >> now calls FETCH once on C<$tied>.  It used to call it
673 multiple times if the last value assigned to or returned from the tied
674 variable was anything other than a string or typeglob.
675
676 =item *
677
678 The C<evalbytes> keyword added in 5.15.5 was respecting C<use utf8>
679 declarations from the outer scope, when it should have been ignoring them.
680
681 =item *
682
683 C<goto &func> no longers crashes, but produces an error message, when the
684 unwinding of the current subroutine's scope fires a destructor that
685 undefines the subroutine being "goneto" [perl #99850].
686
687 =item *
688
689 Arithmetic assignment (C<$left += $right>) involving overloaded objects that
690 rely on the 'nomethod' override no longer segfault when the left operand is not
691 overloaded.
692
693 =item *
694
695 Assigning C<__PACKAGE__> or any other shared hash key scalar to a stash
696 element no longer causes a double free.  Regardless of this change, the
697 results of such assignments are still undefined.
698
699 =item *
700
701 Creating a C<UNIVERSAL::AUTOLOAD> sub no longer stops C<%+>, C<%-> and
702 C<%!> from working some of the time [perl #105024].
703
704 =item *
705
706 Assigning C<__PACKAGE__> or another shared hash key string to a variable no
707 longer stops that variable from being tied if it happens to be a PVMG or
708 PVLV internally.
709
710 =back
711
712 =head1 Known Problems
713
714 XXX Descriptions of platform agnostic bugs we know we can't fix go here. Any
715 tests that had to be C<TODO>ed for the release would be noted here, unless
716 they were specific to a particular platform (see below).
717
718 This is a list of some significant unfixed bugs, which are regressions
719 from either 5.XXX.XXX or 5.XXX.XXX.
720
721 [ List each fix as a =item entry ]
722
723 =over 4
724
725 =item *
726
727 XXX
728
729 =back
730
731 =head1 Obituary
732
733 XXX If any significant core contributor has died, we've added a short obituary
734 here.
735
736 =head1 Acknowledgements
737
738 XXX Generate this with:
739
740   perl Porting/acknowledgements.pl v5.15.5..HEAD
741
742 =head1 Reporting Bugs
743
744 If you find what you think is a bug, you might check the articles
745 recently posted to the comp.lang.perl.misc newsgroup and the perl
746 bug database at http://rt.perl.org/perlbug/ .  There may also be
747 information at http://www.perl.org/ , the Perl Home Page.
748
749 If you believe you have an unreported bug, please run the L<perlbug>
750 program included with your release.  Be sure to trim your bug down
751 to a tiny but sufficient test case.  Your bug report, along with the
752 output of C<perl -V>, will be sent off to perlbug@perl.org to be
753 analysed by the Perl porting team.
754
755 If the bug you are reporting has security implications, which make it
756 inappropriate to send to a publicly archived mailing list, then please send
757 it to perl5-security-report@perl.org. This points to a closed subscription
758 unarchived mailing list, which includes
759 all the core committers, who will be able
760 to help assess the impact of issues, figure out a resolution, and help
761 co-ordinate the release of patches to mitigate or fix the problem across all
762 platforms on which Perl is supported. Please only use this address for
763 security issues in the Perl core, not for modules independently
764 distributed on CPAN.
765
766 =head1 SEE ALSO
767
768 The F<Changes> file for an explanation of how to view exhaustive details
769 on what changed.
770
771 The F<INSTALL> file for how to build Perl.
772
773 The F<README> file for general stuff.
774
775 The F<Artistic> and F<Copying> files for copyright information.
776
777 =cut