This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldelta for 186a5ba82d58
[perl5.git] / pod / perldelta.pod
CommitLineData
44691e6f
AB
1=encoding utf8
2
e2f0c3bb 3=for todo
1f99886b
JL
45204593b74eb sv.c: Make sv_pvn_force_flags guard against SV_UNDEF_RETURNS_NULL.
5dad26a174010 Since the HTML files generated by pod2html claim to have a utf-8 charset, actually write the files out using utf-8. This is a fix for RT #111446.
628333232a1c7 Don’t localise CopSTASH(&PL_compiling) in newCONSTSUB
7c947b31cf142 Do away with stashpv_hvname_match
8d0279c7ce493 Fix bad assertions in pp_ctl.c:pp_caller
9df826430da0d make TRIE nodes "absorb" NOTHING->EXACT sequences
103b6759a6b102 optimise (?:|) and related NOTHING like constructs out of the compiled optree
115435c3759c45 Experimentally Use Unicode 6.2 beta
124a808ed163df [perl #111610] Trouble with XS-APItest/t/clone-with-stack.t
131db94eebfa93 Quieten B::Deparse warnings (fixes #113464).
1472a866183393 reorganize perlcheat
159a62b98f29d2 gv.c: Don’t ENTER/LEAVE unnecessarily
16ee1b3814fd18 gv.c: Remove mro_method_changed_in() from gv_init
17a3c74922a705 Rmv mro_method_changed_in call on stub upgraded to const
1f99886b 187ad40bcb0a19 Don’t call mro_method_changed_in after newCONSTSUB
e2f0c3bb
FC
1983b195e49dd1 ensure correctness if sv_2mortal modifies errno
20
44691e6f
AB
21=head1 NAME
22
61174fb5 23perldelta - what is new for perl v5.17.1
27f00e3d 24
f9001595 25=head1 DESCRIPTION
2630d42b 26
61174fb5
Z
27This document describes differences between the 5.17.0 release and
28the 5.17.1 release.
7620cb10 29
f9001595 30If you are upgrading from an earlier release such as 5.16.0, first read
61174fb5
Z
31L<perl5170delta>, which describes differences between 5.16.0 and
325.17.0.
d7c042c9 33
61174fb5 34=head1 Core Enhancements
417a992d 35
028c8719
FC
36=head2 More CORE:: subs
37
38Several more built-in functions have been added as subroutines to the
39CORE:: namespace, namely, those non-overridable keywords that can be
40implemented without custom parsers: C<defined>, C<delete>, C<exists>,
f1303084 41C<glob>, C<pos>, C<protoytpe>, C<scalar>, C<split>, C<study>, and C<undef>.
028c8719
FC
42
43As some of these have prototypes, C<prototype('CORE::...')> has been
b1c9e38d 44changed to not make a distinction between overridable and non-overridable
028c8719
FC
45keywords. This is to make C<prototype('CORE::pos')> consistent with
46C<prototype(&CORE::pos)>.
47
61174fb5 48=head1 Incompatible Changes
30608892 49
e128ab2c
DM
50=head2 C</(?{})/> and C</(??{}> have been heavily reworked.
51
b1c9e38d
JL
52The implementation of this feature has been almost completely rewritten.
53Although its main intent is to fix bugs, some behaviours, especially
e128ab2c
DM
54related to the scope of lexical variables, will have changed. This is
55described more fully in the L</Selected Bug Fixes> section.
56
fe3193b5
KW
57=head2 C<\N{BELL}> now refers to U+1F514 instead of U+0007
58
59Unicode 6.0 reused the name "BELL" for a different code point than it
60traditionally had meant. Since Perl v5.14, use of this name still
61referred to U+0007, but would raise a deprecated warning. Now, "BELL"
62refers to U+1F514, and the name for U+0007 is "ALERT". All the
63functions in L<charnames> have been correspondingly updated.
05c8f9ed 64
0da72d5e 65=head2 Alphanumeric operators must now be separated from the closing
b1c9e38d 66delimiter of regular expressions
0da72d5e
KW
67
68You may no longer write something like:
69
70 m/a/and 1
71
72Instead you must write
73
74 m/a/ and 1
75
76with whitespace separating the operator from the closing delimiter of
77the regular expression. Not having whitespace has resulted in a
78deprecated warning since Perl v5.14.0.
79
e2f0c3bb
FC
80=head2 C<require> dies for unreadable files
81
82When C<require> encounters an unreadable file, it now dies. It used to
83ignore the file and continue searching the directories in @INC
84[perl #113422].
85
61174fb5 86=head1 Performance Enhancements
95ce428c 87
f9001595 88=over 4
75ff5956 89
2630d42b 90=item *
c11980ad 91
e2f0c3bb
FC
92The C<x> repetition operator is now folded to a single constant at compile
93time if called in scalar context with constant operands and no parentheses
94around the left operand.
53de3ff0 95
61174fb5 96=back
ef7131e9 97
61174fb5 98=head1 Modules and Pragmata
ef7131e9 99
61174fb5 100=head2 Updated Modules and Pragmata
83fb037c 101
61174fb5 102=over 4
83fb037c
FC
103
104=item *
105
c01b3876
SH
106L<ExtUtils::CBuilder> has been upgraded from version 0.280206 to 0.280208.
107
108Manifest files are now correctly embedded for those versions of VC++ which
d5f3e957 109make use of them. [perl #111782, #111798].
c01b3876
SH
110
111=item *
112
5cefbec9
FC
113L<B> has been upgraded from version 1.35 to 1.36.
114
115C<B::COP::stashlen> has been replaced with C<B::COP::stashoff>.
116
18a66a2d 117C<B::COP::stashpv> now supports UTF8 package names and embedded NULs.
fbdb83f3 118
5cefbec9
FC
119=item *
120
e2f0c3bb
FC
121L<Class::Struct> has been upgraded from version 0.63 to 0.64.
122
123The constructor now respects overridden accessor methods [perl #29230].
124
125=item *
126
9331f04e
NC
127L<DynaLoader> has been upgraded from version 1.14 to 1.15.
128
129This is due to a minor code change in the XS for the VMS implementation.
130
131=item *
132
ff3f295c
NC
133L<File::DosGlob> has been upgraded from version 1.07 to 1.08.
134
135There are no visible changes, only minor internal refactorings.
136
137=item *
138
c506fc7e
FC
139L<File::Spec::Unix> has been upgraded from version 3.39_02 to 3.39_03.
140
141C<abs2rel> could produce incorrect results when given two relative paths or
142the root directory twice [perl #111510].
143
144=item *
145
d9661073 146L<IO> has been upgraded from version 1.25_06 to 1.25_07.
1c633914 147
d9661073 148C<sync()> can now be called on read-only file handles [perl #64772].
f558db2f 149
66aa79e2
KW
150=item *
151
99565752
NC
152L<Pod::Html> has been upgraded from version 1.15_02 to 1.16.
153
b1c9e38d 154The option C<--libpods> has been reinstated. It is deprecated, and its use
99565752
NC
155does nothing other than issue a warning that it is no longer supported.
156
157=item *
158
d9661073
FC
159L<Unicode::UCD> has been upgraded from version 0.43 to 0.44.
160
66aa79e2
KW
161This adds a function L<all_casefolds()|Unicode::UCD/all_casefolds()>
162that returns all the casefolds.
163
3630f57e
CBW
164=item *
165
166L<Scalar::Util> has been upgraded from version 1.23 to version 1.25.
167
61174fb5 168=back
f558db2f 169
61174fb5 170=head1 Documentation
80b8b050 171
61174fb5 172=head2 Changes to Existing Documentation
30608892 173
c7166200 174=head3 L<perlfaq>
ecd144ea 175
f9001595 176=over 4
05c8f9ed
RS
177
178=item *
179
c7166200 180L<perlfaq> has been synchronised with version 5.0150040 from C<CPAN>.
9dea6244 181
204b72a4 182=back
9dea6244 183
61174fb5 184=head1 Diagnostics
ef7131e9 185
4a301309
FC
186=head2 Removals of Diagnostics
187
188=over 4
189
a1d2df36
FC
190=item *
191
4a301309
FC
192The "Runaway prototype" warning that occurs in bizarre cases has been
193removed as being unhelpful and inconsistent.
194
8dffc0ab
FC
195=item *
196
197The "Not a format reference" error has been removed, as the only case in
198which it could be triggered was a bug.
199
dbc84d79
FC
200=item *
201
202The "Unable to create sub named %s" error has been removed for the same
203reason.
204
4a301309
FC
205=back
206
61174fb5 207=head1 Platform Support
05c8f9ed 208
61174fb5 209=head2 Platform-Specific Notes
ceb0881c 210
823a90db 211XXX note fails on win2k and vms
89cbc6b8 212
61174fb5 213=over 4
89cbc6b8 214
4aa4c0a5 215=item Win32
c6b15a5a 216
4aa4c0a5
TC
217C<link> on Win32 now attempts to set C<$!> to more appropriate values
218based on the Win32 API error code. [perl #112272]
c6b15a5a 219
0998713f
SH
220Perl no longer mangles the environment block, e.g. when launching a new
221sub-process, when the environment contains non-ASCII characters. Known
222problems still remain, however, when the environment contains characters
223outside of the current ANSI codepage (e.g. see the item about Unicode in
224C<%ENV> in L<http://perl5.git.perl.org/perl.git/blob/HEAD:/Porting/todo.pod>).
225[perl #113536]
226
61174fb5 227=back
8e125188 228
61174fb5 229=head1 Internal Changes
8e125188 230
61174fb5 231=over 4
c4643160 232
422287bf
FC
233=item *
234
b7e9bef4
FC
235The C<study> function was made a no-op in 5.16. It was simply disabled via
236a C<return> statement; the code was left in place. Now the code supporting
237what C<study> used to do has been removed.
53de3ff0 238
f8ef51fd
FC
239=item *
240
241Under threaded perls, there is no longer a separate PV allocated for every
242COP to store its package name (C<< cop->stashpv >>). Instead, there is an
243offset (C<< cop->stashoff >>) into the new C<PL_stashpad> array, which
244holds stash pointers.
245
e128ab2c
DM
246=item *
247
248In the pluggable regex API, the C<regexp_engine> struct has acquired a new
249field C<op_comp>, which is currently just for perl's internal use, and
b1c9e38d 250should be initialised to NULL by other regex plugin modules.
e128ab2c 251
e2f0c3bb
FC
252=item *
253
254A new function C<alloccoptash> has been added to the API, but is considered
255experimental. See L<perlapi>.
256
61174fb5 257=back
422287bf 258
61174fb5 259=head1 Selected Bug Fixes
2de6ba8d 260
61174fb5 261=over 4
52c4b146 262
9aa9a888
KW
263=item *
264
e128ab2c
DM
265The implementation of code blocks in regular expressions, such as C<(?{})>
266and C<(??{})> has been heavily reworked to eliminate a whole slew of bugs.
267The main user-visible changes are:
268
269=over 4
270
271=item *
272
273Code blocks within patterns are now parsed in the same pass as the
274surrounding code; in particular it is no longer necessary to have balanced
275braces: this now works:
276
277 /(?{ $x='{' })/
278
279This means that this error message is longer generated:
280
281 Sequence (?{...}) not terminated or not {}-balanced in regex
282
283but a new error may be seen:
284
285 Sequence (?{...}) not terminated with ')'
286
287In addition, literal code blocks within run-time patterns are only
288compiled once, at perl compile-time:
289
290 for my $p (...) {
291 # this 'FOO' block of code is compiled once,
292 # at the same time as the surrounding 'for' loop
293 /$p{(?{FOO;})/;
294 }
295
296=item *
297
298Lexical variables are now sane as regards scope, recursion and closure
299behaviour. In particular, C</A(?{B})C/> behaves (from a closure viewpoint)
300exactly like C</A/ && do { B } && /C/>, while C<qr/A(?{B})C/> is like
301C<sub {/A/ && do { B } && /C/}>. So this code now works how you might
be722aee 302expect, creating three regexes that match 0, 1, and 2:
e128ab2c
DM
303
304 for my $i (0..2) {
305 push @r, qr/^(??{$i})$/;
306 }
307 "1" =~ $r[1]; # matches
308
309=item *
310
b1c9e38d
JL
311The C<use re 'eval'> pragma is now only required for code blocks defined
312at runtime; in particular in the following, the text of the C<$r> pattern is
e128ab2c 313still interpolated into the new pattern and recompiled, but the individual
b1c9e38d 314compiled code-blocks within C<$r> are reused rather than being recompiled,
e128ab2c
DM
315and C<use re 'eval'> isn't needed any more:
316
317 my $r = qr/abc(?{....})def/;
318 /xyz$r/;
319
320=item *
321
322Flow control operators no longer crash. Each code block runs in a new
323dynamic scope, so C<next> etc. will not see any enclosing loops and
324C<caller> will not see any calling subroutines. C<return> returns a value
325from the code block, not from any enclosing subroutine.
326
327=item *
328
329Perl normally caches the compilation of run-time patterns, and doesn't
330recompile if the pattern hasn't changed; but this is now disabled if
331required for the correct behaviour of closures; for example:
332
333 my $code = '(??{$x})';
334 for my $x (1..3) {
335 # recompile to see fresh value of $x each time
336 $x =~ /$code/;
337 }
338
339
340=item *
341
342The C</msix> and C<(?msix)> etc. flags are now propagated into the return
343value from C<(??{})>; this now works:
344
345 "AB" =~ /a(??{'b'})/i;
346
347=item *
348
349Warnings and errors will appear to come from the surrounding code (or for
350run-time code blocks, from an eval) rather than from an C<re_eval>:
351
352 use re 'eval'; $c = '(?{ warn "foo" })'; /$c/;
353 /(?{ warn "foo" })/;
354
355formerly gave:
356
357 foo at (re_eval 1) line 1.
358 foo at (re_eval 2) line 1.
359
360and now gives:
361
362 foo at (eval 1) line 1.
363 foo at /some/prog line 2.
364
365=back
366
367=item *
368
7ade940c
KW
369Perl now works as well as can be expected on all releases of Unicode so
370far. In v5.16, it worked on Unicodes 6.0 and 6.1, but there were
371various bugs for earlier releases; the older the release the more
372problems.
9aa9a888 373
701da2e9
FC
374=item *
375
376C<vec> no longer produces "uninitialized" warnings in lvalue context
377[perl #9423].
378
d67d4c0e
FC
379=item *
380
d9661073 381An optimisation involving fixed strings in regular expressions could cause
d67d4c0e
FC
382a severe performance penalty in edge cases. This has been fixed
383[perl #76546].
384
b9dc63e8
FC
385=item *
386
387The "Can't find an opnumber" message that C<prototype> produces when passed
b1c9e38d 388a string like "CORE::nonexistent_keyword" now passes UTF8 and embedded
18a66a2d 389NULs through unchanged [perl #97478].
b9dc63e8 390
b6d5888c
FC
391=item *
392
c0df136d
FC
393C<prototype> now treats magical variables like C<$1> the same way as
394non-magical variables when checking for the CORE:: prefix, instead of
395treating them as subroutine names.
396
397=item *
398
b1c9e38d 399Under threaded perls, a runtime code block in a regular expression could
b6d5888c
FC
400corrupt the package name stored in the op tree, resulting in bad reads
401in C<caller>, and possibly crashes [perl #113060].
402
d8816adc
FC
403=item *
404
405Referencing a closure prototype (C<\&{$_[1]}> in an attribute handler for a
406closure) no longer results in a copy of the subroutine (or assertion
407failures on debugging builds).
408
9b9df0bb
FC
409=item *
410
411C<eval '__PACKAGE__'> now returns the right answer on threaded builds if
412the current package has been assigned over (as in
413C<*ThisPackage:: = *ThatPackage::>) [perl #78742].
414
b16ca463
FC
415=item *
416
417If a package is deleted by code that it calls, it is possible for C<caller>
418to see a stack frame belonging to that deleted package. C<caller> could
419crash if the stash's memory address was reused for a scalar and a
420substitution was performed on the same scalar [perl #113486].
421
6fe02df8
FC
422=item *
423
424C<UNIVERSAL::can> no longer treats its first argument differently
425depending on whether it is a string or number internally.
426
2aab098d
FC
427=item *
428
429C<open> with "<&" for the mode checks to see whether the third argument is
430a number, in determining whether to treat it as a file descriptor or a
431handle name. Magical variables like C<$1> were always failing the numeric
432check and being treated as handle names.
433
38d77b7f
FC
434=item *
435
436C<warn>'s handling of magical variables (C<$1>, ties) has undergone several
437fixes. FETCH is only called once now on a tied argument or a tied C<$@>
438[perl #97480]. Tied variables returning objects that stringify as "" are
439no longer ignored. A tied C<$@> that happened to return a reference the
440I<previous> time is was used is no longer ignored.
441
e811dbaa
FC
442=item *
443
8b9712e0
FC
444C<warn ""> now treats C<$@> with a number in it the same way, regardless of
445whether it happened via C<$@=3> or C<$@="3">. It used to ignore the
446former. Now it appends "\t...caught", as it has always done with
447C<$@="3">.
448
449=item *
450
e811dbaa 451Numeric operators on magical variables (e.g., S<C<$1 + 1>>) used to use
0998713f
SH
452floating point operations even where integer operations were more appropriate,
453resulting in loss of accuracy on 64-bit platforms [perl #109542].
e811dbaa 454
844115ec
FC
455=item *
456
457Unary negation no longer treats a string as a number if the string happened
b1c9e38d 458to be used as a number at some point. So, if C<$x> contains the string "dogs",
844115ec
FC
459C<-$x> returns "-dogs" even if C<$y=0+$x> has happened at some point.
460
a7143705
FC
461=item *
462
463In Perl 5.14, C<-'-10'> was fixed to return "10", not "+10". But magical
464variables (C<$1>, ties) were not fixed till now [perl #57706].
465
9c308096
FC
466=item *
467
468Unary negation now treats strings consistently, regardless of the internal
469UTF8 flag.
470
fc67deb3
KW
471=item *
472
473A regression introduced in Perl v5.16.0 involving
474C<tr/I<SEARCHLIST>/I<REPLACEMENTLIST>/> has been fixed. Only the first
475instance is supposed to be meaningful if a character appears more than
476once in C<I<SEARCHLIST>>. Under some circumstances, the final instance
477was overriding all earlier ones. [perl #113584]
478
45e0f58a
KW
479=item *
480
481Regular expressions like C<qr/\87/> previously silently inserted a NUL
482character, thus matching as if it had been written C<qr/\00087/>. Now it
b1c9e38d 483matches as if it had been written as C<qr/87/>, with a message that the
45e0f58a
KW
484sequence C<"\8"> is unrecognized.
485
e2f0c3bb
FC
486=item *
487
488C<__SUB__> now works in special blocks (BEGIN, END, etc.).
489
490=item *
491
492Thread creation on Windows could theoretically result in a crash if done
493inside a BEGIN block. It still does not work properly, but it no longer
494crashes [perl #111610].
495
dbc84d79
FC
496=item *
497
498C<\&{''}> (with the empty string) now autovivifies a stub like any other
499sub name, and no longer produces the "Unable to create sub" error
500[perl #94476].
501
61174fb5 502=back
53de3ff0 503
61174fb5 504=head1 Acknowledgements
d5dc7001 505
61174fb5 506XXX Generate this with:
f9001595 507
61174fb5 508 perl Porting/acknowledgements.pl v5.17.0..HEAD
29cf780c 509
44691e6f
AB
510=head1 Reporting Bugs
511
512If you find what you think is a bug, you might check the articles
52deee2e 513recently posted to the comp.lang.perl.misc newsgroup and the perl
f9001595
RS
514bug database at http://rt.perl.org/perlbug/ . There may also be
515information at http://www.perl.org/ , the Perl Home Page.
44691e6f
AB
516
517If you believe you have an unreported bug, please run the L<perlbug>
52deee2e
DR
518program included with your release. Be sure to trim your bug down
519to a tiny but sufficient test case. Your bug report, along with the
520output of C<perl -V>, will be sent off to perlbug@perl.org to be
521analysed by the Perl porting team.
44691e6f
AB
522
523If the bug you are reporting has security implications, which make it
f9001595
RS
524inappropriate to send to a publicly archived mailing list, then please send
525it to perl5-security-report@perl.org. This points to a closed subscription
526unarchived mailing list, which includes
527all the core committers, who will be able
528to help assess the impact of issues, figure out a resolution, and help
529co-ordinate the release of patches to mitigate or fix the problem across all
530platforms on which Perl is supported. Please only use this address for
531security issues in the Perl core, not for modules independently
532distributed on CPAN.
44691e6f
AB
533
534=head1 SEE ALSO
535
52deee2e
DR
536The F<Changes> file for an explanation of how to view exhaustive details
537on what changed.
44691e6f
AB
538
539The F<INSTALL> file for how to build Perl.
540
541The F<README> file for general stuff.
542
543The F<Artistic> and F<Copying> files for copyright information.
544
545=cut