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