This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
more proofreading
[perl5.git] / pod / perldelta.pod
1 =encoding utf8
2
3 =head1 NAME
4
5 perldelta - what is new for perl v5.17.1
6
7 =head1 DESCRIPTION
8
9 This document describes differences between the 5.17.0 release and
10 the 5.17.1 release.
11
12 If you are upgrading from an earlier release such as 5.16.0, first read
13 L<perl5170delta>, which describes differences between 5.16.0 and
14 5.17.0.
15
16 =head1 Core Enhancements
17
18 =head2 More CORE:: subs
19
20 Several more built-in functions have been added as subroutines to the
21 CORE:: namespace, namely, those non-overridable keywords that can be
22 implemented without custom parsers: C<defined>, C<delete>, C<exists>,
23 C<glob>, C<pos>, C<protoytpe>, C<scalar>, C<split>, C<study>, and C<undef>.
24
25 As some of these have prototypes, C<prototype('CORE::...')> has been
26 changed to not make a distinction between overridable and non-overridable
27 keywords.  This is to make C<prototype('CORE::pos')> consistent with
28 C<prototype(&CORE::pos)>.
29
30 =head1 Incompatible Changes
31
32 =head2 C</(?{})/> and C</(??{})/> have been heavily reworked
33
34 The implementation of this feature has been almost completely rewritten.
35 Although its main intent is to fix bugs, some behaviors, especially
36 related to the scope of lexical variables, will have changed.  This is
37 described more fully in the L</Selected Bug Fixes> section.
38
39 =head2 C<\N{BELL}> now refers to U+1F514 instead of U+0007
40
41 Unicode 6.0 reused the name "BELL" for a different code point than it
42 traditionally had meant.  Since Perl v5.14, use of this name still
43 referred to U+0007, but would raise a deprecation warning.  Now, "BELL"
44 refers to U+1F514, and the name for U+0007 is "ALERT".  All the
45 functions in L<charnames> have been correspondingly updated.
46
47 =head2 Alphanumeric operators must now be separated from the closing
48 delimiter of regular expressions
49
50 You may no longer write something like:
51
52  m/a/and 1
53
54 Instead you must write
55
56  m/a/ and 1
57
58 with whitespace separating the operator from the closing delimiter of
59 the regular expression.  Not having whitespace has resulted in a
60 deprecation warning since Perl v5.14.0.
61
62 =head2 C<require> dies for unreadable files
63
64 When C<require> encounters an unreadable file, it now dies.  It used to
65 ignore the file and continue searching the directories in @INC
66 [perl #113422].
67
68 =head2 Upgrade to the Unicode 6.2 beta
69
70 Unicode 6.2 is proposing some changes that may very well break some CPAN
71 modules.  The timing of this nicely coincides with Perl's being early in the
72 release cycle.  This commit takes the current beta 6.2, adds the proposed
73 changes that aren't yet in it, and subtracts the changes that would affect \X
74 processing, as those turn out to have errors, and may have to be rethought.
75 Unicode has been notified of these problems.
76
77 This will allow us to gather data as to whether or not the proposed changes
78 cause us problems.  These will be presented to Unicode to aid in their final
79 decision as to whether or not to go forward with the changes.
80
81 These changes will be replaced by the final version of Unicode 6.2 before
82 5.18.0 is released.
83
84 =head1 Performance Enhancements
85
86 =over 4
87
88 =item *
89
90 The C<x> repetition operator is now folded to a single constant at compile
91 time if called in scalar context with constant operands and no parentheses
92 around the left operand.
93
94 =back
95
96 =head1 Modules and Pragmata
97
98 =head2 Updated Modules and Pragmata
99
100 =over 4
101
102 =item *
103
104 L<Archive::Extract> has been upgraded from version 0.58 to 0.60.
105
106 Work around an edge case on Linux with Busybox's unzip.
107
108 =item *
109
110 L<Archive::Tar> has been upgraded from version 1.82 to 1.88.
111
112 ptar now supports the -T option as well as dashless options
113 [rt.cpan.org #75473], [rt.cpan.org #75475].
114
115 Auto-encode filenames marked as UTF-8 [rt.cpan.org #75474].
116
117 Don't use C<tell> on L<IO::Zlib> handles [rt.cpan.org #64339].
118
119 Don't try to C<chown> on symlinks.
120
121 =item *
122
123 L<attributes> has been upgraded from version 0.19 to 0.20.
124
125 =item *
126
127 L<autodie> has been upgraded from version 2.10 to 2.11.
128
129 =item *
130
131 L<B> has been upgraded from version 1.35 to 1.36.
132
133 C<B::COP::stashlen> has been replaced with C<B::COP::stashoff>.
134
135 C<B::COP::stashpv> now supports UTF-8 package names and embedded NULs.
136
137 =item *
138
139 L<B::Deparse> has been upgraded from version 1.14 to 1.15.
140
141 Avoid warning when run under C<perl -w>.
142
143 =item *
144
145 L<Class::Struct> has been upgraded from version 0.63 to 0.64.
146
147 The constructor now respects overridden accessor methods [perl #29230].
148
149 =item *
150
151 L<Compress::Raw::Bzip2> has been upgraded from version 2.048 to 2.052.
152
153 =item *
154
155 L<Compress::Raw::Zlib> has been upgraded from version 2.048 to 2.054.
156
157 Upgrade bundled zlib to version 1.2.7.
158
159 Fix build failures on Irix, Solaris, and Win32, and also when building as C++
160 [rt.cpan.org #69985], [rt.cpan.org #77030], [rt.cpan.org #75222].
161
162 =item *
163
164 L<CPAN::Meta> has been upgraded from version 2.120630 to 2.120921.
165
166 =item *
167
168 L<CPAN::Meta::Requirements> has been upgraded from version 2.120630 to 2.122.
169
170 Treat undef requirements to C<from_string_hash> as 0 (with a warning).
171
172 Added C<requirements_for_module> method.
173
174 =item *
175
176 L<CPAN::Meta::YAML> has been upgraded from version 0.007 to 0.008.
177
178 =item *
179
180 L<CPANPLUS> has been upgraded from version 0.9121 to 0.9130.
181
182 Allow adding F<blib/script> to PATH.
183
184 Save the history between invocations of the shell.
185
186 Handle multiple C<makemakerargs> and C<makeflags> arguments better.
187
188 Use C<File::HomeDir> when available, and provide C<PERL5_CPANPLUS_HOME> to
189 override the autodetection.
190
191 Always re-fetch F<CHECKSUMS> if C<fetchdir> is set.
192
193 =item *
194
195 L<Digest::MD5> has been upgraded from version 2.51 to 2.52.
196
197 Fix C<Digest::Perl::MD5> OO fallback [rt.cpan.org #66634].
198
199 =item *
200
201 L<DynaLoader> has been upgraded from version 1.14 to 1.15.
202
203 This is due to a minor code change in the XS for the VMS implementation.
204
205 =item *
206
207 L<ExtUtils::CBuilder> has been upgraded from version 0.280206 to 0.280208.
208
209 Manifest files are now correctly embedded for those versions of VC++ which
210 make use of them. [perl #111782, #111798].
211
212 =item *
213
214 L<File::DosGlob> has been upgraded from version 1.07 to 1.08.
215
216 =item *
217
218 L<File::Fetch> has been upgraded from version 0.32 to 0.34.
219
220 =item *
221
222 L<File::Spec::Unix> has been upgraded from version 3.39_02 to 3.39_03.
223
224 C<abs2rel> could produce incorrect results when given two relative paths or
225 the root directory twice [perl #111510].
226
227 =item *
228
229 L<Filter::Util::Call> has been upgraded from version 1.40 to 1.45.
230
231 =item *
232
233 L<HTTP::Tiny> has been upgraded from version 0.017 to 0.022.
234
235 Add SSL verification features [github #6], [github #9].
236
237 Include the final URL in the response hashref.
238
239 Add C<local_address> option.
240
241 =item *
242
243 L<IO> has been upgraded from version 1.25_06 to 1.25_07.
244
245 C<sync()> can now be called on read-only file handles [perl #64772].
246
247 =item *
248
249 L<IPC::Cmd> has been upgraded from version 0.76 to 0.78.
250
251 Use C<POSIX::_exit> instead of C<exit> in C<run_forked> [rt.cpan.org #76901].
252
253 =item *
254
255 L<Memoize> has been upgraded from version 1.02 to 1.03.
256
257 Fix the C<MERGE> cache option.
258
259 =item *
260
261 L<Module::Build> has been upgraded from version 0.39_01 to 0.40.
262
263 Fixed bug where modules without C<$VERSION> might have a version of '0' listed
264 in 'provides' metadata, which will be rejected by PAUSE.
265
266 Fixed bug in PodParser to allow numerals in module names.
267
268 Fixed bug where giving arguments twice led to them becoming arrays, resulting
269 in install paths like F<ARRAY(0xdeadbeef)/lib/Foo.pm>.
270
271 =item *
272
273 L<Module::Load::Conditional> has been upgraded from version 0.46 to 0.50.
274
275 Fix use of C<requires> on perls installed to a path with spaces.
276
277 =item *
278
279 L<Object::Accessor> has been upgraded from version 0.42 to 0.44.
280
281 =item *
282
283 L<Params::Check> has been upgraded from version 0.32 to 0.36.
284
285 =item *
286
287 L<Parse::CPAN::Meta> has been upgraded from version 1.4402 to 1.4404.
288
289 =item *
290
291 L<PerlIO::mmap> has been upgraded from version 0.010 to 0.011.
292
293 =item *
294
295 L<PerlIO::via::QuotedPrint> has been upgraded from version 0.06 to 0.07.
296
297 =item *
298
299 L<Pod::Html> has been upgraded from version 1.15_02 to 1.16.
300
301 The option C<--libpods> has been reinstated. It is deprecated, and its use
302 does nothing other than issue a warning that it is no longer supported.
303
304 Since the HTML files generated by pod2html claim to have a UTF-8 charset,
305 actually write the files out using UTF-8 [perl #111446].
306
307 =item *
308
309 L<POSIX> has been upgraded from version 1.30 to 1.31.
310
311 =item *
312
313 L<re> has been upgraded from version 0.19 to 0.20.
314
315 See note about C<op_comp> in the L</Internal Changes> section below.
316
317 =item *
318
319 L<Safe> has been upgraded from version 2.31_01 to 2.33_01.
320
321 Fix interactions with C<Devel::Cover>.
322
323 Don't eval code under C<no strict>.
324
325 =item *
326
327 L<Scalar::Util> has been upgraded from version 1.23 to version 1.25.
328
329 Fix an overloading issue with C<sum>.
330
331 C<first> and C<reduce> now check the callback first (so C<&first(1)> is
332 disallowed).
333
334 Fix C<tainted> on magical values [rt.cpan.org #55763].
335
336 Fix C<sum> on previously magical values [rt.cpan.org #61118].
337
338 Fix reading past the end of a fixed buffer [rt.cpan.org #72700].
339
340 =item *
341
342 L<Search::Dict> has been upgraded from version 1.04 to 1.07.
343
344 No longer require C<stat> on filehandles.
345
346 Use C<fc> for casefolding.
347
348 =item *
349
350 L<Storable> has been upgraded from version 2.35 to 2.36.
351
352 =item *
353
354 L<Term::ANSIColor> has been upgraded from version 3.01 to 3.02.
355
356 Add support for italics.
357
358 Improve error handling.
359
360 =item *
361
362 L<Test::Harness> has been upgraded from version 3.23 to 3.25.
363
364 Fix glob semantics on Win32 [rt.cpan.org #49732].
365
366 Don't use C<Win32::GetShortPathName> when calling perl [rt.cpan.org #47890].
367
368 Ignore -T when reading shebang [rt.cpan.org #64404].
369
370 Handle the case where we don't know the wait status of the test more
371 gracefully.
372
373 Make the test summary 'ok' line overridable so that it can be changed to a
374 plugin to make the output of prove idempotent.
375
376 Don't run world-writable files.
377
378 =item *
379
380 L<Unicode::UCD> has been upgraded from version 0.43 to 0.44.
381
382 This adds a function L<all_casefolds()|Unicode::UCD/all_casefolds()>
383 that returns all the casefolds.
384
385 =back
386
387 =head1 Documentation
388
389 =head2 Changes to Existing Documentation
390
391 =head3 L<perlfaq>
392
393 =over 4
394
395 =item *
396
397 L<perlfaq> has been synchronized with version 5.0150040 from CPAN.
398
399 =back
400
401 =head3 L<perlcheat>
402
403 =over 4
404
405 =item *
406
407 L<perlcheat> has been reorganized, and a few new sections were added.
408
409 =back
410
411 =head1 Diagnostics
412
413 =head2 Removals of Diagnostics
414
415 =over 4
416
417 =item *
418
419 The "Runaway prototype" warning that occurs in bizarre cases has been
420 removed as being unhelpful and inconsistent.
421
422 =item *
423
424 The "Not a format reference" error has been removed, as the only case in
425 which it could be triggered was a bug.
426
427 =item *
428
429 The "Unable to create sub named %s" error has been removed for the same
430 reason.
431
432 =back
433
434 =head1 Platform Support
435
436 =head2 Platform-Specific Notes
437
438 =over 4
439
440 =item Win32
441
442 C<link> on Win32 now attempts to set C<$!> to more appropriate values
443 based on the Win32 API error code. [perl #112272]
444
445 Perl no longer mangles the environment block, e.g. when launching a new
446 sub-process, when the environment contains non-ASCII characters. Known
447 problems still remain, however, when the environment contains characters
448 outside of the current ANSI codepage (e.g. see the item about Unicode in
449 C<%ENV> in L<http://perl5.git.perl.org/perl.git/blob/HEAD:/Porting/todo.pod>).
450 [perl #113536]
451
452 =back
453
454 =head1 Internal Changes
455
456 =over 4
457
458 =item *
459
460 The C<study> function was made a no-op in 5.16.  It was simply disabled via
461 a C<return> statement; the code was left in place.  Now the code supporting
462 what C<study> used to do has been removed.
463
464 =item *
465
466 Under threaded perls, there is no longer a separate PV allocated for every
467 COP to store its package name (C<< cop->stashpv >>).  Instead, there is an
468 offset (C<< cop->stashoff >>) into the new C<PL_stashpad> array, which
469 holds stash pointers.
470
471 =item *
472
473 In the pluggable regex API, the C<regexp_engine> struct has acquired a new
474 field C<op_comp>, which is currently just for perl's internal use, and
475 should be initialised to NULL by other regex plugin modules.
476
477 =item *
478
479 A new function C<alloccoptash> has been added to the API, but is considered
480 experimental.  See L<perlapi>.
481
482 =back
483
484 =head1 Selected Bug Fixes
485
486 =over 4
487
488 =item *
489
490 The implementation of code blocks in regular expressions, such as C<(?{})>
491 and C<(??{})>, has been heavily reworked to eliminate a whole slew of bugs.
492 The main user-visible changes are:
493
494 =over 4
495
496 =item *
497
498 Code blocks within patterns are now parsed in the same pass as the
499 surrounding code; in particular it is no longer necessary to have balanced
500 braces: this now works:
501
502     /(?{  $x='{'  })/
503
504 This means that this error message is longer generated:
505
506     Sequence (?{...}) not terminated or not {}-balanced in regex
507
508 but a new error may be seen:
509
510     Sequence (?{...}) not terminated with ')'
511
512 In addition, literal code blocks within run-time patterns are only
513 compiled once, at perl compile-time:
514
515     for my $p (...) {
516         # this 'FOO' block of code is compiled once,
517         # at the same time as the surrounding 'for' loop
518         /$p{(?{FOO;})/;
519     }
520
521 =item *
522
523 Lexical variables are now sane as regards scope, recursion and closure
524 behavior. In particular, C</A(?{B})C/> behaves (from a closure viewpoint)
525 exactly like C</A/ && do { B } && /C/>, while  C<qr/A(?{B})C/> is like
526 C<sub {/A/ && do { B } && /C/}>. So this code now works how you might
527 expect, creating three regexes that match 0, 1, and 2:
528
529     for my $i (0..2) {
530         push @r, qr/^(??{$i})$/;
531     }
532     "1" =~ $r[1]; # matches
533
534 =item *
535
536 The C<use re 'eval'> pragma is now only required for code blocks defined
537 at runtime; in particular in the following, the text of the C<$r> pattern is
538 still interpolated into the new pattern and recompiled, but the individual
539 compiled code-blocks within C<$r> are reused rather than being recompiled,
540 and C<use re 'eval'> isn't needed any more:
541
542     my $r = qr/abc(?{....})def/;
543     /xyz$r/;
544
545 =item *
546
547 Flow control operators no longer crash. Each code block runs in a new
548 dynamic scope, so C<next> etc. will not see any enclosing loops and
549 C<caller> will not see any calling subroutines. C<return> returns a value
550 from the code block, not from any enclosing subroutine.
551
552 =item *
553
554 Perl normally caches the compilation of run-time patterns, and doesn't
555 recompile if the pattern hasn't changed, but this is now disabled if
556 required for the correct behavior of closures. For example:
557
558     my $code = '(??{$x})';
559     for my $x (1..3) {
560         # recompile to see fresh value of $x each time
561         $x =~ /$code/;
562     }
563
564
565 =item *
566
567 The C</msix> and C<(?msix)> etc. flags are now propagated into the return
568 value from C<(??{})>; this now works:
569
570     "AB" =~ /a(??{'b'})/i;
571
572 =item *
573
574 Warnings and errors will appear to come from the surrounding code (or for
575 run-time code blocks, from an eval) rather than from an C<re_eval>:
576
577     use re 'eval'; $c = '(?{ warn "foo" })'; /$c/;
578     /(?{ warn "foo" })/;
579
580 formerly gave:
581
582     foo at (re_eval 1) line 1.
583     foo at (re_eval 2) line 1.
584
585 and now gives:
586
587     foo at (eval 1) line 1.
588     foo at /some/prog line 2.
589
590 =back
591
592 =item *
593
594 Perl now works as well as can be expected on all releases of Unicode so
595 far.  In v5.16, it worked on Unicodes 6.0 and 6.1, but there were
596 various bugs for earlier releases; the older the release the more
597 problems.
598
599 =item *
600
601 C<vec> no longer produces "uninitialized" warnings in lvalue context
602 [perl #9423].
603
604 =item *
605
606 An optimization involving fixed strings in regular expressions could cause
607 a severe performance penalty in edge cases.  This has been fixed
608 [perl #76546].
609
610 =item *
611
612 In certain cases, including empty subpatterns within a regular expression (such
613 as C<(?:)> or C<(?:|)>) could disable some optimizations. This has been fixed.
614
615 =item *
616
617 The "Can't find an opnumber" message that C<prototype> produces when passed
618 a string like "CORE::nonexistent_keyword" now passes UTF-8 and embedded
619 NULs through unchanged [perl #97478].
620
621 =item *
622
623 C<prototype> now treats magical variables like C<$1> the same way as
624 non-magical variables when checking for the CORE:: prefix, instead of
625 treating them as subroutine names.
626
627 =item *
628
629 Under threaded perls, a runtime code block in a regular expression could
630 corrupt the package name stored in the op tree, resulting in bad reads
631 in C<caller>, and possibly crashes [perl #113060].
632
633 =item *
634
635 Referencing a closure prototype (C<\&{$_[1]}> in an attribute handler for a
636 closure) no longer results in a copy of the subroutine (or assertion
637 failures on debugging builds).
638
639 =item *
640
641 C<eval '__PACKAGE__'> now returns the right answer on threaded builds if
642 the current package has been assigned over (as in
643 C<*ThisPackage:: = *ThatPackage::>) [perl #78742].
644
645 =item *
646
647 If a package is deleted by code that it calls, it is possible for C<caller>
648 to see a stack frame belonging to that deleted package.  C<caller> could
649 crash if the stash's memory address was reused for a scalar and a
650 substitution was performed on the same scalar [perl #113486].
651
652 =item *
653
654 C<UNIVERSAL::can> no longer treats its first argument differently
655 depending on whether it is a string or number internally.
656
657 =item *
658
659 C<open> with C<< <& >> for the mode checks to see whether the third argument is
660 a number, in determining whether to treat it as a file descriptor or a handle
661 name.  Magical variables like C<$1> were always failing the numeric check and
662 being treated as handle names.
663
664 =item *
665
666 C<warn>'s handling of magical variables (C<$1>, ties) has undergone several
667 fixes.  C<FETCH> is only called once now on a tied argument or a tied C<$@>
668 [perl #97480].  Tied variables returning objects that stringify as "" are
669 no longer ignored.  A tied C<$@> that happened to return a reference the
670 I<previous> time is was used is no longer ignored.
671
672 =item *
673
674 C<warn ""> now treats C<$@> with a number in it the same way, regardless of
675 whether it happened via C<$@=3> or C<$@="3">.  It used to ignore the
676 former.  Now it appends "\t...caught", as it has always done with
677 C<$@="3">.
678
679 =item *
680
681 Numeric operators on magical variables (e.g., S<C<$1 + 1>>) used to use
682 floating point operations even where integer operations were more appropriate,
683 resulting in loss of accuracy on 64-bit platforms [perl #109542].
684
685 =item *
686
687 Unary negation no longer treats a string as a number if the string happened
688 to be used as a number at some point.  So, if C<$x> contains the string "dogs",
689 C<-$x> returns "-dogs" even if C<$y=0+$x> has happened at some point.
690
691 =item *
692
693 In Perl 5.14, C<-'-10'> was fixed to return "10", not "+10".  But magical
694 variables (C<$1>, ties) were not fixed till now [perl #57706].
695
696 =item *
697
698 Unary negation now treats strings consistently, regardless of the internal
699 C<UTF8> flag.
700
701 =item *
702
703 A regression introduced in Perl v5.16.0 involving
704 C<tr/I<SEARCHLIST>/I<REPLACEMENTLIST>/> has been fixed.  Only the first
705 instance is supposed to be meaningful if a character appears more than
706 once in C<I<SEARCHLIST>>.  Under some circumstances, the final instance
707 was overriding all earlier ones.  [perl #113584]
708
709 =item *
710
711 Regular expressions like C<qr/\87/> previously silently inserted a NUL
712 character, thus matching as if it had been written C<qr/\00087/>.  Now it
713 matches as if it had been written as C<qr/87/>, with a message that the
714 sequence C<"\8"> is unrecognized.
715
716 =item *
717
718 C<__SUB__> now works in special blocks (C<BEGIN>, C<END>, etc.).
719
720 =item *
721
722 Thread creation on Windows could theoretically result in a crash if done
723 inside a C<BEGIN> block.  It still does not work properly, but it no longer
724 crashes [perl #111610].
725
726 =item *
727
728 C<\&{''}> (with the empty string) now autovivifies a stub like any other
729 sub name, and no longer produces the "Unable to create sub" error
730 [perl #94476].
731
732 =back
733
734 =head1 Known Problems
735
736 =over 4
737
738 =item *
739
740 On VMS, L<Module::Build> still fails its test suite.
741
742 =item *
743
744 On Win32, several tests fail intermittently, and may hang unless STDERR is
745 redirected.
746
747 =back
748
749 =head1 Acknowledgements
750
751 XXX Generate this with:
752
753   perl Porting/acknowledgements.pl v5.17.0..HEAD
754
755 =head1 Reporting Bugs
756
757 If you find what you think is a bug, you might check the articles
758 recently posted to the comp.lang.perl.misc newsgroup and the perl
759 bug database at http://rt.perl.org/perlbug/ .  There may also be
760 information at http://www.perl.org/ , the Perl Home Page.
761
762 If you believe you have an unreported bug, please run the L<perlbug>
763 program included with your release.  Be sure to trim your bug down
764 to a tiny but sufficient test case.  Your bug report, along with the
765 output of C<perl -V>, will be sent off to perlbug@perl.org to be
766 analysed by the Perl porting team.
767
768 If the bug you are reporting has security implications, which make it
769 inappropriate to send to a publicly archived mailing list, then please send
770 it to perl5-security-report@perl.org. This points to a closed subscription
771 unarchived mailing list, which includes
772 all the core committers, who will be able
773 to help assess the impact of issues, figure out a resolution, and help
774 co-ordinate the release of patches to mitigate or fix the problem across all
775 platforms on which Perl is supported. Please only use this address for
776 security issues in the Perl core, not for modules independently
777 distributed on CPAN.
778
779 =head1 SEE ALSO
780
781 The F<Changes> file for an explanation of how to view exhaustive details
782 on what changed.
783
784 The F<INSTALL> file for how to build Perl.
785
786 The F<README> file for general stuff.
787
788 The F<Artistic> and F<Copying> files for copyright information.
789
790 =cut