This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
import perl5174delta content to perl5180delta
[perl5.git] / Porting / perl5180delta.pod
CommitLineData
e5ba1bf1
FC
1=encoding utf8
2
3=head1 NAME
4
0bba4573 5perl5180delta - what is new for perl v5.18.0
e5ba1bf1
FC
6
7=head1 DESCRIPTION
8
0bba4573 9This document describes differences between the 5.16.0 release and the 5.18.0
e5ba1bf1
FC
10release.
11
0bba4573
RS
12If you are upgrading from an earlier release such as 5.14.0, first read
13L<perl5140delta>, which describes differences between 5.12.0 and 5.14.0.
e5ba1bf1
FC
14
15=head1 Notice
16
17XXX Any important notices here
18
19=head1 Core Enhancements
20
00785cb7
RS
21=head2 Latest Unicode 6.2 beta is included
22
23This is supposed to be the final data for 6.2, unless glitches are
24found. The earlier experimental 6.2 beta data has been reverted, and
25this used instead. Not all the changes that were proposed for 6.2 and
26that were in the earlier beta versions are actually going into 6.2. In
27particular, there are no changes from 6.1 in the General_Category of any
28characters. 6.2 does revise the C<\X> handling for the REGIONAL
29INDICATOR characters that were added in Unicode 6.0. Perl now for the
30first time fully handles this revision.
31
32=head2 New DTrace probes
33
34The following new DTrace probes have been added:
35
36=over 4
37
38=item C<op-entry>
39
40=item C<loading-file>
41
42=item C<loaded-file>
43
44=back
45
46=head2 C<${^LAST_FH}>
47
48This new variable provides access to the filehandle that was last read.
49This is the handle used by C<$.> and by C<tell> and C<eof> without
50arguments.
51
52=head2 Looser here-doc parsing
53
54Here-doc terminators no longer require a terminating newline character when
55they occur at the end of a file. This was already the case at the end of a
56string eval [perl #65838].
57
58=head2 New mechanism for experimental features
59
60Newly-added experimental features will now require this incantation:
61
62 no warnings "experimental:feature_name";
63 use feature "feature_name"; # would warn without the prev line
64
65There is a new warnings category, called "experimental", containing
66warnings that the L<feature> pragma emits when enabling experimental
67features.
68
69Newly-added experimental features will also be given special warning IDs,
70which consist of "experimental:" followed by the name of the feature. (The
71plan is to extend this mechanism eventually to all warnings, to allow them
72to be enabled or disabled individually, and not just by category.)
73
74By saying
75
76 no warnings "experimental:feature_name";
77
78you are taking responsibility for any breakage that future changes to, or
79removal of, the feature may cause.
80
81=head2 Lexical subroutines
82
83This new feature is still considered experimental. To enable it, use the
84mechanism described above:
85
86 use 5.018;
87 no warnings "experimental:lexical_subs";
88 use feature "lexical_subs";
89
90You can now declare subroutines with C<state sub foo>, C<my sub foo>, and
91C<our sub foo>. (C<state sub> requires that the "state" feature be
92enabled, unless you write it as C<CORE::state sub foo>.)
93
94C<state sub> creates a subroutine visible within the lexical scope in which
95it is declared. The subroutine is shared between calls to the outer sub.
96
97C<my sub> declares a lexical subroutine that is created each time the
98enclosing block is entered. C<state sub> is generally slightly faster than
99C<my sub>.
100
101C<our sub> declares a lexical alias to the package subroutine of the same
102name.
103
104See L<perlsub/Lexical Subroutines>.
105
106
94b31d3f
RS
107=head2 Computed Labels
108
109The loop controls C<next>, C<last> and C<redo>, and the special C<dump>
110operator, now allow arbitrary expressions to be used to compute labels at run
111time. Previously, any argument that was not a constant was treated as the
112empty string.
113
0fef449b
RS
114=head2 More CORE:: subs
115
116Several more built-in functions have been added as subroutines to the
117CORE:: namespace, namely, those non-overridable keywords that can be
118implemented without custom parsers: C<defined>, C<delete>, C<exists>,
119C<glob>, C<pos>, C<protoytpe>, C<scalar>, C<split>, C<study>, and C<undef>.
120
121As some of these have prototypes, C<prototype('CORE::...')> has been
122changed to not make a distinction between overridable and non-overridable
123keywords. This is to make C<prototype('CORE::pos')> consistent with
124C<prototype(&CORE::pos)>.
e5ba1bf1 125
37133b20
RS
126=head2 C<kill> with negative signal names
127
128C<kill> has always allowed a negative signal number, which kills the
129process group instead of a single process. It has also allowed signal
130names. But it did not behave consistently, because negative signal names
131were treated as 0. Now negative signals names like C<-INT> are supported
132and treated the same way as -2 [perl #112990].
133
134=head2 C<pack> is now constant folded.
135
136C<pack> with constant arguments is now constant folded in most cases
137[perl #113470].
e5ba1bf1
FC
138
139=head1 Security
140
141XXX Any security-related notices go here. In particular, any security
142vulnerabilities closed should be noted here rather than in the
143L</Selected Bug Fixes> section.
144
145[ List each security issue as a =head2 entry ]
146
147=head1 Incompatible Changes
148
00785cb7
RS
149=head2 Here-doc parsing
150
151The body of a here-document inside a quote-like operator now always begins
152on the line after the "<<foo" marker. Previously, it was documented to
153begin on the line following the containing quote-like operator, but that
154was only sometimes the case [perl #114040].
155
156=head2 Stricter parsing of substitution replacement
157
158It is no longer possible to abuse the way the parser parses C<s///e> like
159this:
160
161 %_=(_,"Just another ");
162 $_="Perl hacker,\n";
163 s//_}->{_/e;print
164
165=head2 Interaction of lexical and default warnings
166
167Turning on any lexical warnings used first to disable all default warnings
168if lexical warnings were not already enabled:
169
170 $*; # deprecation warning
171 use warnings "void";
172 $#; # void warning; no deprecation warning
173
174Now, the debugging, deprecated, glob, inplace and malloc warnings
175categories are left on when turning on lexical warnings (unless they are
176turned off by C<no warnings>, of course).
177
178This may cause deprecation warnings to occur in code that used to be free
179of warnings.
180
181Those are the only categories consisting only of default warnings. Default
182warnings in other categories are still disabled by C<use warnings
183"category">, as we do not yet have the infrastructure for controlling
184individual warnings.
185
186=head2 C<state sub> and C<our sub>
187
188Due to an accident of history, C<state sub> and C<our sub> were equivalent
189to a plain C<sub>, so one could even create an anonymous sub with
190C<our sub { ... }>. These are now disallowed outside of the "lexical_subs"
191feature. Under the "lexical_subs" feature they have new meanings described
192in L<perlsub/Lexical Subroutines>.
193
194=head2 C<gv_fetchmeth_*> and SUPER
195
196The various C<gv_fetchmeth_*> XS functions used to treat a package whose
197named ended with ::SUPER specially. A method lookup on the Foo::SUPER
198package would be treated as a SUPER method lookup on the Foo package. This
199is no longer the case. To do a SUPER lookup, pass the Foo stash and the
200GV_SUPER flag.
201
94b31d3f
RS
202=head2 Defined values stored in environment are forced to byte strings
203
204A value stored in an environment variable has always been stringified. In this
205release, it is converted to be only a byte string. First, it is forced to be a
206only a string. Then if the string is utf8 and the equivalent of
207C<utf8::downgrade()> works, that result is used; otherwise, the equivalent of
208C<utf8::encode()> is used, and a warning is issued about wide characters
209(L</Diagnostics>).
210
211=head2 C<given> now aliases the global C<$_>
212
213Instead of assigning to an implicit lexical C<$_>, C<given> now makes the
214global C<$_> an alias for its argument, just like C<foreach>. However, it
215still uses lexical C<$_> if there is lexical C<$_> in scope (again, just like
216C<foreach>) [perl #114020].
217
0bba4573
RS
218=head2 qw(...) can no longer be used as parentheses
219
220C<qw> lists used to fool the parser into thinking they were always
221surrounded by parentheses. This permitted some surprising constructions
222such as C<foreach $x qw(a b c) {...}>, which should really be written
223C<foreach $x (qw(a b c)) {...}>. These would sometimes get the lexer into
224the wrong state, so they didn't fully work, and the similar C<foreach qw(a
225b c) {...}> that one might expect to be permitted never worked at all.
226
227This side effect of C<qw> has now been abolished. It has been deprecated
228since Perl 5.13.11. It is now necessary to use real parentheses
229everywhere that the grammar calls for them.
e5ba1bf1 230
0bba4573 231=head2 C<\s> in regular expressions now matches a Vertical Tab
e5ba1bf1 232
0bba4573 233[ XXX ]
e5ba1bf1 234
0fef449b
RS
235=head2 C</(?{})/> and C</(??{})/> have been heavily reworked
236
237The implementation of this feature has been almost completely rewritten.
238Although its main intent is to fix bugs, some behaviors, especially
239related to the scope of lexical variables, will have changed. This is
240described more fully in the L</Selected Bug Fixes> section.
241
242=head2 C<\N{BELL}> now refers to U+1F514 instead of U+0007
243
244Unicode 6.0 reused the name "BELL" for a different code point than it
245traditionally had meant. Since Perl v5.14, use of this name still
246referred to U+0007, but would raise a deprecation warning. Now, "BELL"
247refers to U+1F514, and the name for U+0007 is "ALERT". All the
248functions in L<charnames> have been correspondingly updated.
249
250=head2 Alphanumeric operators must now be separated from the closing
251delimiter of regular expressions
252
253You may no longer write something like:
254
255 m/a/and 1
256
257Instead you must write
258
259 m/a/ and 1
260
261with whitespace separating the operator from the closing delimiter of
262the regular expression. Not having whitespace has resulted in a
263deprecation warning since Perl v5.14.0.
264
265=head2 C<require> dies for unreadable files
266
267When C<require> encounters an unreadable file, it now dies. It used to
268ignore the file and continue searching the directories in @INC
269[perl #113422].
270
271=head2 Upgrade to the Unicode 6.2 beta
272
273Unicode 6.2 is proposing some changes that may very well break some CPAN
274modules. The timing of this nicely coincides with Perl's being early in the
275release cycle. This commit takes the current beta 6.2, adds the proposed
276changes that aren't yet in it, and subtracts the changes that would affect \X
277processing, as those turn out to have errors, and may have to be rethought.
278Unicode has been notified of these problems.
279
280This will allow us to gather data as to whether or not the proposed changes
281cause us problems. These will be presented to Unicode to aid in their final
282decision as to whether or not to go forward with the changes.
283
284These changes will be replaced by the final version of Unicode 6.2 before
2855.18.0 is released.
286
e5ba1bf1
FC
287=head1 Deprecations
288
289XXX Any deprecated features, syntax, modules etc. should be listed here. In
290particular, deprecated modules should be listed here even if they are listed as
291an updated module in the L</Modules and Pragmata> section.
292
293[ List each deprecation as a =head2 entry ]
294
295=head1 Performance Enhancements
296
297XXX Changes which enhance performance without changing behaviour go here.
298There may well be none in a stable release.
299
300[ List each enhancement as a =item entry ]
301
302=over 4
303
304=item *
305
00785cb7
RS
306Speed up in regular expression matching against Unicode properties. The
307largest gain is for C<\X>, the Unicode "extended grapheme cluster". The
308gain for it is about 35% - 40%. Bracketed character classes, e.g.,
309C<[0-9\x{100}]> containing code points above 255 are also now faster.
310
311=item *
312
313On platforms supporting it, several former macros are now implemented as static
314inline functions. This should speed things up slightly on non-GCC platforms.
315
316=item *
317
318Apply the optimisation of hashes in boolean context, such as in C<if> or C<and>,
319to constructs in non-void context.
320
321=item *
322
323Extend the optimisation of hashes in boolean context to C<scalar(%hash)>,
324C<%hash ? ... : ...>, and C<sub { %hash || ... }>.
325
326=item *
327
328When making a copy of the string being matched against (so that $1, $& et al
329continue to show the correct value even if the original string is subsequently
330modified), only copy that substring of the original string needed for the
331capture variables, rather than copying the whole string.
332
333This is a big win for code like
334
335 $&;
336 $_ = 'x' x 1_000_000;
337 1 while /(.)/;
338
339Also, when pessimizing if the code contains C<$`>, C<$&> or C<$'>, record the
340presence of each variable separately, so that the determination of the substring
341range is based on each variable separately. So performance-wise,
342
343 $&; /x/
344
345is now roughly equivalent to
346
347 /(x)/
348
349whereas previously it was like
350
351 /^(.*)(x)(.*)$/
352
353and
354
355 $&; $'; /x/
356
357is now roughly equivalent to
358
359 /(x)(.*)$/
360
361etc.
362
363
364=item *
365
0bba4573
RS
366Filetest ops manage the stack in a fractionally more efficient manner.
367
368=item *
369
370Globs used in a numeric context are now numerified directly in most cases,
371rather than being numerified via stringification.
e5ba1bf1 372
0fef449b
RS
373=item *
374
375The C<x> repetition operator is now folded to a single constant at compile
376time if called in scalar context with constant operands and no parentheses
377around the left operand.
378
e5ba1bf1
FC
379=back
380
381=head1 Modules and Pragmata
382
383XXX All changes to installed files in F<cpan/>, F<dist/>, F<ext/> and F<lib/>
384go here. If Module::CoreList is updated, generate an initial draft of the
385following sections using F<Porting/corelist-perldelta.pl>, which prints stub
386entries to STDOUT. Results can be pasted in place of the '=head2' entries
387below. A paragraph summary for important changes should then be added by hand.
388In an ideal world, dual-life modules would have a F<Changes> file that could be
389cribbed.
390
391[ Within each section, list entries as a =item entry ]
392
393=head2 New Modules and Pragmata
394
395=over 4
396
397=item *
398
399XXX
400
401=back
402
403=head2 Updated Modules and Pragmata
404
405=over 4
406
407=item *
408
409L<XXX> has been upgraded from version A.xx to B.yy.
410
411=back
412
413=head2 Removed Modules and Pragmata
414
0bba4573 415=over
e5ba1bf1
FC
416
417=item *
418
0bba4573
RS
419L<Version::Requirements> has been removed from the core distribution. It is
420available under a different name: L<CPAN::Meta::Requirements>.
e5ba1bf1
FC
421
422=back
423
424=head1 Documentation
425
426XXX Changes to files in F<pod/> go here. Consider grouping entries by
427file and be sure to link to the appropriate page, e.g. L<perlfunc>.
428
429=head2 New Documentation
430
431XXX Changes which create B<new> files in F<pod/> go here.
432
433=head3 L<XXX>
434
435XXX Description of the purpose of the new file here
436
437=head2 Changes to Existing Documentation
438
0bba4573 439=head3 L<perldata>
e5ba1bf1 440
0bba4573
RS
441=over 4
442
443=item *
444
445Now explicitly documents the behaviour of hash initializer lists that
446contain duplicate keys.
447
448=back
449
450=head3 L<perldiag>
451
452=over 4
453
454=item *
455
456The explanation of symbolic references being prevented by "strict refs"
457now doesn't assume that the reader knows what symbolic references are.
458
459=back
460
461=head3 L<perlfunc>
e5ba1bf1
FC
462
463=over 4
464
465=item *
466
0bba4573 467The return value of C<pipe> is now documented.
e5ba1bf1 468
37133b20
RS
469=item *
470
471Clarified documentation of C<our>.
472
e5ba1bf1
FC
473=back
474
0fef449b
RS
475=head3 L<perlfaq>
476
477=over 4
478
479=item *
480
481L<perlfaq> has been synchronized with version 5.0150040 from CPAN.
482
483=back
484
485=head3 L<perlcheat>
486
487=over 4
488
489=item *
490
491L<perlcheat> has been reorganized, and a few new sections were added.
492
493=back
494
94b31d3f
RS
495=head3 L<perlop>
496
497=over 4
498
499=item *
500
501Loop control verbs (C<dump>, C<goto>, C<next>, C<last> and C<redo>) have always
502had the same precedence as assignment operators, but this was not documented
503until now.
504
505=back
506
0bba4573 507=head3 Diagnostics
e5ba1bf1
FC
508
509The following additions or changes have been made to diagnostic output,
510including warnings and fatal error messages. For the complete list of
511diagnostic messages, see L<perldiag>.
512
513XXX New or changed warnings emitted by the core's C<C> code go here. Also
514include any changes in L<perldiag> that reconcile it to the C<C> code.
515
516=head2 New Diagnostics
517
518XXX Newly added diagnostic messages go under here, separated into New Errors
519and New Warnings
520
521=head3 New Errors
522
523=over 4
524
525=item *
526
94b31d3f
RS
527L<Unterminated delimiter for here document|perldiag/"Unterminated delimiter for here document">
528
529This message now occurs when a here document label has an initial quotation
530mark but the final quotation mark is missing.
531
532This replaces a bogus and misleading error message about not finding the label
533itself [perl #114104].
534
535=item *
536
537L<panic: child pseudo-process was never scheduled|perldiag/"panic: child pseudo-process was never scheduled">
538
539This error is thrown when a child pseudo-process in the ithreads implementation
540on Windows was not scheduled within the time period allowed and therefore was
541not able to initialize properly [perl #88840].
542
543=item *
544
37133b20
RS
545L<Group name must start with a non-digit word character in regex; marked by <-- HERE in mE<sol>%sE<sol>|perldiag/"Group name must start with a non-digit word character in regex; marked by <-- HERE in m/%s/">
546
547This error has been added for C<(?&0)>, which is invalid. It used to
548produce an incomprehensible error message [perl #101666].
549
550=item *
551
552L<Can't use an undefined value as a subroutine reference|perldiag/"Can't use an undefined value as %s reference">
553
554Calling an undefined value as a subroutine now produces this error message.
555It used to, but was accidentally disabled, first in Perl 5.004 for
556non-magical variables, and then in Perl 5.14 for magical (e.g., tied)
557variables. It has now been restored. In the mean time, undef was treated
558as an empty string [perl #113576].
e5ba1bf1
FC
559
560=back
561
562=head3 New Warnings
563
564=over 4
565
566=item *
567
00785cb7
RS
568L<Experimental "%s" subs not enabled|perldiag/"Experimental "%s" subs not enabled">
569
570(F) To use lexical subs, you must first enable them:
571
572 no warnings 'experimental:lexical_subs';
573 use feature 'lexical_subs';
574 my sub foo { ... }
575
576=item *
577
578L<Subroutine "&%s" is not available|perldiag/"Subroutine "&%s" is not available">
579
580(W closure) During compilation, an inner named subroutine or eval is
581attempting to capture an outer lexical subroutine that is not currently
582available. This can happen for one of two reasons. First, the lexical
583subroutine may be declared in an outer anonymous subroutine that has not
584yet been created. (Remember that named subs are created at compile time,
585while anonymous subs are created at run-time.) For example,
586
587 sub { my sub a {...} sub f { \&a } }
588
589At the time that f is created, it can't capture the current the "a" sub,
590since the anonymous subroutine hasn't been created yet. Conversely, the
591following won't give a warning since the anonymous subroutine has by now
592been created and is live:
593
594 sub { my sub a {...} eval 'sub f { \&a }' }->();
595
596The second situation is caused by an eval accessing a variable that has
597gone out of scope, for example,
598
599 sub f {
600 my sub a {...}
601 sub { eval '\&a' }
602 }
603 f()->();
604
605Here, when the '\&a' in the eval is being compiled, f() is not currently
606being executed, so its &a is not available for capture.
607
608=item *
609
610L<"%s" subroutine &%s masks earlier declaration in same %s|perldiag/"%s" subroutine &%s masks earlier declaration in same %s>
611
612(W misc) A "my" or "state" subroutine has been redeclared in the
613current scope or statement, effectively eliminating all access to
614the previous instance. This is almost always a typographical error.
615Note that the earlier subroutine will still exist until the end of
616the scope or until all closure references to it are destroyed.
617
618=item *
619
620L<The %s feature is experimental|perldiag/"The %s feature is experimental">
621
622(S experimental) This warning is emitted if you enable an experimental
623feature via C<use feature>. Simply suppress the warning if you want
624to use the feature, but know that in doing so you are taking the risk
625of using an experimental feature which may change or be removed in a
626future Perl version:
627
628 no warnings "experimental:lexical_subs";
629 use feature "lexical_subs";
630
631=item *
632
633L<sleep(%u) too large|perldiag/"sleep(%u) too large">
634
635(W overflow) You called C<sleep> with a number that was larger than it can
636reliably handle and C<sleep> probably slept for less time than requested.
637
638=item *
639
94b31d3f
RS
640L<Wide character in setenv|perldiag/"Wide character in %s">
641
642Attempts to put wide characters into environment variables via C<%ENV> now
643provoke this warning.
644
645=item *
646
37133b20
RS
647"L<Invalid negative number (%s) in chr|perldiag/"Invalid negative number (%s) in chr">"
648
649C<chr()> now warns when passed a negative value [perl #83048].
650
651=item *
652
653"L<Integer overflow in srand|perldiag/"Integer overflow in srand">"
654
655C<srand()> now warns when passed a value that doesn't fit in a C<UV> (since the
656value will be truncated rather than overflowing) [perl #40605].
657
658=item *
659
660"L<-i used with no filenames on the command line, reading from STDIN|perldiag/"-i used with no filenames on the command line, reading from STDIN">"
661
662Running perl with the C<-i> flag now warns if no input files are provided on
663the command line [perl #113410].
e5ba1bf1
FC
664
665=back
666
667=head2 Changes to Existing Diagnostics
668
669XXX Changes (i.e. rewording) of diagnostic messages go here
670
671=over 4
672
673=item *
674
00785cb7
RS
675L<vector argument not supported with alpha versions|perldiag/vector argument not supported with alpha versions>
676
677This warning was not suppressable, even with C<no warnings>. Now it is
678suppressible, and has been moved from the "internal" category to the
679"printf" category.
680
681=item *
682
683C<< Can't do {n,m} with n > m in regex; marked by <-- HERE in m/%s/ >>
684
685This fatal error has been turned into a warning that reads:
686
687L<< Quantifier {n,m} with n > m can't match in regex | perldiag/Quantifier {n,m} with n > m can't match in regex >>
688
689(W regexp) Minima should be less than or equal to maxima. If you really want
690your regexp to match something 0 times, just put {0}.
691
692=item *
693
0fef449b
RS
694The "Runaway prototype" warning that occurs in bizarre cases has been
695removed as being unhelpful and inconsistent.
696
697=item *
698
699The "Not a format reference" error has been removed, as the only case in
700which it could be triggered was a bug.
701
702=item *
703
704The "Unable to create sub named %s" error has been removed for the same
705reason.
e5ba1bf1 706
37133b20
RS
707=item *
708
709The 'Can't use "my %s" in sort comparison' error has been downgraded to a
710warning, '"my %s" used in sort comparison' (with 'state' instead of 'my'
711for state variables). In addition, the heuristics for guessing whether
712lexical $a or $b has been misused have been improved to generate fewer
713false positives. Lexical $a and $b are no longer disallowed if they are
714outside the sort block. Also, a named unary or list operator inside the
715sort block no longer causes the $a or $b to be ignored [perl #86136].
716
e5ba1bf1
FC
717=back
718
719=head1 Utility Changes
720
721XXX Changes to installed programs such as F<perlbug> and F<xsubpp> go here.
722Most of these are built within the directories F<utils> and F<x2p>.
723
724[ List utility changes as a =head3 entry for each utility and =item
725entries for each change
726Use L<XXX> with program names to get proper documentation linking. ]
727
728=head3 L<XXX>
729
730=over 4
731
732=item *
733
734XXX
735
736=back
737
738=head1 Configuration and Compilation
739
740XXX Changes to F<Configure>, F<installperl>, F<installman>, and analogous tools
741go here. Any other changes to the Perl build process should be listed here.
742However, any platform-specific changes should be listed in the
743L</Platform Support> section, instead.
744
745[ List changes as a =item entry ].
746
747=over 4
748
749=item *
750
00785cb7
RS
751F<Configure> will now correctly detect C<isblank()> when compiling with a C++
752compiler.
753
754=item *
755
94b31d3f
RS
756The pager detection in F<Configure> has been improved to allow responses which
757specify options after the program name, e.g. B</usr/bin/less -R>, if the user
758accepts the default value. This helps B<perldoc> when handling ANSI escapes
759[perl #72156].
e5ba1bf1
FC
760
761=back
762
763=head1 Testing
764
765XXX Any significant changes to the testing of a freshly built perl should be
766listed here. Changes which create B<new> files in F<t/> go here as do any
767large changes to the testing harness (e.g. when parallel testing was added).
768Changes to existing files in F<t/> aren't worth summarizing, although the bugs
769that they represent may be covered elsewhere.
770
771[ List each test improvement as a =item entry ]
772
773=over 4
774
775=item *
776
0bba4573
RS
777The test suite now has a section for tests that require very large amounts
778of memory. These tests won't run by default; they can be enabled by
779setting the C<PERL_TEST_MEMORY> environment variable to the number of
780gibibytes of memory that may be safely used.
e5ba1bf1
FC
781
782=back
783
784=head1 Platform Support
785
786XXX Any changes to platform support should be listed in the sections below.
787
788[ Within the sections, list each platform as a =item entry with specific
789changes as paragraphs below it. ]
790
791=head2 New Platforms
792
793XXX List any platforms that this version of perl compiles on, that previous
794versions did not. These will either be enabled by new files in the F<hints/>
795directories, or new subdirectories and F<README> files at the top level of the
796source tree.
797
798=over 4
799
800=item XXX-some-platform
801
802XXX
803
804=back
805
806=head2 Discontinued Platforms
807
e5ba1bf1
FC
808=over 4
809
94b31d3f 810=item UTS Global
e5ba1bf1 811
94b31d3f
RS
812Support code relating to UTS global has been removed. UTS was a mainframe
813version of System V created by Amdahl, subsequently sold to UTS Global. The
814port has not been touched since before Perl 5.8.0, and UTS Global is now
815defunct.
e5ba1bf1 816
00785cb7
RS
817=item VM/ESA
818
819Support for VM/ESA has been removed. The port was tested on 2.3.0, which
820IBM ended service on in March 2002. 2.4.0 ended service in June 2003, and
821was superseded by Z/VM. The current version of Z/VM is V6.2.0, and scheduled
822for end of service on 2015/04/30.
823
e5ba1bf1
FC
824=back
825
826=head2 Platform-Specific Notes
827
828XXX List any changes for specific platforms. This could include configuration
829and compilation changes or changes in portability/compatibility. However,
830changes within modules for platforms should generally be listed in the
831L</Modules and Pragmata> section.
832
833=over 4
834
0bba4573 835=item clang++
e5ba1bf1 836
0bba4573
RS
837There is now a workaround for a compiler bug that prevented compiling
838with clang++ since Perl 5.15.7 [perl #112786].
839
840=item C++
841
842When compiling the Perl core as C++ (which is only semi-supported), the
843mathom functions are now compiled as C<extern "C">, to ensure proper
844binary compatibility. (However, binary compatibility isn't generally
845guaranteed anyway in the situations where this would matter.)
846
00785cb7
RS
847=item Win32
848
849Fixed a problem where perl could crash while cleaning up threads (including the
850main thread) in threaded debugging builds on Win32 and possibly other platforms
851[perl #114496].
852
853A rare race condition that would lead to L<sleep|perlfunc/sleep> taking more
854time than requested, and possibly even hanging, has been fixed [perl #33096].
855
856=item Solaris
857
858In Configure, avoid running sed commands with flags not supported on Solaris.
859
860=item Darwin
861
862Stop hardcoding an alignment on 8 byte boundaries to fix builds using
863-Dusemorebits.
864
865=item VMS
866
867Fix linking on builds configured with -Dusemymalloc=y.
868
0bba4573
RS
869=item VMS
870
871It should now be possible to compile Perl as C++ on VMS.
e5ba1bf1 872
0fef449b
RS
873=item Win32
874
875C<link> on Win32 now attempts to set C<$!> to more appropriate values
876based on the Win32 API error code. [perl #112272]
877
878Perl no longer mangles the environment block, e.g. when launching a new
879sub-process, when the environment contains non-ASCII characters. Known
880problems still remain, however, when the environment contains characters
881outside of the current ANSI codepage (e.g. see the item about Unicode in
882C<%ENV> in L<http://perl5.git.perl.org/perl.git/blob/HEAD:/Porting/todo.pod>).
883[perl #113536]
884
37133b20
RS
885=item Win32
886
887Building perl with some Windows compilers used to fail due to a problem
888with miniperl's C<glob> operator (which uses the C<perlglob> program)
889deleting the PATH environment variable [perl #113798].
890
94b31d3f
RS
891=item Win32
892
893A new makefile option, USE_64_BIT_INT, has been added to the Windows makefiles.
894Set this to "define" when building a 32-bit perl if you want it to use 64-bit
895integers.
896
897Machine code size reductions, already made to the DLLs of XS modules in Perl
8985.17.2, have now been extended to the perl DLL itself.
899
900Building with VC++ 6.0 was inadvertently broken in Perl 5.17.2 but has now been
901fixed again.
902
0fef449b
RS
903=item VMS
904
905All C header files from the top-level directory of the distribution are now
906installed on VMS, providing consistency with a long-standing practice on other
907platforms. Previously only a subset were installed, which broke non-core
908extension builds for extensions that depended on the missing include files.
909
37133b20
RS
910=item VMS
911
912Quotes are now removed from the command verb (but not the parameters) for
913commands spawned via C<system>, backticks, or a piped C<open>. Previously,
914quotes on the verb were passed through to DCL, which would fail to recognize
915the command. Also, if the verb is actually a path to an image or command
916procedure on an ODS-5 volume, quoting it now allows the path to contain spaces.
917
94b31d3f
RS
918=item VMS
919
920The B<a2p> build has been fixed for the HP C++ compiler on OpenVMS.
921
37133b20
RS
922=item AIX
923
924Configure now always adds C<-qlanglvl=extc99> to the CC flags on AIX when
925using xlC. This will make it easier to compile a number of XS-based modules
926that assume C99 [perl #113778].
927
e5ba1bf1
FC
928=back
929
930=head1 Internal Changes
931
0bba4573 932=over
e5ba1bf1 933
0bba4573 934=item *
e5ba1bf1 935
00785cb7
RS
936The APIs for accessing lexical pads have changed considerably.
937
938C<PADLIST>s are now longer C<AV>s, but their own type instead. C<PADLIST>s now
939contain a C<PAD> and a C<PADNAMELIST> of C<PADNAME>s, rather than C<AV>s for the
940pad and the list of pad names. C<PAD>s, C<PADNAMELIST>s, and C<PADNAME>s are to
941be accessed as such through the newly added pad API instead of the plain C<AV>
942and C<SV> APIs. See L<perlapi> for details.
943
944=item *
945
946In the regex API, the numbered capture callbacks are passed an index
947indicating what match variable is being accessed. There are special
948index values for the C<$`, $&, $&> variables. Previously the same three
949values were used to retrieve C<${^PREMATCH}, ${^MATCH}, ${^POSTMATCH}>
950too, but these have now been assigned three separate values. See
951L<perlreapi/Numbered capture callbacks>.
952
953=item *
954
955C<PL_sawampersand> was previously a boolean indicating that any of
956C<$`, $&, $&> had been seen; it now contains three one-bit flags
957indicating the presence of each of the variables individually.
958
959
960=item *
961
0bba4573
RS
962The C<CV *> typemap entry now supports C<&{}> overloading and typeglobs,
963just like C<&{...}> [perl #96872].
e5ba1bf1
FC
964
965=item *
966
0bba4573
RS
967The C<SVf_AMAGIC> flag to indicate overloading is now on the stash, not the
968object. It is now set automatically whenever a method or @ISA changes, so
969its meaning has changed, too. It now means "potentially overloaded". When
970the overload table is calculated, the flag is automatically turned off if
971there is no overloading, so there should be no noticeable slowdown.
972
973The staleness of the overload tables is now checked when overload methods
974are invoked, rather than during C<bless>.
975
976"A" magic is gone. The changes to the handling of the C<SVf_AMAGIC> flag
977eliminate the need for it.
978
979C<PL_amagic_generation> has been removed as no longer necessary. For XS
980modules, it is now a macro alias to C<PL_na>.
981
982The fallback overload setting is now stored in a stash entry separate from
983overloadedness itself.
984
985=item *
986
987The character-processing code has been cleaned up in places. The changes
988should be operationally invisible.
e5ba1bf1 989
0fef449b
RS
990=item *
991
992The C<study> function was made a no-op in 5.16. It was simply disabled via
993a C<return> statement; the code was left in place. Now the code supporting
994what C<study> used to do has been removed.
995
996=item *
997
998Under threaded perls, there is no longer a separate PV allocated for every
999COP to store its package name (C<< cop->stashpv >>). Instead, there is an
1000offset (C<< cop->stashoff >>) into the new C<PL_stashpad> array, which
1001holds stash pointers.
1002
1003=item *
1004
1005In the pluggable regex API, the C<regexp_engine> struct has acquired a new
1006field C<op_comp>, which is currently just for perl's internal use, and
1007should be initialised to NULL by other regex plugin modules.
1008
1009=item *
1010
1011A new function C<alloccoptash> has been added to the API, but is considered
1012experimental. See L<perlapi>.
1013
37133b20
RS
1014=item *
1015
1016Perl used to implement get magic in a way that would sometimes hide bugs in
1017code could call mg_get() too many times on magical values. This hiding of
1018errors no longer occurs, so long-standing bugs may become visible now. If
1019you see magic-related errors in XS code, check to make sure it, together
1020with the Perl API functions it uses, calls mg_get() only once on SvGMAGICAL()
1021values.
1022
1023=item *
1024
1025OP allocation for CVs now uses a slab allocator. This simplifies
1026memory management for OPs allocated to a CV, so cleaning up after a
1027compilation error is simpler and safer [perl #111462][perl #112312].
1028
1029=item *
1030
1031PERL_DEBUG_READONLY_OPS has been rewritten to work with the new slab
1032allocator, allowing it to catch more violations than before.
1033
1034=item *
1035
1036The old slab allocator for ops, which was only enabled for PERL_IMPLICIT_SYS
1037and PERL_DEBUG_READONLY_OPS, has been retired.
1038
e5ba1bf1
FC
1039=back
1040
1041=head1 Selected Bug Fixes
1042
94b31d3f
RS
1043=over 4
1044
1045=item *
e5ba1bf1 1046
00785cb7
RS
1047The error "Can't localize through a reference" had disappeared in 5.16.0
1048when C<local %$ref> appeared on the last line of an lvalue subroutine.
1049This error disappeared for C<\local %$ref> in perl 5.8.1. It has now
1050been restored.
1051
1052=item *
1053
1054The parsing of here-docs has been improved significantly, fixing several
1055parsing bugs and crashes and one memory leak, and correcting wrong
1056subsequent line numbers under certain conditions.
1057
1058=item *
1059
1060Inside an eval, the error message for an unterminated here-doc no longer
1061has a newline in the middle of it [perl #70836].
1062
1063=item *
1064
1065A substitution inside a substitution pattern (C<s/${s|||}//>) no longer
1066confuses the parser.
1067
1068=item *
1069
1070It may be an odd place to allow comments, but C<s//"" # hello/e> has
1071always worked, I<unless> there happens to be a null character before the
1072first #. Now it works even in the presence of nulls.
1073
1074=item *
1075
1076An invalid range in C<tr///> or C<y///> no longer results in a memory leak.
1077
1078=item *
1079
1080String eval no longer treats a semicolon-delimited quote-like operator at
1081the very end (C<eval 'q;;'>) as a syntax error.
1082
1083=item *
1084
1085C<< warn {$_ => 1} + 1 >> is no longer a syntax error. The parser used to
1086get confused with certain list operators followed by an anonymous hash and
1087then an infix operator that shares its form with a unary operator.
1088
1089=item *
1090
1091C<(caller $n)[6]> (which gives the text of the eval) used to return the
1092actual parser buffer. Modifying it could result in crashes. Now it always
1093returns a copy. The string returned no longer has "\n;" tacked on to the
1094end. The returned text also includes here-doc bodies, which used to be
1095omitted.
1096
1097=item *
1098
1099Reset the utf8 position cache when accessing magical variables to avoid the
1100string buffer and the utf8 position cache getting out of sync
1101[perl #114410].
1102
1103=item *
1104
1105Various cases of get magic being called twice for magical utf8 strings have been
1106fixed.
1107
1108=item *
1109
1110This code (when not in the presence of C<$&> etc)
1111
1112 $_ = 'x' x 1_000_000;
1113 1 while /(.)/;
1114
1115used to skip the buffer copy for performance reasons, but suffered from C<$1>
1116etc changing if the original string changed. That's now been fixed.
1117
1118=item *
1119
1120Perl doesn't use PerlIO anymore to report out of memory messages, as PerlIO
1121might attempt to allocate more memory.
1122
1123=item *
1124
1125In a regular expression, if something is quantified with C<{n,m}>
1126where C<S<n E<gt> m>>, it can't possibly match. Previously this was a fatal error,
1127but now is merely a warning (and that something won't match). [perl #82954].
1128
1129=item *
1130
1131It used to be possible for formats defined in subroutines that have
1132subsequently been undefined and redefined to close over variables in the
1133wrong pad (the newly-defined enclosing sub), resulting in crashes or
1134"Bizarre copy" errors.
1135
1136=item *
1137
1138Redefinition of XSUBs at run time could produce warnings with the wrong
1139line number.
1140
1141=item *
1142
1143The %vd sprintf format does not support version objects for alpha versions.
1144It used to output the format itself (%vd) when passed an alpha version, and
1145also emit an "Invalid conversion in printf" warning. It no longer does,
1146but produces the empty string in the output. It also no longer leaks
1147memory in this case.
1148
1149=item *
1150
1151A bug fix in an earlier 5.17.x release caused C<no a a 3> (a syntax error)
1152to result in a bad read or assertion failure, because an op was being freed
1153twice.
1154
1155=item *
1156
1157C<< $obj->SUPER::method >> calls in the main package could fail if the
1158SUPER package had already been accessed by other means.
1159
1160=item *
1161
1162Stash aliasing (C<*foo:: = *bar::>) no longer causes SUPER calls to ignore
1163changes to methods or @ISA or use the wrong package.
1164
1165=item *
1166
1167Method calls on packages whose names end in ::SUPER are no longer treated
1168as SUPER method calls, resulting in failure to find the method.
1169Furthermore, defining subroutines in such packages no longer causes them to
1170be found by SUPER method calls on the containing package [perl #114924].
1171
1172
1173=item *
1174
94b31d3f
RS
1175C<\w> now matches the code points U+200C (ZERO WIDTH NON-JOINER) and U+200D
1176(ZERO WIDTH JOINER). C<\W> no longer matches these. This change is because
1177Unicode corrected their definition of what C<\w> should match.
e5ba1bf1 1178
94b31d3f
RS
1179=item *
1180
1181C<dump LABEL> no longer leaks its label.
1182
1183=item *
1184
1185Constant folding no longer changes the behaviour of functions like C<stat()>
1186and C<truncate()> that can take either filenames or handles.
1187C<stat 1 ? foo : bar> nows treats its argument as a file name (since it is an
1188arbitrary expression), rather than the handle "foo".
1189
1190=item *
1191
1192C<truncate FOO, $len> no longer falls back to treating "FOO" as a file name if
1193the filehandle has been deleted. This was broken in Perl 5.16.0.
1194
1195=item *
1196
1197Subroutine redefinitions after sub-to-glob and glob-to-glob assignments no
1198longer cause double frees or panic messages.
1199
1200=item *
1201
1202C<s///> now turns vstrings into plain strings when performing a substitution,
1203even if the resulting string is the same (C<s/a/a/>).
1204
1205=item *
1206
1207Prototype mismatch warnings no longer erroneously treat constant subs as having
1208no prototype when they actually have "".
1209
1210=item *
1211
1212Constant subroutines and forward declarations no longer prevent prototype
1213mismatch warnings from omitting the sub name.
1214
1215=item *
1216
1217C<undef> on a subroutine now clears call checkers.
1218
1219=item *
1220
1221The C<ref> operator started leaking memory on blessed objects in Perl 5.16.0.
1222This has been fixed [perl #114340].
1223
1224=item *
1225
1226C<use> no longer tries to parse its arguments as a statement, making
1227C<use constant { () };> a syntax error [perl #114222].
1228
1229=item *
1230
1231On debugging builds, "uninitialized" warnings inside formats no longer cause
1232assertion failures.
1233
1234=item *
1235
1236On debugging builds, subroutines nested inside formats no longer cause
1237assertion failures [perl #78550].
1238
1239=item *
1240
1241Formats and C<use> statements are now permitted inside formats.
1242
1243=item *
1244
1245C<print $x> and C<sub { print $x }-E<gt>()> now always produce the same output.
1246It was possible for the latter to refuse to close over $x if the variable was
1247not active; e.g., if it was defined outside a currently-running named
1248subroutine.
1249
1250=item *
1251
1252Similarly, C<print $x> and C<print eval '$x'> now produce the same output.
1253This also allows "my $x if 0" variables to be seen in the debugger [perl
1254#114018].
1255
1256=item *
1257
1258Formats called recursively no longer stomp on their own lexical variables, but
1259each recursive call has its own set of lexicals.
1260
1261=item *
1262
1263Attempting to free an active format or the handle associated with it no longer
1264results in a crash.
1265
1266=item *
1267
1268Format parsing no longer gets confused by braces, semicolons and low-precedence
1269operators. It used to be possible to use braces as format delimiters (instead
1270of C<=> and C<.>), but only sometimes. Semicolons and low-precedence operators
1271in format argument lines no longer confuse the parser into ignoring the line's
1272return value. In format argument lines, braces can now be used for anonymous
1273hashes, instead of being treated always as C<do> blocks.
1274
1275=item *
1276
1277Formats can now be nested inside code blocks in regular expressions and other
1278quoted constructs (C</(?{...})/> and C<qq/${...}/>) [perl #114040].
1279
1280=item *
1281
1282Formats are no longer created after compilation errors.
1283
1284=item *
1285
1286Some format syntax errors started causing crashes in Perl 5.17.2, but have now
1287been fixed.
1288
1289=item *
1290
1291Under debugging builds, the B<-DA> command line option started crashing in Perl
12925.16.0. It has been fixed [perl #114368].
1293
1294=item *
1295
1296Scope::Escape compatibility, which was broken in Perl 5.17.2, has been restored
1297[perl #113872].
1298
1299=item *
1300
1301A potential deadlock scenario involving the premature termination of a pseudo-
1302forked child in a Windows build with ithreads enabled has been fixed. This
1303resolves the common problem of the F<t/op/fork.t> test hanging on Windows [perl
1304#88840].
1305
1306=item *
1307
1308The microperl build, broken since Perl 5.15.7, has now been restored.
1309
1310=item *
1311
1312The code which generates errors from C<require()> could potentially read one or
1313two bytes before the start of the filename for filenames less than three bytes
1314long and ending C</\.p?\z/>. This has now been fixed. Note that it could
1315never have happened with module names given to C<use()> or C<require()> anyway.
1316
1317=item *
1318
1319The handling of pathnames of modules given to C<require()> has been made
1320thread-safe on VMS.
1321
1322=item *
1323
1324The C<re_compile()> API function, the entry point for perl's regex compiler,
1325was accidentally changed in Perl 5.17.1 to operate on the current engine. This
1326has now been restored to its former core-engine-specific state [perl #114302].
1327
1328=item *
1329
1330Perl 5.17.1 introduced a memory leak into the re-use of run-time regexes where
1331the pattern hasn't changed (i.e. C</$unchanging/>). This has now been fixed.
1332
1333=item *
1334
1335A bug in the compilation of a C</(?{})/> expression which affected the TryCatch
1336test suite has been fixed [perl #114242].
1337
1338=item *
1339
1340Formats no longer leak. They started leaking in Perl 5.17.2.
1341
1342=item *
1343
1344Pod can now be nested in code inside a quoted construct outside of a string
1345eval. This used to work only within string evals [perl #114040].
e5ba1bf1
FC
1346
1347=item *
1348
0bba4573
RS
1349C<goto ''> now looks for an empty label, producing the "goto must have
1350label" error message, instead of exiting the program [perl #111794].
e5ba1bf1 1351
0bba4573 1352=item *
e5ba1bf1 1353
0bba4573
RS
1354C<goto "\0"> now dies with "Can't find label" instead of "goto must have
1355label".
e5ba1bf1 1356
0bba4573 1357=item *
e5ba1bf1 1358
0bba4573
RS
1359The C function C<hv_store> used to result in crashes when used on C<%^H>
1360[perl #111000].
e5ba1bf1 1361
0bba4573
RS
1362=item *
1363
1364A call checker attached to a closure prototype via C<cv_set_call_checker>
1365is now copied to closures cloned from it. So C<cv_set_call_checker> now
1366works inside an attribute handler for a closure.
e5ba1bf1
FC
1367
1368=item *
1369
0bba4573
RS
1370Writing to C<$^N> used to have no effect. Now it croaks with "Modification
1371of a read-only value" by default, but that can be overridden by a custom
1372regular expression engine, as with C<$1> [perl #112184].
1373
23dd6e2e
FC
1374=item *
1375
0bba4573
RS
1376C<undef> on a control character glob (C<undef *^H>) no longer emits an
1377erroneous warning about ambiguity [perl #112456].
23dd6e2e 1378
0bba4573
RS
1379=item *
1380
1381For efficiency's sake, many operators and built-in functions return the
1382same scalar each time. Lvalue subroutines and subroutines in the CORE::
1383namespace were allowing this implementation detail to leak through.
1384C<print &CORE::uc("a"), &CORE::uc("b")> used to print "BB". The same thing
1385would happen with an lvalue subroutine returning the return value of C<uc>.
1386Now the value is copied in such cases.
23dd6e2e
FC
1387
1388=item *
1389
0bba4573
RS
1390C<method {}> syntax with an empty block or a block returning an empty list
1391used to crash or use some random value left on the stack as its invocant.
1392Now it produces an error.
b92848b5 1393
0f023b5a
FC
1394=item *
1395
0bba4573 1396C<vec> now works with extremely large offsets (E<gt>2 GB) [perl #111730].
0f023b5a
FC
1397
1398=item *
1399
0bba4573
RS
1400Changes to overload settings now take effect immediately, as do changes to
1401inheritance that affect overloading. They used to take effect only after
1402C<bless>.
1403
1404Objects that were created before a class had any overloading used to remain
1405non-overloaded even if the class gained overloading through C<use overload>
1406or @ISA changes, and even after C<bless>. This has been fixed
1407[perl #112708].
c53e3a75
FC
1408
1409=item *
1410
0bba4573 1411Classes with overloading can now inherit fallback values.
c53e3a75
FC
1412
1413=item *
1414
0bba4573
RS
1415Overloading was not respecting a fallback value of 0 if there were
1416overloaded objects on both sides of an assignment operator like C<+=>
1417[perl #111856].
0f023b5a
FC
1418
1419=item *
1420
0bba4573
RS
1421C<pos> now croaks with hash and array arguments, instead of producing
1422erroneous warnings.
0f023b5a
FC
1423
1424=item *
1425
0bba4573
RS
1426C<while(each %h)> now implies C<while(defined($_ = each %h))>, like
1427C<readline> and C<readdir>.
0f023b5a 1428
0bba4573
RS
1429=item *
1430
1431Subs in the CORE:: namespace no longer crash after C<undef *_> when called
1432with no argument list (C<&CORE::time> with no parentheses).
1433
1434=item *
1435
1436Unicode 6.1 published an incorrect alias for one of the
1437Canonical_Combining_Class property's values (which range between 0 and
1438254). The alias C<CCC133> should have been C<CCC132>. Perl now
1439overrides the data file furnished by Unicode to give the correct value.
1440
1441=item *
1442
1443C<unpack> no longer produces the "'/' must follow a numeric type in unpack"
1444error when it is the data that are at fault [perl #60204].
1445
1446=item *
1447
1448C<join> and C<"@array"> now call FETCH only once on a tied C<$">
1449[perl #8931].
1450
1451=item *
1452
1453Some subroutine calls generated by compiling core ops affected by a
1454C<CORE::GLOBAL> override had op checking performed twice. The checking
1455is always idempotent for pure Perl code, but the double checking can
1456matter when custom call checkers are involved.
1457
1458=item *
1459
1460A race condition used to exist around fork that could cause a signal sent to
1461the parent to be handled by both parent and child. Signals are now blocked
1462briefly around fork to prevent this from happening [perl #82580].
e5ba1bf1 1463
0fef449b
RS
1464=item *
1465
1466The implementation of code blocks in regular expressions, such as C<(?{})>
1467and C<(??{})>, has been heavily reworked to eliminate a whole slew of bugs.
1468The main user-visible changes are:
1469
1470=over 4
1471
1472=item *
1473
1474Code blocks within patterns are now parsed in the same pass as the
1475surrounding code; in particular it is no longer necessary to have balanced
1476braces: this now works:
1477
1478 /(?{ $x='{' })/
1479
1480This means that this error message is longer generated:
1481
1482 Sequence (?{...}) not terminated or not {}-balanced in regex
1483
1484but a new error may be seen:
1485
1486 Sequence (?{...}) not terminated with ')'
1487
1488In addition, literal code blocks within run-time patterns are only
1489compiled once, at perl compile-time:
1490
1491 for my $p (...) {
1492 # this 'FOO' block of code is compiled once,
1493 # at the same time as the surrounding 'for' loop
1494 /$p{(?{FOO;})/;
1495 }
1496
1497=item *
1498
1499Lexical variables are now sane as regards scope, recursion and closure
1500behavior. In particular, C</A(?{B})C/> behaves (from a closure viewpoint)
1501exactly like C</A/ && do { B } && /C/>, while C<qr/A(?{B})C/> is like
1502C<sub {/A/ && do { B } && /C/}>. So this code now works how you might
1503expect, creating three regexes that match 0, 1, and 2:
1504
1505 for my $i (0..2) {
1506 push @r, qr/^(??{$i})$/;
1507 }
1508 "1" =~ $r[1]; # matches
1509
1510=item *
1511
1512The C<use re 'eval'> pragma is now only required for code blocks defined
1513at runtime; in particular in the following, the text of the C<$r> pattern is
1514still interpolated into the new pattern and recompiled, but the individual
1515compiled code-blocks within C<$r> are reused rather than being recompiled,
1516and C<use re 'eval'> isn't needed any more:
1517
1518 my $r = qr/abc(?{....})def/;
1519 /xyz$r/;
1520
1521=item *
1522
1523Flow control operators no longer crash. Each code block runs in a new
1524dynamic scope, so C<next> etc. will not see
1525any enclosing loops. C<return> returns a value
1526from the code block, not from any enclosing subroutine.
1527
1528=item *
1529
1530Perl normally caches the compilation of run-time patterns, and doesn't
1531recompile if the pattern hasn't changed, but this is now disabled if
1532required for the correct behavior of closures. For example:
1533
1534 my $code = '(??{$x})';
1535 for my $x (1..3) {
1536 # recompile to see fresh value of $x each time
1537 $x =~ /$code/;
1538 }
1539
0fef449b
RS
1540=item *
1541
1542The C</msix> and C<(?msix)> etc. flags are now propagated into the return
1543value from C<(??{})>; this now works:
1544
1545 "AB" =~ /a(??{'b'})/i;
1546
1547=item *
1548
1549Warnings and errors will appear to come from the surrounding code (or for
1550run-time code blocks, from an eval) rather than from an C<re_eval>:
1551
1552 use re 'eval'; $c = '(?{ warn "foo" })'; /$c/;
1553 /(?{ warn "foo" })/;
1554
1555formerly gave:
1556
1557 foo at (re_eval 1) line 1.
1558 foo at (re_eval 2) line 1.
1559
1560and now gives:
1561
1562 foo at (eval 1) line 1.
1563 foo at /some/prog line 2.
1564
1565=back
1566
1567=item *
1568
1569Perl now works as well as can be expected on all releases of Unicode so
1570far. In v5.16, it worked on Unicodes 6.0 and 6.1, but there were
1571various bugs for earlier releases; the older the release the more
1572problems.
1573
1574=item *
1575
1576C<vec> no longer produces "uninitialized" warnings in lvalue context
1577[perl #9423].
1578
1579=item *
1580
1581An optimization involving fixed strings in regular expressions could cause
1582a severe performance penalty in edge cases. This has been fixed
1583[perl #76546].
1584
1585=item *
1586
1587In certain cases, including empty subpatterns within a regular expression (such
1588as C<(?:)> or C<(?:|)>) could disable some optimizations. This has been fixed.
1589
1590=item *
1591
1592The "Can't find an opnumber" message that C<prototype> produces when passed
1593a string like "CORE::nonexistent_keyword" now passes UTF-8 and embedded
1594NULs through unchanged [perl #97478].
1595
1596=item *
1597
1598C<prototype> now treats magical variables like C<$1> the same way as
1599non-magical variables when checking for the CORE:: prefix, instead of
1600treating them as subroutine names.
1601
1602=item *
1603
1604Under threaded perls, a runtime code block in a regular expression could
1605corrupt the package name stored in the op tree, resulting in bad reads
1606in C<caller>, and possibly crashes [perl #113060].
1607
1608=item *
1609
1610Referencing a closure prototype (C<\&{$_[1]}> in an attribute handler for a
1611closure) no longer results in a copy of the subroutine (or assertion
1612failures on debugging builds).
1613
1614=item *
1615
1616C<eval '__PACKAGE__'> now returns the right answer on threaded builds if
1617the current package has been assigned over (as in
1618C<*ThisPackage:: = *ThatPackage::>) [perl #78742].
1619
1620=item *
1621
1622If a package is deleted by code that it calls, it is possible for C<caller>
1623to see a stack frame belonging to that deleted package. C<caller> could
1624crash if the stash's memory address was reused for a scalar and a
1625substitution was performed on the same scalar [perl #113486].
1626
1627=item *
1628
1629C<UNIVERSAL::can> no longer treats its first argument differently
1630depending on whether it is a string or number internally.
1631
1632=item *
1633
1634C<open> with C<< <& >> for the mode checks to see whether the third argument is
1635a number, in determining whether to treat it as a file descriptor or a handle
1636name. Magical variables like C<$1> were always failing the numeric check and
1637being treated as handle names.
1638
1639=item *
1640
1641C<warn>'s handling of magical variables (C<$1>, ties) has undergone several
1642fixes. C<FETCH> is only called once now on a tied argument or a tied C<$@>
1643[perl #97480]. Tied variables returning objects that stringify as "" are
1644no longer ignored. A tied C<$@> that happened to return a reference the
1645I<previous> time it was used is no longer ignored.
1646
1647=item *
1648
1649C<warn ""> now treats C<$@> with a number in it the same way, regardless of
1650whether it happened via C<$@=3> or C<$@="3">. It used to ignore the
1651former. Now it appends "\t...caught", as it has always done with
1652C<$@="3">.
1653
1654=item *
1655
1656Numeric operators on magical variables (e.g., S<C<$1 + 1>>) used to use
1657floating point operations even where integer operations were more appropriate,
1658resulting in loss of accuracy on 64-bit platforms [perl #109542].
1659
1660=item *
1661
1662Unary negation no longer treats a string as a number if the string happened
1663to be used as a number at some point. So, if C<$x> contains the string "dogs",
1664C<-$x> returns "-dogs" even if C<$y=0+$x> has happened at some point.
1665
1666=item *
1667
1668In Perl 5.14, C<-'-10'> was fixed to return "10", not "+10". But magical
1669variables (C<$1>, ties) were not fixed till now [perl #57706].
1670
1671=item *
1672
1673Unary negation now treats strings consistently, regardless of the internal
1674C<UTF8> flag.
1675
1676=item *
1677
1678A regression introduced in Perl v5.16.0 involving
1679C<tr/I<SEARCHLIST>/I<REPLACEMENTLIST>/> has been fixed. Only the first
1680instance is supposed to be meaningful if a character appears more than
1681once in C<I<SEARCHLIST>>. Under some circumstances, the final instance
1682was overriding all earlier ones. [perl #113584]
1683
1684=item *
1685
1686Regular expressions like C<qr/\87/> previously silently inserted a NUL
1687character, thus matching as if it had been written C<qr/\00087/>. Now it
1688matches as if it had been written as C<qr/87/>, with a message that the
1689sequence C<"\8"> is unrecognized.
1690
1691=item *
1692
1693C<__SUB__> now works in special blocks (C<BEGIN>, C<END>, etc.).
1694
1695=item *
1696
1697Thread creation on Windows could theoretically result in a crash if done
1698inside a C<BEGIN> block. It still does not work properly, but it no longer
1699crashes [perl #111610].
1700
1701=item *
1702
1703C<\&{''}> (with the empty string) now autovivifies a stub like any other
1704sub name, and no longer produces the "Unable to create sub" error
1705[perl #94476].
1706
37133b20
RS
1707=item *
1708
1709A regression introduced in v5.14.0 has been fixed, in which some calls
1710to the C<re> module would clobber C<$_> [perl #113750].
1711
1712=item *
1713
1714C<do FILE> now always either sets or clears C<$@>, even when the file can't be
1715read. This ensures that testing C<$@> first (as recommended by the
1716documentation) always returns the correct result.
1717
1718=item *
1719
1720The array iterator used for the C<each @array> construct is now correctly
1721reset when C<@array> is cleared (RT #75596). This happens for example when the
1722array is globally assigned to, as in C<@array = (...)>, but not when its
1723B<values> are assigned to. In terms of the XS API, it means that C<av_clear()>
1724will now reset the iterator.
1725
1726This mirrors the behaviour of the hash iterator when the hash is cleared.
1727
1728=item *
1729
1730C<< $class->can >>, C<< $class->isa >>, and C<< $class->DOES >> now return
1731correct results, regardless of whether that package referred to by C<$class>
1732exists [perl #47113].
1733
1734=item *
1735
1736Arriving signals no longer clear C<$@> [perl #45173].
1737
1738=item *
1739
1740Allow C<my ()> declarations with an empty variable list [perl #113554].
1741
1742=item *
1743
1744During parsing, subs declared after errors no longer leave stubs
1745[perl #113712].
1746
1747=item *
1748
1749Closures containing no string evals no longer hang on to their containing
1750subroutines, allowing variables closed over by outer subroutines to be
1751freed when the outer sub is freed, even if the inner sub still exists
1752[perl #89544].
1753
1754=item *
1755
1756Duplication of in-memory filehandles by opening with a "<&=" or ">&=" mode
1757stopped working properly in 5.16.0. It was causing the new handle to
1758reference a different scalar variable. This has been fixed [perl #113764].
1759
1760=item *
1761
1762C<qr//> expressions no longer crash with custom regular expression engines
1763that do not set C<offs> at regular expression compilation time
1764[perl #112962].
1765
1766=item *
1767
1768C<delete local> no longer crashes with certain magical arrays and hashes
1769[perl #112966].
1770
1771=item *
1772
1773C<local> on elements of certain magical arrays and hashes used not to
1774arrange to have the element deleted on scope exit, even if the element did
1775not exist before C<local>.
1776
1777=item *
1778
1779C<scalar(write)> no longer returns multiple items [perl #73690].
1780
1781=item *
1782
1783String to floating point conversions no longer misparse certain strings under
1784C<use locale> [perl #109318].
1785
1786=item *
1787
1788C<@INC> filters that die no longer leak memory [perl #92252].
1789
1790=item *
1791
1792The implementations of overloaded operations are now called in the correct
1793context. This allows, among other things, being able to properly override
1794C<< <> >> [perl #47119].
1795
1796=item *
1797
1798Specifying only the C<fallback> key when calling C<use overload> now behaves
1799properly [perl #113010].
1800
1801=item *
1802
1803C<< sub foo { my $a = 0; while ($a) { ... } } >> and
1804C<< sub foo { while (0) { ... } } >> now return the same thing [perl #73618].
1805
1806=item *
1807
1808Fixed the debugger C<l> and C<M> commands, and other debugger
1809functionality which was broken in 5.17.0 [perl #113918].
1810
1811=item *
1812
1813String negation now behaves the same under C<use integer;> as it does
1814without [perl #113012].
1815
1816=item *
1817
1818C<chr> now returns the Unicode replacement character (U+FFFD) for -1,
1819regardless of the internal representation. -1 used to wrap if the argument
1820was tied or a string internally.
1821
1822=item *
1823
1824Using a C<format> after its enclosing sub was freed could crash as of
1825perl 5.12.0, if the format referenced lexical variables from the outer sub.
1826
1827=item *
1828
1829Using a C<format> after its enclosing sub was undefined could crash as of
1830perl 5.10.0, if the format referenced lexical variables from the outer sub.
1831
1832=item *
1833
1834Using a C<format> defined inside a closures, which format references
1835lexical variables from outside, never really worked unless the C<write>
1836call was directly inside the closure. In 5.10.0 it even started crashing.
1837Now the copy of that closure nearest the top of the call stack is used to
1838find those variables.
1839
1840=item *
1841
1842Formats that close over variables in special blocks no longer crash if a
1843stub exists with the same name as the special block before the special
1844block is compiled.
1845
1846=item *
1847
1848The parser no longer gets confused, treating C<eval foo ()> as a syntax
1849error if preceded by C<print;> [perl #16249].
1850
1851=item *
1852
1853The return value of C<syscall> is no longer truncated on 64-bit platforms
1854[perl #113980].
1855
1856=item *
1857
1858Constant folding no longer causes C<print 1 ? FOO : BAR> to print to the
1859FOO handle [perl #78064].
1860
1861=item *
1862
1863C<do subname> now calls the named subroutine and uses the file name it
1864returns, instead of opening a file named "subname".
1865
1866=item *
1867
1868Subroutines looked up by rv2cv check hooks (registered by XS modules) are
1869now taken into consideration when determining whether C<foo bar> should be
1870the sub call C<foo(bar)> or the method call C<< "bar"->foo >>.
1871
1872=item *
1873
1874C<CORE::foo::bar> is no longer treated specially, allowing global overrides
1875to be called directly via C<CORE::GLOBAL::uc(...)> [perl #113016].
1876
1877=item *
1878
1879Calling an undefined sub whose typeglob has been undefined now produces the
1880customary "Undefined subroutine called" error, instead of "Not a CODE
1881reference".
1882
1883=item *
1884
1885Two bugs involving @ISA have been fixed. C<*ISA = *glob_without_array> and
1886C<undef *ISA; @{*ISA}> would prevent future modifications to @ISA from
1887updating the internal caches used to look up methods. The
1888*glob_without_array case was a regression from Perl 5.12.
1889
1890=item *
1891
1892Regular expression optimisations sometimes caused C<$> with C</m> to
1893produce failed or incorrect matches [perl #114068].
1894
1895=item *
1896
1897C<__SUB__> now works in a C<sort> block when the enclosing subroutine is
1898predeclared with C<sub foo;> syntax [perl #113710].
1899
1900=item *
1901
1902Unicode properties only apply to Unicode code points, which leads to
1903some subtleties when regular expressions are matched against
1904above-Unicode code points. There is a warning generated to draw your
1905attention to this. However, this warning was being generated
1906inappropriately in some cases, such as when a program was being parsed.
1907Non-Unicode matches such as C<\w> and C<[:word;]> should not generate the
1908warning, as their definitions don't limit them to apply to only Unicode
1909code points. Now the message is only generated when matching against
1910C<\p{}> and C<\P{}>. There remains a bug, [perl #114148], for the very
1911few properties in Unicode that match just a single code point. The
1912warning is not generated if they are matched against an above-Unicode
1913code point.
1914
e5ba1bf1
FC
1915=back
1916
0bba4573 1917=head1 Known Problems
e5ba1bf1 1918
0bba4573
RS
1919XXX Descriptions of platform agnostic bugs we know we can't fix go here. Any
1920tests that had to be C<TODO>ed for the release would be noted here. Unfixed
1921platform specific bugs also go here.
1922
1923[ List each fix as a =item entry ]
1924
1925=over 4
1926
1927=item *
1928
1929XXX
1930
1931=back
e5ba1bf1
FC
1932
1933=head1 Acknowledgements
1934
1935XXX Generate this with:
1936
de3d8d88 1937 perl Porting/acknowledgements.pl v5.17.12..HEAD
e5ba1bf1
FC
1938
1939=head1 Reporting Bugs
1940
1941If you find what you think is a bug, you might check the articles recently
1942posted to the comp.lang.perl.misc newsgroup and the perl bug database at
1943http://rt.perl.org/perlbug/ . There may also be information at
1944http://www.perl.org/ , the Perl Home Page.
1945
1946If you believe you have an unreported bug, please run the L<perlbug> program
1947included with your release. Be sure to trim your bug down to a tiny but
1948sufficient test case. Your bug report, along with the output of C<perl -V>,
1949will be sent off to perlbug@perl.org to be analysed by the Perl porting team.
1950
1951If the bug you are reporting has security implications, which make it
1952inappropriate to send to a publicly archived mailing list, then please send it
1953to perl5-security-report@perl.org. This points to a closed subscription
1954unarchived mailing list, which includes all the core committers, who will be
1955able to help assess the impact of issues, figure out a resolution, and help
1956co-ordinate the release of patches to mitigate or fix the problem across all
1957platforms on which Perl is supported. Please only use this address for
1958security issues in the Perl core, not for modules independently distributed on
1959CPAN.
1960
1961=head1 SEE ALSO
1962
1963The F<Changes> file for an explanation of how to view exhaustive details on
1964what changed.
1965
1966The F<INSTALL> file for how to build Perl.
1967
1968The F<README> file for general stuff.
1969
1970The F<Artistic> and F<Copying> files for copyright information.
1971
1972=cut