This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
import perl5173delta 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
94b31d3f
RS
21=head2 Computed Labels
22
23The loop controls C<next>, C<last> and C<redo>, and the special C<dump>
24operator, now allow arbitrary expressions to be used to compute labels at run
25time. Previously, any argument that was not a constant was treated as the
26empty string.
27
0fef449b
RS
28=head2 More CORE:: subs
29
30Several more built-in functions have been added as subroutines to the
31CORE:: namespace, namely, those non-overridable keywords that can be
32implemented without custom parsers: C<defined>, C<delete>, C<exists>,
33C<glob>, C<pos>, C<protoytpe>, C<scalar>, C<split>, C<study>, and C<undef>.
34
35As some of these have prototypes, C<prototype('CORE::...')> has been
36changed to not make a distinction between overridable and non-overridable
37keywords. This is to make C<prototype('CORE::pos')> consistent with
38C<prototype(&CORE::pos)>.
e5ba1bf1 39
37133b20
RS
40=head2 C<kill> with negative signal names
41
42C<kill> has always allowed a negative signal number, which kills the
43process group instead of a single process. It has also allowed signal
44names. But it did not behave consistently, because negative signal names
45were treated as 0. Now negative signals names like C<-INT> are supported
46and treated the same way as -2 [perl #112990].
47
48=head2 C<pack> is now constant folded.
49
50C<pack> with constant arguments is now constant folded in most cases
51[perl #113470].
e5ba1bf1
FC
52
53=head1 Security
54
55XXX Any security-related notices go here. In particular, any security
56vulnerabilities closed should be noted here rather than in the
57L</Selected Bug Fixes> section.
58
59[ List each security issue as a =head2 entry ]
60
61=head1 Incompatible Changes
62
94b31d3f
RS
63=head2 Defined values stored in environment are forced to byte strings
64
65A value stored in an environment variable has always been stringified. In this
66release, it is converted to be only a byte string. First, it is forced to be a
67only a string. Then if the string is utf8 and the equivalent of
68C<utf8::downgrade()> works, that result is used; otherwise, the equivalent of
69C<utf8::encode()> is used, and a warning is issued about wide characters
70(L</Diagnostics>).
71
72=head2 C<given> now aliases the global C<$_>
73
74Instead of assigning to an implicit lexical C<$_>, C<given> now makes the
75global C<$_> an alias for its argument, just like C<foreach>. However, it
76still uses lexical C<$_> if there is lexical C<$_> in scope (again, just like
77C<foreach>) [perl #114020].
78
0bba4573
RS
79=head2 qw(...) can no longer be used as parentheses
80
81C<qw> lists used to fool the parser into thinking they were always
82surrounded by parentheses. This permitted some surprising constructions
83such as C<foreach $x qw(a b c) {...}>, which should really be written
84C<foreach $x (qw(a b c)) {...}>. These would sometimes get the lexer into
85the wrong state, so they didn't fully work, and the similar C<foreach qw(a
86b c) {...}> that one might expect to be permitted never worked at all.
87
88This side effect of C<qw> has now been abolished. It has been deprecated
89since Perl 5.13.11. It is now necessary to use real parentheses
90everywhere that the grammar calls for them.
e5ba1bf1 91
0bba4573 92=head2 C<\s> in regular expressions now matches a Vertical Tab
e5ba1bf1 93
0bba4573 94[ XXX ]
e5ba1bf1 95
0fef449b
RS
96=head2 C</(?{})/> and C</(??{})/> have been heavily reworked
97
98The implementation of this feature has been almost completely rewritten.
99Although its main intent is to fix bugs, some behaviors, especially
100related to the scope of lexical variables, will have changed. This is
101described more fully in the L</Selected Bug Fixes> section.
102
103=head2 C<\N{BELL}> now refers to U+1F514 instead of U+0007
104
105Unicode 6.0 reused the name "BELL" for a different code point than it
106traditionally had meant. Since Perl v5.14, use of this name still
107referred to U+0007, but would raise a deprecation warning. Now, "BELL"
108refers to U+1F514, and the name for U+0007 is "ALERT". All the
109functions in L<charnames> have been correspondingly updated.
110
111=head2 Alphanumeric operators must now be separated from the closing
112delimiter of regular expressions
113
114You may no longer write something like:
115
116 m/a/and 1
117
118Instead you must write
119
120 m/a/ and 1
121
122with whitespace separating the operator from the closing delimiter of
123the regular expression. Not having whitespace has resulted in a
124deprecation warning since Perl v5.14.0.
125
126=head2 C<require> dies for unreadable files
127
128When C<require> encounters an unreadable file, it now dies. It used to
129ignore the file and continue searching the directories in @INC
130[perl #113422].
131
132=head2 Upgrade to the Unicode 6.2 beta
133
134Unicode 6.2 is proposing some changes that may very well break some CPAN
135modules. The timing of this nicely coincides with Perl's being early in the
136release cycle. This commit takes the current beta 6.2, adds the proposed
137changes that aren't yet in it, and subtracts the changes that would affect \X
138processing, as those turn out to have errors, and may have to be rethought.
139Unicode has been notified of these problems.
140
141This will allow us to gather data as to whether or not the proposed changes
142cause us problems. These will be presented to Unicode to aid in their final
143decision as to whether or not to go forward with the changes.
144
145These changes will be replaced by the final version of Unicode 6.2 before
1465.18.0 is released.
147
e5ba1bf1
FC
148=head1 Deprecations
149
150XXX Any deprecated features, syntax, modules etc. should be listed here. In
151particular, deprecated modules should be listed here even if they are listed as
152an updated module in the L</Modules and Pragmata> section.
153
154[ List each deprecation as a =head2 entry ]
155
156=head1 Performance Enhancements
157
158XXX Changes which enhance performance without changing behaviour go here.
159There may well be none in a stable release.
160
161[ List each enhancement as a =item entry ]
162
163=over 4
164
165=item *
166
0bba4573
RS
167Filetest ops manage the stack in a fractionally more efficient manner.
168
169=item *
170
171Globs used in a numeric context are now numerified directly in most cases,
172rather than being numerified via stringification.
e5ba1bf1 173
0fef449b
RS
174=item *
175
176The C<x> repetition operator is now folded to a single constant at compile
177time if called in scalar context with constant operands and no parentheses
178around the left operand.
179
e5ba1bf1
FC
180=back
181
182=head1 Modules and Pragmata
183
184XXX All changes to installed files in F<cpan/>, F<dist/>, F<ext/> and F<lib/>
185go here. If Module::CoreList is updated, generate an initial draft of the
186following sections using F<Porting/corelist-perldelta.pl>, which prints stub
187entries to STDOUT. Results can be pasted in place of the '=head2' entries
188below. A paragraph summary for important changes should then be added by hand.
189In an ideal world, dual-life modules would have a F<Changes> file that could be
190cribbed.
191
192[ Within each section, list entries as a =item entry ]
193
194=head2 New Modules and Pragmata
195
196=over 4
197
198=item *
199
200XXX
201
202=back
203
204=head2 Updated Modules and Pragmata
205
206=over 4
207
208=item *
209
210L<XXX> has been upgraded from version A.xx to B.yy.
211
212=back
213
214=head2 Removed Modules and Pragmata
215
0bba4573 216=over
e5ba1bf1
FC
217
218=item *
219
0bba4573
RS
220L<Version::Requirements> has been removed from the core distribution. It is
221available under a different name: L<CPAN::Meta::Requirements>.
e5ba1bf1
FC
222
223=back
224
225=head1 Documentation
226
227XXX Changes to files in F<pod/> go here. Consider grouping entries by
228file and be sure to link to the appropriate page, e.g. L<perlfunc>.
229
230=head2 New Documentation
231
232XXX Changes which create B<new> files in F<pod/> go here.
233
234=head3 L<XXX>
235
236XXX Description of the purpose of the new file here
237
238=head2 Changes to Existing Documentation
239
0bba4573 240=head3 L<perldata>
e5ba1bf1 241
0bba4573
RS
242=over 4
243
244=item *
245
246Now explicitly documents the behaviour of hash initializer lists that
247contain duplicate keys.
248
249=back
250
251=head3 L<perldiag>
252
253=over 4
254
255=item *
256
257The explanation of symbolic references being prevented by "strict refs"
258now doesn't assume that the reader knows what symbolic references are.
259
260=back
261
262=head3 L<perlfunc>
e5ba1bf1
FC
263
264=over 4
265
266=item *
267
0bba4573 268The return value of C<pipe> is now documented.
e5ba1bf1 269
37133b20
RS
270=item *
271
272Clarified documentation of C<our>.
273
e5ba1bf1
FC
274=back
275
0fef449b
RS
276=head3 L<perlfaq>
277
278=over 4
279
280=item *
281
282L<perlfaq> has been synchronized with version 5.0150040 from CPAN.
283
284=back
285
286=head3 L<perlcheat>
287
288=over 4
289
290=item *
291
292L<perlcheat> has been reorganized, and a few new sections were added.
293
294=back
295
94b31d3f
RS
296=head3 L<perlop>
297
298=over 4
299
300=item *
301
302Loop control verbs (C<dump>, C<goto>, C<next>, C<last> and C<redo>) have always
303had the same precedence as assignment operators, but this was not documented
304until now.
305
306=back
307
0bba4573 308=head3 Diagnostics
e5ba1bf1
FC
309
310The following additions or changes have been made to diagnostic output,
311including warnings and fatal error messages. For the complete list of
312diagnostic messages, see L<perldiag>.
313
314XXX New or changed warnings emitted by the core's C<C> code go here. Also
315include any changes in L<perldiag> that reconcile it to the C<C> code.
316
317=head2 New Diagnostics
318
319XXX Newly added diagnostic messages go under here, separated into New Errors
320and New Warnings
321
322=head3 New Errors
323
324=over 4
325
326=item *
327
94b31d3f
RS
328L<Unterminated delimiter for here document|perldiag/"Unterminated delimiter for here document">
329
330This message now occurs when a here document label has an initial quotation
331mark but the final quotation mark is missing.
332
333This replaces a bogus and misleading error message about not finding the label
334itself [perl #114104].
335
336=item *
337
338L<panic: child pseudo-process was never scheduled|perldiag/"panic: child pseudo-process was never scheduled">
339
340This error is thrown when a child pseudo-process in the ithreads implementation
341on Windows was not scheduled within the time period allowed and therefore was
342not able to initialize properly [perl #88840].
343
344=item *
345
37133b20
RS
346L<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/">
347
348This error has been added for C<(?&0)>, which is invalid. It used to
349produce an incomprehensible error message [perl #101666].
350
351=item *
352
353L<Can't use an undefined value as a subroutine reference|perldiag/"Can't use an undefined value as %s reference">
354
355Calling an undefined value as a subroutine now produces this error message.
356It used to, but was accidentally disabled, first in Perl 5.004 for
357non-magical variables, and then in Perl 5.14 for magical (e.g., tied)
358variables. It has now been restored. In the mean time, undef was treated
359as an empty string [perl #113576].
e5ba1bf1
FC
360
361=back
362
363=head3 New Warnings
364
365=over 4
366
367=item *
368
94b31d3f
RS
369L<Wide character in setenv|perldiag/"Wide character in %s">
370
371Attempts to put wide characters into environment variables via C<%ENV> now
372provoke this warning.
373
374=item *
375
37133b20
RS
376"L<Invalid negative number (%s) in chr|perldiag/"Invalid negative number (%s) in chr">"
377
378C<chr()> now warns when passed a negative value [perl #83048].
379
380=item *
381
382"L<Integer overflow in srand|perldiag/"Integer overflow in srand">"
383
384C<srand()> now warns when passed a value that doesn't fit in a C<UV> (since the
385value will be truncated rather than overflowing) [perl #40605].
386
387=item *
388
389"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">"
390
391Running perl with the C<-i> flag now warns if no input files are provided on
392the command line [perl #113410].
e5ba1bf1
FC
393
394=back
395
396=head2 Changes to Existing Diagnostics
397
398XXX Changes (i.e. rewording) of diagnostic messages go here
399
400=over 4
401
402=item *
403
0fef449b
RS
404The "Runaway prototype" warning that occurs in bizarre cases has been
405removed as being unhelpful and inconsistent.
406
407=item *
408
409The "Not a format reference" error has been removed, as the only case in
410which it could be triggered was a bug.
411
412=item *
413
414The "Unable to create sub named %s" error has been removed for the same
415reason.
e5ba1bf1 416
37133b20
RS
417=item *
418
419The 'Can't use "my %s" in sort comparison' error has been downgraded to a
420warning, '"my %s" used in sort comparison' (with 'state' instead of 'my'
421for state variables). In addition, the heuristics for guessing whether
422lexical $a or $b has been misused have been improved to generate fewer
423false positives. Lexical $a and $b are no longer disallowed if they are
424outside the sort block. Also, a named unary or list operator inside the
425sort block no longer causes the $a or $b to be ignored [perl #86136].
426
e5ba1bf1
FC
427=back
428
429=head1 Utility Changes
430
431XXX Changes to installed programs such as F<perlbug> and F<xsubpp> go here.
432Most of these are built within the directories F<utils> and F<x2p>.
433
434[ List utility changes as a =head3 entry for each utility and =item
435entries for each change
436Use L<XXX> with program names to get proper documentation linking. ]
437
438=head3 L<XXX>
439
440=over 4
441
442=item *
443
444XXX
445
446=back
447
448=head1 Configuration and Compilation
449
450XXX Changes to F<Configure>, F<installperl>, F<installman>, and analogous tools
451go here. Any other changes to the Perl build process should be listed here.
452However, any platform-specific changes should be listed in the
453L</Platform Support> section, instead.
454
455[ List changes as a =item entry ].
456
457=over 4
458
459=item *
460
94b31d3f
RS
461The pager detection in F<Configure> has been improved to allow responses which
462specify options after the program name, e.g. B</usr/bin/less -R>, if the user
463accepts the default value. This helps B<perldoc> when handling ANSI escapes
464[perl #72156].
e5ba1bf1
FC
465
466=back
467
468=head1 Testing
469
470XXX Any significant changes to the testing of a freshly built perl should be
471listed here. Changes which create B<new> files in F<t/> go here as do any
472large changes to the testing harness (e.g. when parallel testing was added).
473Changes to existing files in F<t/> aren't worth summarizing, although the bugs
474that they represent may be covered elsewhere.
475
476[ List each test improvement as a =item entry ]
477
478=over 4
479
480=item *
481
0bba4573
RS
482The test suite now has a section for tests that require very large amounts
483of memory. These tests won't run by default; they can be enabled by
484setting the C<PERL_TEST_MEMORY> environment variable to the number of
485gibibytes of memory that may be safely used.
e5ba1bf1
FC
486
487=back
488
489=head1 Platform Support
490
491XXX Any changes to platform support should be listed in the sections below.
492
493[ Within the sections, list each platform as a =item entry with specific
494changes as paragraphs below it. ]
495
496=head2 New Platforms
497
498XXX List any platforms that this version of perl compiles on, that previous
499versions did not. These will either be enabled by new files in the F<hints/>
500directories, or new subdirectories and F<README> files at the top level of the
501source tree.
502
503=over 4
504
505=item XXX-some-platform
506
507XXX
508
509=back
510
511=head2 Discontinued Platforms
512
e5ba1bf1
FC
513=over 4
514
94b31d3f 515=item UTS Global
e5ba1bf1 516
94b31d3f
RS
517Support code relating to UTS global has been removed. UTS was a mainframe
518version of System V created by Amdahl, subsequently sold to UTS Global. The
519port has not been touched since before Perl 5.8.0, and UTS Global is now
520defunct.
e5ba1bf1
FC
521
522=back
523
524=head2 Platform-Specific Notes
525
526XXX List any changes for specific platforms. This could include configuration
527and compilation changes or changes in portability/compatibility. However,
528changes within modules for platforms should generally be listed in the
529L</Modules and Pragmata> section.
530
531=over 4
532
0bba4573 533=item clang++
e5ba1bf1 534
0bba4573
RS
535There is now a workaround for a compiler bug that prevented compiling
536with clang++ since Perl 5.15.7 [perl #112786].
537
538=item C++
539
540When compiling the Perl core as C++ (which is only semi-supported), the
541mathom functions are now compiled as C<extern "C">, to ensure proper
542binary compatibility. (However, binary compatibility isn't generally
543guaranteed anyway in the situations where this would matter.)
544
545=item VMS
546
547It should now be possible to compile Perl as C++ on VMS.
e5ba1bf1 548
0fef449b
RS
549=item Win32
550
551C<link> on Win32 now attempts to set C<$!> to more appropriate values
552based on the Win32 API error code. [perl #112272]
553
554Perl no longer mangles the environment block, e.g. when launching a new
555sub-process, when the environment contains non-ASCII characters. Known
556problems still remain, however, when the environment contains characters
557outside of the current ANSI codepage (e.g. see the item about Unicode in
558C<%ENV> in L<http://perl5.git.perl.org/perl.git/blob/HEAD:/Porting/todo.pod>).
559[perl #113536]
560
37133b20
RS
561=item Win32
562
563Building perl with some Windows compilers used to fail due to a problem
564with miniperl's C<glob> operator (which uses the C<perlglob> program)
565deleting the PATH environment variable [perl #113798].
566
94b31d3f
RS
567=item Win32
568
569A new makefile option, USE_64_BIT_INT, has been added to the Windows makefiles.
570Set this to "define" when building a 32-bit perl if you want it to use 64-bit
571integers.
572
573Machine code size reductions, already made to the DLLs of XS modules in Perl
5745.17.2, have now been extended to the perl DLL itself.
575
576Building with VC++ 6.0 was inadvertently broken in Perl 5.17.2 but has now been
577fixed again.
578
0fef449b
RS
579=item VMS
580
581All C header files from the top-level directory of the distribution are now
582installed on VMS, providing consistency with a long-standing practice on other
583platforms. Previously only a subset were installed, which broke non-core
584extension builds for extensions that depended on the missing include files.
585
37133b20
RS
586=item VMS
587
588Quotes are now removed from the command verb (but not the parameters) for
589commands spawned via C<system>, backticks, or a piped C<open>. Previously,
590quotes on the verb were passed through to DCL, which would fail to recognize
591the command. Also, if the verb is actually a path to an image or command
592procedure on an ODS-5 volume, quoting it now allows the path to contain spaces.
593
94b31d3f
RS
594=item VMS
595
596The B<a2p> build has been fixed for the HP C++ compiler on OpenVMS.
597
37133b20
RS
598=item AIX
599
600Configure now always adds C<-qlanglvl=extc99> to the CC flags on AIX when
601using xlC. This will make it easier to compile a number of XS-based modules
602that assume C99 [perl #113778].
603
e5ba1bf1
FC
604=back
605
606=head1 Internal Changes
607
0bba4573 608=over
e5ba1bf1 609
0bba4573 610=item *
e5ba1bf1 611
0bba4573
RS
612The C<CV *> typemap entry now supports C<&{}> overloading and typeglobs,
613just like C<&{...}> [perl #96872].
e5ba1bf1
FC
614
615=item *
616
0bba4573
RS
617The C<SVf_AMAGIC> flag to indicate overloading is now on the stash, not the
618object. It is now set automatically whenever a method or @ISA changes, so
619its meaning has changed, too. It now means "potentially overloaded". When
620the overload table is calculated, the flag is automatically turned off if
621there is no overloading, so there should be no noticeable slowdown.
622
623The staleness of the overload tables is now checked when overload methods
624are invoked, rather than during C<bless>.
625
626"A" magic is gone. The changes to the handling of the C<SVf_AMAGIC> flag
627eliminate the need for it.
628
629C<PL_amagic_generation> has been removed as no longer necessary. For XS
630modules, it is now a macro alias to C<PL_na>.
631
632The fallback overload setting is now stored in a stash entry separate from
633overloadedness itself.
634
635=item *
636
637The character-processing code has been cleaned up in places. The changes
638should be operationally invisible.
e5ba1bf1 639
0fef449b
RS
640=item *
641
642The C<study> function was made a no-op in 5.16. It was simply disabled via
643a C<return> statement; the code was left in place. Now the code supporting
644what C<study> used to do has been removed.
645
646=item *
647
648Under threaded perls, there is no longer a separate PV allocated for every
649COP to store its package name (C<< cop->stashpv >>). Instead, there is an
650offset (C<< cop->stashoff >>) into the new C<PL_stashpad> array, which
651holds stash pointers.
652
653=item *
654
655In the pluggable regex API, the C<regexp_engine> struct has acquired a new
656field C<op_comp>, which is currently just for perl's internal use, and
657should be initialised to NULL by other regex plugin modules.
658
659=item *
660
661A new function C<alloccoptash> has been added to the API, but is considered
662experimental. See L<perlapi>.
663
37133b20
RS
664=item *
665
666Perl used to implement get magic in a way that would sometimes hide bugs in
667code could call mg_get() too many times on magical values. This hiding of
668errors no longer occurs, so long-standing bugs may become visible now. If
669you see magic-related errors in XS code, check to make sure it, together
670with the Perl API functions it uses, calls mg_get() only once on SvGMAGICAL()
671values.
672
673=item *
674
675OP allocation for CVs now uses a slab allocator. This simplifies
676memory management for OPs allocated to a CV, so cleaning up after a
677compilation error is simpler and safer [perl #111462][perl #112312].
678
679=item *
680
681PERL_DEBUG_READONLY_OPS has been rewritten to work with the new slab
682allocator, allowing it to catch more violations than before.
683
684=item *
685
686The old slab allocator for ops, which was only enabled for PERL_IMPLICIT_SYS
687and PERL_DEBUG_READONLY_OPS, has been retired.
688
e5ba1bf1
FC
689=back
690
691=head1 Selected Bug Fixes
692
94b31d3f
RS
693=over 4
694
695=item *
e5ba1bf1 696
94b31d3f
RS
697C<\w> now matches the code points U+200C (ZERO WIDTH NON-JOINER) and U+200D
698(ZERO WIDTH JOINER). C<\W> no longer matches these. This change is because
699Unicode corrected their definition of what C<\w> should match.
e5ba1bf1 700
94b31d3f
RS
701=item *
702
703C<dump LABEL> no longer leaks its label.
704
705=item *
706
707Constant folding no longer changes the behaviour of functions like C<stat()>
708and C<truncate()> that can take either filenames or handles.
709C<stat 1 ? foo : bar> nows treats its argument as a file name (since it is an
710arbitrary expression), rather than the handle "foo".
711
712=item *
713
714C<truncate FOO, $len> no longer falls back to treating "FOO" as a file name if
715the filehandle has been deleted. This was broken in Perl 5.16.0.
716
717=item *
718
719Subroutine redefinitions after sub-to-glob and glob-to-glob assignments no
720longer cause double frees or panic messages.
721
722=item *
723
724C<s///> now turns vstrings into plain strings when performing a substitution,
725even if the resulting string is the same (C<s/a/a/>).
726
727=item *
728
729Prototype mismatch warnings no longer erroneously treat constant subs as having
730no prototype when they actually have "".
731
732=item *
733
734Constant subroutines and forward declarations no longer prevent prototype
735mismatch warnings from omitting the sub name.
736
737=item *
738
739C<undef> on a subroutine now clears call checkers.
740
741=item *
742
743The C<ref> operator started leaking memory on blessed objects in Perl 5.16.0.
744This has been fixed [perl #114340].
745
746=item *
747
748C<use> no longer tries to parse its arguments as a statement, making
749C<use constant { () };> a syntax error [perl #114222].
750
751=item *
752
753On debugging builds, "uninitialized" warnings inside formats no longer cause
754assertion failures.
755
756=item *
757
758On debugging builds, subroutines nested inside formats no longer cause
759assertion failures [perl #78550].
760
761=item *
762
763Formats and C<use> statements are now permitted inside formats.
764
765=item *
766
767C<print $x> and C<sub { print $x }-E<gt>()> now always produce the same output.
768It was possible for the latter to refuse to close over $x if the variable was
769not active; e.g., if it was defined outside a currently-running named
770subroutine.
771
772=item *
773
774Similarly, C<print $x> and C<print eval '$x'> now produce the same output.
775This also allows "my $x if 0" variables to be seen in the debugger [perl
776#114018].
777
778=item *
779
780Formats called recursively no longer stomp on their own lexical variables, but
781each recursive call has its own set of lexicals.
782
783=item *
784
785Attempting to free an active format or the handle associated with it no longer
786results in a crash.
787
788=item *
789
790Format parsing no longer gets confused by braces, semicolons and low-precedence
791operators. It used to be possible to use braces as format delimiters (instead
792of C<=> and C<.>), but only sometimes. Semicolons and low-precedence operators
793in format argument lines no longer confuse the parser into ignoring the line's
794return value. In format argument lines, braces can now be used for anonymous
795hashes, instead of being treated always as C<do> blocks.
796
797=item *
798
799Formats can now be nested inside code blocks in regular expressions and other
800quoted constructs (C</(?{...})/> and C<qq/${...}/>) [perl #114040].
801
802=item *
803
804Formats are no longer created after compilation errors.
805
806=item *
807
808Some format syntax errors started causing crashes in Perl 5.17.2, but have now
809been fixed.
810
811=item *
812
813Under debugging builds, the B<-DA> command line option started crashing in Perl
8145.16.0. It has been fixed [perl #114368].
815
816=item *
817
818Scope::Escape compatibility, which was broken in Perl 5.17.2, has been restored
819[perl #113872].
820
821=item *
822
823A potential deadlock scenario involving the premature termination of a pseudo-
824forked child in a Windows build with ithreads enabled has been fixed. This
825resolves the common problem of the F<t/op/fork.t> test hanging on Windows [perl
826#88840].
827
828=item *
829
830The microperl build, broken since Perl 5.15.7, has now been restored.
831
832=item *
833
834The code which generates errors from C<require()> could potentially read one or
835two bytes before the start of the filename for filenames less than three bytes
836long and ending C</\.p?\z/>. This has now been fixed. Note that it could
837never have happened with module names given to C<use()> or C<require()> anyway.
838
839=item *
840
841The handling of pathnames of modules given to C<require()> has been made
842thread-safe on VMS.
843
844=item *
845
846The C<re_compile()> API function, the entry point for perl's regex compiler,
847was accidentally changed in Perl 5.17.1 to operate on the current engine. This
848has now been restored to its former core-engine-specific state [perl #114302].
849
850=item *
851
852Perl 5.17.1 introduced a memory leak into the re-use of run-time regexes where
853the pattern hasn't changed (i.e. C</$unchanging/>). This has now been fixed.
854
855=item *
856
857A bug in the compilation of a C</(?{})/> expression which affected the TryCatch
858test suite has been fixed [perl #114242].
859
860=item *
861
862Formats no longer leak. They started leaking in Perl 5.17.2.
863
864=item *
865
866Pod can now be nested in code inside a quoted construct outside of a string
867eval. This used to work only within string evals [perl #114040].
e5ba1bf1
FC
868
869=item *
870
0bba4573
RS
871C<goto ''> now looks for an empty label, producing the "goto must have
872label" error message, instead of exiting the program [perl #111794].
e5ba1bf1 873
0bba4573 874=item *
e5ba1bf1 875
0bba4573
RS
876C<goto "\0"> now dies with "Can't find label" instead of "goto must have
877label".
e5ba1bf1 878
0bba4573 879=item *
e5ba1bf1 880
0bba4573
RS
881The C function C<hv_store> used to result in crashes when used on C<%^H>
882[perl #111000].
e5ba1bf1 883
0bba4573
RS
884=item *
885
886A call checker attached to a closure prototype via C<cv_set_call_checker>
887is now copied to closures cloned from it. So C<cv_set_call_checker> now
888works inside an attribute handler for a closure.
e5ba1bf1
FC
889
890=item *
891
0bba4573
RS
892Writing to C<$^N> used to have no effect. Now it croaks with "Modification
893of a read-only value" by default, but that can be overridden by a custom
894regular expression engine, as with C<$1> [perl #112184].
895
23dd6e2e
FC
896=item *
897
0bba4573
RS
898C<undef> on a control character glob (C<undef *^H>) no longer emits an
899erroneous warning about ambiguity [perl #112456].
23dd6e2e 900
0bba4573
RS
901=item *
902
903For efficiency's sake, many operators and built-in functions return the
904same scalar each time. Lvalue subroutines and subroutines in the CORE::
905namespace were allowing this implementation detail to leak through.
906C<print &CORE::uc("a"), &CORE::uc("b")> used to print "BB". The same thing
907would happen with an lvalue subroutine returning the return value of C<uc>.
908Now the value is copied in such cases.
23dd6e2e
FC
909
910=item *
911
0bba4573
RS
912C<method {}> syntax with an empty block or a block returning an empty list
913used to crash or use some random value left on the stack as its invocant.
914Now it produces an error.
b92848b5 915
0f023b5a
FC
916=item *
917
0bba4573 918C<vec> now works with extremely large offsets (E<gt>2 GB) [perl #111730].
0f023b5a
FC
919
920=item *
921
0bba4573
RS
922Changes to overload settings now take effect immediately, as do changes to
923inheritance that affect overloading. They used to take effect only after
924C<bless>.
925
926Objects that were created before a class had any overloading used to remain
927non-overloaded even if the class gained overloading through C<use overload>
928or @ISA changes, and even after C<bless>. This has been fixed
929[perl #112708].
c53e3a75
FC
930
931=item *
932
0bba4573 933Classes with overloading can now inherit fallback values.
c53e3a75
FC
934
935=item *
936
0bba4573
RS
937Overloading was not respecting a fallback value of 0 if there were
938overloaded objects on both sides of an assignment operator like C<+=>
939[perl #111856].
0f023b5a
FC
940
941=item *
942
0bba4573
RS
943C<pos> now croaks with hash and array arguments, instead of producing
944erroneous warnings.
0f023b5a
FC
945
946=item *
947
0bba4573
RS
948C<while(each %h)> now implies C<while(defined($_ = each %h))>, like
949C<readline> and C<readdir>.
0f023b5a 950
0bba4573
RS
951=item *
952
953Subs in the CORE:: namespace no longer crash after C<undef *_> when called
954with no argument list (C<&CORE::time> with no parentheses).
955
956=item *
957
958Unicode 6.1 published an incorrect alias for one of the
959Canonical_Combining_Class property's values (which range between 0 and
960254). The alias C<CCC133> should have been C<CCC132>. Perl now
961overrides the data file furnished by Unicode to give the correct value.
962
963=item *
964
965C<unpack> no longer produces the "'/' must follow a numeric type in unpack"
966error when it is the data that are at fault [perl #60204].
967
968=item *
969
970C<join> and C<"@array"> now call FETCH only once on a tied C<$">
971[perl #8931].
972
973=item *
974
975Some subroutine calls generated by compiling core ops affected by a
976C<CORE::GLOBAL> override had op checking performed twice. The checking
977is always idempotent for pure Perl code, but the double checking can
978matter when custom call checkers are involved.
979
980=item *
981
982A race condition used to exist around fork that could cause a signal sent to
983the parent to be handled by both parent and child. Signals are now blocked
984briefly around fork to prevent this from happening [perl #82580].
e5ba1bf1 985
0fef449b
RS
986=item *
987
988The implementation of code blocks in regular expressions, such as C<(?{})>
989and C<(??{})>, has been heavily reworked to eliminate a whole slew of bugs.
990The main user-visible changes are:
991
992=over 4
993
994=item *
995
996Code blocks within patterns are now parsed in the same pass as the
997surrounding code; in particular it is no longer necessary to have balanced
998braces: this now works:
999
1000 /(?{ $x='{' })/
1001
1002This means that this error message is longer generated:
1003
1004 Sequence (?{...}) not terminated or not {}-balanced in regex
1005
1006but a new error may be seen:
1007
1008 Sequence (?{...}) not terminated with ')'
1009
1010In addition, literal code blocks within run-time patterns are only
1011compiled once, at perl compile-time:
1012
1013 for my $p (...) {
1014 # this 'FOO' block of code is compiled once,
1015 # at the same time as the surrounding 'for' loop
1016 /$p{(?{FOO;})/;
1017 }
1018
1019=item *
1020
1021Lexical variables are now sane as regards scope, recursion and closure
1022behavior. In particular, C</A(?{B})C/> behaves (from a closure viewpoint)
1023exactly like C</A/ && do { B } && /C/>, while C<qr/A(?{B})C/> is like
1024C<sub {/A/ && do { B } && /C/}>. So this code now works how you might
1025expect, creating three regexes that match 0, 1, and 2:
1026
1027 for my $i (0..2) {
1028 push @r, qr/^(??{$i})$/;
1029 }
1030 "1" =~ $r[1]; # matches
1031
1032=item *
1033
1034The C<use re 'eval'> pragma is now only required for code blocks defined
1035at runtime; in particular in the following, the text of the C<$r> pattern is
1036still interpolated into the new pattern and recompiled, but the individual
1037compiled code-blocks within C<$r> are reused rather than being recompiled,
1038and C<use re 'eval'> isn't needed any more:
1039
1040 my $r = qr/abc(?{....})def/;
1041 /xyz$r/;
1042
1043=item *
1044
1045Flow control operators no longer crash. Each code block runs in a new
1046dynamic scope, so C<next> etc. will not see
1047any enclosing loops. C<return> returns a value
1048from the code block, not from any enclosing subroutine.
1049
1050=item *
1051
1052Perl normally caches the compilation of run-time patterns, and doesn't
1053recompile if the pattern hasn't changed, but this is now disabled if
1054required for the correct behavior of closures. For example:
1055
1056 my $code = '(??{$x})';
1057 for my $x (1..3) {
1058 # recompile to see fresh value of $x each time
1059 $x =~ /$code/;
1060 }
1061
0fef449b
RS
1062=item *
1063
1064The C</msix> and C<(?msix)> etc. flags are now propagated into the return
1065value from C<(??{})>; this now works:
1066
1067 "AB" =~ /a(??{'b'})/i;
1068
1069=item *
1070
1071Warnings and errors will appear to come from the surrounding code (or for
1072run-time code blocks, from an eval) rather than from an C<re_eval>:
1073
1074 use re 'eval'; $c = '(?{ warn "foo" })'; /$c/;
1075 /(?{ warn "foo" })/;
1076
1077formerly gave:
1078
1079 foo at (re_eval 1) line 1.
1080 foo at (re_eval 2) line 1.
1081
1082and now gives:
1083
1084 foo at (eval 1) line 1.
1085 foo at /some/prog line 2.
1086
1087=back
1088
1089=item *
1090
1091Perl now works as well as can be expected on all releases of Unicode so
1092far. In v5.16, it worked on Unicodes 6.0 and 6.1, but there were
1093various bugs for earlier releases; the older the release the more
1094problems.
1095
1096=item *
1097
1098C<vec> no longer produces "uninitialized" warnings in lvalue context
1099[perl #9423].
1100
1101=item *
1102
1103An optimization involving fixed strings in regular expressions could cause
1104a severe performance penalty in edge cases. This has been fixed
1105[perl #76546].
1106
1107=item *
1108
1109In certain cases, including empty subpatterns within a regular expression (such
1110as C<(?:)> or C<(?:|)>) could disable some optimizations. This has been fixed.
1111
1112=item *
1113
1114The "Can't find an opnumber" message that C<prototype> produces when passed
1115a string like "CORE::nonexistent_keyword" now passes UTF-8 and embedded
1116NULs through unchanged [perl #97478].
1117
1118=item *
1119
1120C<prototype> now treats magical variables like C<$1> the same way as
1121non-magical variables when checking for the CORE:: prefix, instead of
1122treating them as subroutine names.
1123
1124=item *
1125
1126Under threaded perls, a runtime code block in a regular expression could
1127corrupt the package name stored in the op tree, resulting in bad reads
1128in C<caller>, and possibly crashes [perl #113060].
1129
1130=item *
1131
1132Referencing a closure prototype (C<\&{$_[1]}> in an attribute handler for a
1133closure) no longer results in a copy of the subroutine (or assertion
1134failures on debugging builds).
1135
1136=item *
1137
1138C<eval '__PACKAGE__'> now returns the right answer on threaded builds if
1139the current package has been assigned over (as in
1140C<*ThisPackage:: = *ThatPackage::>) [perl #78742].
1141
1142=item *
1143
1144If a package is deleted by code that it calls, it is possible for C<caller>
1145to see a stack frame belonging to that deleted package. C<caller> could
1146crash if the stash's memory address was reused for a scalar and a
1147substitution was performed on the same scalar [perl #113486].
1148
1149=item *
1150
1151C<UNIVERSAL::can> no longer treats its first argument differently
1152depending on whether it is a string or number internally.
1153
1154=item *
1155
1156C<open> with C<< <& >> for the mode checks to see whether the third argument is
1157a number, in determining whether to treat it as a file descriptor or a handle
1158name. Magical variables like C<$1> were always failing the numeric check and
1159being treated as handle names.
1160
1161=item *
1162
1163C<warn>'s handling of magical variables (C<$1>, ties) has undergone several
1164fixes. C<FETCH> is only called once now on a tied argument or a tied C<$@>
1165[perl #97480]. Tied variables returning objects that stringify as "" are
1166no longer ignored. A tied C<$@> that happened to return a reference the
1167I<previous> time it was used is no longer ignored.
1168
1169=item *
1170
1171C<warn ""> now treats C<$@> with a number in it the same way, regardless of
1172whether it happened via C<$@=3> or C<$@="3">. It used to ignore the
1173former. Now it appends "\t...caught", as it has always done with
1174C<$@="3">.
1175
1176=item *
1177
1178Numeric operators on magical variables (e.g., S<C<$1 + 1>>) used to use
1179floating point operations even where integer operations were more appropriate,
1180resulting in loss of accuracy on 64-bit platforms [perl #109542].
1181
1182=item *
1183
1184Unary negation no longer treats a string as a number if the string happened
1185to be used as a number at some point. So, if C<$x> contains the string "dogs",
1186C<-$x> returns "-dogs" even if C<$y=0+$x> has happened at some point.
1187
1188=item *
1189
1190In Perl 5.14, C<-'-10'> was fixed to return "10", not "+10". But magical
1191variables (C<$1>, ties) were not fixed till now [perl #57706].
1192
1193=item *
1194
1195Unary negation now treats strings consistently, regardless of the internal
1196C<UTF8> flag.
1197
1198=item *
1199
1200A regression introduced in Perl v5.16.0 involving
1201C<tr/I<SEARCHLIST>/I<REPLACEMENTLIST>/> has been fixed. Only the first
1202instance is supposed to be meaningful if a character appears more than
1203once in C<I<SEARCHLIST>>. Under some circumstances, the final instance
1204was overriding all earlier ones. [perl #113584]
1205
1206=item *
1207
1208Regular expressions like C<qr/\87/> previously silently inserted a NUL
1209character, thus matching as if it had been written C<qr/\00087/>. Now it
1210matches as if it had been written as C<qr/87/>, with a message that the
1211sequence C<"\8"> is unrecognized.
1212
1213=item *
1214
1215C<__SUB__> now works in special blocks (C<BEGIN>, C<END>, etc.).
1216
1217=item *
1218
1219Thread creation on Windows could theoretically result in a crash if done
1220inside a C<BEGIN> block. It still does not work properly, but it no longer
1221crashes [perl #111610].
1222
1223=item *
1224
1225C<\&{''}> (with the empty string) now autovivifies a stub like any other
1226sub name, and no longer produces the "Unable to create sub" error
1227[perl #94476].
1228
37133b20
RS
1229=item *
1230
1231A regression introduced in v5.14.0 has been fixed, in which some calls
1232to the C<re> module would clobber C<$_> [perl #113750].
1233
1234=item *
1235
1236C<do FILE> now always either sets or clears C<$@>, even when the file can't be
1237read. This ensures that testing C<$@> first (as recommended by the
1238documentation) always returns the correct result.
1239
1240=item *
1241
1242The array iterator used for the C<each @array> construct is now correctly
1243reset when C<@array> is cleared (RT #75596). This happens for example when the
1244array is globally assigned to, as in C<@array = (...)>, but not when its
1245B<values> are assigned to. In terms of the XS API, it means that C<av_clear()>
1246will now reset the iterator.
1247
1248This mirrors the behaviour of the hash iterator when the hash is cleared.
1249
1250=item *
1251
1252C<< $class->can >>, C<< $class->isa >>, and C<< $class->DOES >> now return
1253correct results, regardless of whether that package referred to by C<$class>
1254exists [perl #47113].
1255
1256=item *
1257
1258Arriving signals no longer clear C<$@> [perl #45173].
1259
1260=item *
1261
1262Allow C<my ()> declarations with an empty variable list [perl #113554].
1263
1264=item *
1265
1266During parsing, subs declared after errors no longer leave stubs
1267[perl #113712].
1268
1269=item *
1270
1271Closures containing no string evals no longer hang on to their containing
1272subroutines, allowing variables closed over by outer subroutines to be
1273freed when the outer sub is freed, even if the inner sub still exists
1274[perl #89544].
1275
1276=item *
1277
1278Duplication of in-memory filehandles by opening with a "<&=" or ">&=" mode
1279stopped working properly in 5.16.0. It was causing the new handle to
1280reference a different scalar variable. This has been fixed [perl #113764].
1281
1282=item *
1283
1284C<qr//> expressions no longer crash with custom regular expression engines
1285that do not set C<offs> at regular expression compilation time
1286[perl #112962].
1287
1288=item *
1289
1290C<delete local> no longer crashes with certain magical arrays and hashes
1291[perl #112966].
1292
1293=item *
1294
1295C<local> on elements of certain magical arrays and hashes used not to
1296arrange to have the element deleted on scope exit, even if the element did
1297not exist before C<local>.
1298
1299=item *
1300
1301C<scalar(write)> no longer returns multiple items [perl #73690].
1302
1303=item *
1304
1305String to floating point conversions no longer misparse certain strings under
1306C<use locale> [perl #109318].
1307
1308=item *
1309
1310C<@INC> filters that die no longer leak memory [perl #92252].
1311
1312=item *
1313
1314The implementations of overloaded operations are now called in the correct
1315context. This allows, among other things, being able to properly override
1316C<< <> >> [perl #47119].
1317
1318=item *
1319
1320Specifying only the C<fallback> key when calling C<use overload> now behaves
1321properly [perl #113010].
1322
1323=item *
1324
1325C<< sub foo { my $a = 0; while ($a) { ... } } >> and
1326C<< sub foo { while (0) { ... } } >> now return the same thing [perl #73618].
1327
1328=item *
1329
1330Fixed the debugger C<l> and C<M> commands, and other debugger
1331functionality which was broken in 5.17.0 [perl #113918].
1332
1333=item *
1334
1335String negation now behaves the same under C<use integer;> as it does
1336without [perl #113012].
1337
1338=item *
1339
1340C<chr> now returns the Unicode replacement character (U+FFFD) for -1,
1341regardless of the internal representation. -1 used to wrap if the argument
1342was tied or a string internally.
1343
1344=item *
1345
1346Using a C<format> after its enclosing sub was freed could crash as of
1347perl 5.12.0, if the format referenced lexical variables from the outer sub.
1348
1349=item *
1350
1351Using a C<format> after its enclosing sub was undefined could crash as of
1352perl 5.10.0, if the format referenced lexical variables from the outer sub.
1353
1354=item *
1355
1356Using a C<format> defined inside a closures, which format references
1357lexical variables from outside, never really worked unless the C<write>
1358call was directly inside the closure. In 5.10.0 it even started crashing.
1359Now the copy of that closure nearest the top of the call stack is used to
1360find those variables.
1361
1362=item *
1363
1364Formats that close over variables in special blocks no longer crash if a
1365stub exists with the same name as the special block before the special
1366block is compiled.
1367
1368=item *
1369
1370The parser no longer gets confused, treating C<eval foo ()> as a syntax
1371error if preceded by C<print;> [perl #16249].
1372
1373=item *
1374
1375The return value of C<syscall> is no longer truncated on 64-bit platforms
1376[perl #113980].
1377
1378=item *
1379
1380Constant folding no longer causes C<print 1 ? FOO : BAR> to print to the
1381FOO handle [perl #78064].
1382
1383=item *
1384
1385C<do subname> now calls the named subroutine and uses the file name it
1386returns, instead of opening a file named "subname".
1387
1388=item *
1389
1390Subroutines looked up by rv2cv check hooks (registered by XS modules) are
1391now taken into consideration when determining whether C<foo bar> should be
1392the sub call C<foo(bar)> or the method call C<< "bar"->foo >>.
1393
1394=item *
1395
1396C<CORE::foo::bar> is no longer treated specially, allowing global overrides
1397to be called directly via C<CORE::GLOBAL::uc(...)> [perl #113016].
1398
1399=item *
1400
1401Calling an undefined sub whose typeglob has been undefined now produces the
1402customary "Undefined subroutine called" error, instead of "Not a CODE
1403reference".
1404
1405=item *
1406
1407Two bugs involving @ISA have been fixed. C<*ISA = *glob_without_array> and
1408C<undef *ISA; @{*ISA}> would prevent future modifications to @ISA from
1409updating the internal caches used to look up methods. The
1410*glob_without_array case was a regression from Perl 5.12.
1411
1412=item *
1413
1414Regular expression optimisations sometimes caused C<$> with C</m> to
1415produce failed or incorrect matches [perl #114068].
1416
1417=item *
1418
1419C<__SUB__> now works in a C<sort> block when the enclosing subroutine is
1420predeclared with C<sub foo;> syntax [perl #113710].
1421
1422=item *
1423
1424Unicode properties only apply to Unicode code points, which leads to
1425some subtleties when regular expressions are matched against
1426above-Unicode code points. There is a warning generated to draw your
1427attention to this. However, this warning was being generated
1428inappropriately in some cases, such as when a program was being parsed.
1429Non-Unicode matches such as C<\w> and C<[:word;]> should not generate the
1430warning, as their definitions don't limit them to apply to only Unicode
1431code points. Now the message is only generated when matching against
1432C<\p{}> and C<\P{}>. There remains a bug, [perl #114148], for the very
1433few properties in Unicode that match just a single code point. The
1434warning is not generated if they are matched against an above-Unicode
1435code point.
1436
e5ba1bf1
FC
1437=back
1438
0bba4573 1439=head1 Known Problems
e5ba1bf1 1440
0bba4573
RS
1441XXX Descriptions of platform agnostic bugs we know we can't fix go here. Any
1442tests that had to be C<TODO>ed for the release would be noted here. Unfixed
1443platform specific bugs also go here.
1444
1445[ List each fix as a =item entry ]
1446
1447=over 4
1448
1449=item *
1450
1451XXX
1452
1453=back
e5ba1bf1
FC
1454
1455=head1 Acknowledgements
1456
1457XXX Generate this with:
1458
de3d8d88 1459 perl Porting/acknowledgements.pl v5.17.12..HEAD
e5ba1bf1
FC
1460
1461=head1 Reporting Bugs
1462
1463If you find what you think is a bug, you might check the articles recently
1464posted to the comp.lang.perl.misc newsgroup and the perl bug database at
1465http://rt.perl.org/perlbug/ . There may also be information at
1466http://www.perl.org/ , the Perl Home Page.
1467
1468If you believe you have an unreported bug, please run the L<perlbug> program
1469included with your release. Be sure to trim your bug down to a tiny but
1470sufficient test case. Your bug report, along with the output of C<perl -V>,
1471will be sent off to perlbug@perl.org to be analysed by the Perl porting team.
1472
1473If the bug you are reporting has security implications, which make it
1474inappropriate to send to a publicly archived mailing list, then please send it
1475to perl5-security-report@perl.org. This points to a closed subscription
1476unarchived mailing list, which includes all the core committers, who will be
1477able to help assess the impact of issues, figure out a resolution, and help
1478co-ordinate the release of patches to mitigate or fix the problem across all
1479platforms on which Perl is supported. Please only use this address for
1480security issues in the Perl core, not for modules independently distributed on
1481CPAN.
1482
1483=head1 SEE ALSO
1484
1485The F<Changes> file for an explanation of how to view exhaustive details on
1486what changed.
1487
1488The F<INSTALL> file for how to build Perl.
1489
1490The F<README> file for general stuff.
1491
1492The F<Artistic> and F<Copying> files for copyright information.
1493
1494=cut