This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Module::CoreList for 5.21.8
[perl5.git] / pod / perldelta.pod
CommitLineData
44691e6f
AB
1=encoding utf8
2
3=head1 NAME
4
b5d4d3b9 5perldelta - what is new for perl v5.21.8
c68523cb 6
238894db 7=head1 DESCRIPTION
c68523cb 8
b5d4d3b9 9This document describes differences between the 5.21.7 release and the 5.21.8
238894db 10release.
c68523cb 11
b5d4d3b9
MM
12If you are upgrading from an earlier release such as 5.21.6, first read
13L<perl5217delta>, which describes differences between 5.21.6 and 5.21.7.
2ec11c70 14
b5d4d3b9 15=head1 Notice
2ec11c70 16
8792e55d
MH
17With this release we are now in the contentious changes portion of the code
18freeze as we prepare for the next stable release of Perl 5.
67f2cc75 19
b5d4d3b9 20=head1 Core Enhancements
67f2cc75 21
ea5519d6
AB
22=head2 The warnings pragma now supports warnings outside of "all"
23
24Ever since perl v5.6.0 we've had no way of adding new warnings without
25retroactively adding them to all existing programs that used C<-w>,
26C<-W> or C<use warnings>.
27
28This caused us to not add new useful warnings out of fear that they
29might unduly burden users who just wanted to upgrade perl and didn't
30want to deal with a bunch of warnings from their existing code.
31
32We now support a way to have our cake and eat it too, and can add new
33warnings to the core going forward through other top-level warning
34categories. See L<the warnings documentation|warnings/Top-level
35warning categories & associated confusion> for details.
36
25941dca
MH
37=head2 Non-Capturing Regular Expression Flag
38
39Regular expressions now support a C</n> flag that disables capturing
40and filling in C<$1>, C<$2>, etc... inside of groups:
41
42 "hello" =~ /(hi|hello)/n; # $1 is not set
43
44This is equivalent to putting C<?:> at the beginning of every capturing group.
45
46See L<perlre/"n"> for more information.
47
ea13b07e
FC
48=head2 C<prototype> with no arguments
49
50C<prototype()> with no arguments now infers C<$_>. [perl #123514]
51
67cdf558
KW
52=head2 C<use re 'strict'>
53
54This applies stricter syntax rules to regular expression patterns
55compiled within its scope, which hopefully will alert you to typos and
56other unintentional behavior that backwards-compatibility issues prevent
57us from doing in normal regular expression compilations. Because the
58behavior of this is subject to change in future Perl releases as we gain
59experience, using this pragma will raise a category
60C<experimental:re_strict> warning.
61See L<'strict' in re|re/'strict' mode>.
62
48c4d243
FC
63=head2 New "const" subroutine attribute
64
65The "const" attribute can be applied to an anonymous subroutine. It causes
66it to be executed immediately when it is cloned. Its value is captured and
67used to create a new constant subroutine that is returned. This feature is
68experimental. See L<perlsub/Constant Functions>.
69
b5d4d3b9 70=head1 Incompatible Changes
ef8784b7 71
e46968af
PM
72=head2 sub signatures moved before attributes
73
74The experimental sub signatures feature, as introduced in 5.20, parsed
75signatures after attributes. In this release, the positioning has been
76moved such that signatures occur in exactly the same positioning a
77prototype would be found.
78
b5d4d3b9 79=head1 Modules and Pragmata
d6c13051 80
b5d4d3b9
MM
81XXX All changes to installed files in F<cpan/>, F<dist/>, F<ext/> and F<lib/>
82go here. If Module::CoreList is updated, generate an initial draft of the
83following sections using F<Porting/corelist-perldelta.pl>. A paragraph summary
84for important changes should then be added by hand. In an ideal world,
85dual-life modules would have a F<Changes> file that could be cribbed.
02a0bddf 86
b5d4d3b9 87[ Within each section, list entries as a =item entry ]
128f4e12 88
b5d4d3b9 89=head2 New Modules and Pragmata
cd3802ac 90
b5d4d3b9 91=over 4
60dde9d3
MM
92
93=item *
94
b5d4d3b9 95XXX
3aba4f3d 96
b5d4d3b9 97=back
af292847 98
b5d4d3b9 99=head2 Updated Modules and Pragmata
190f5bb6 100
b5d4d3b9 101=over 4
b045b8b5
TC
102
103=item *
104
b5d4d3b9 105L<XXX> has been upgraded from version A.xx to B.yy.
190f5bb6 106
a462fa00
DD
107=item *
108
595f54ae
SH
109L<attributes> has been upgraded from version 0.24 to 0.25.
110
111Minor internal change only.
112
113=item *
114
a462fa00
DD
115L<B> has been upgraded from version 1.54 to 1.55.
116
117A bug where, after an ithread creation or psuedofork, special/immortal SVs in
118the child ithread/psuedoprocess did not have the correct class of
119C<B::SPECIAL>, has been fixed.
120
5d42e1d7
FC
121The C<id> and C<outid> PADLIST methods have been added.
122
d2fff9f6
FC
123=item *
124
3d37dc2e
FC
125L<B::Deparse> has been upgraded from version 1.31 to 1.32.
126
127Deparsing C<BEGIN { undef &foo }> with the B<-w> switch enabled started to
128emit 'uninitialized' warnings in Perl 5.14. This has been fixed.
129
bba618d2
FC
130Deparsing calls to subs with a C<(;+)> prototype resulted in an infinite
131loop. The C<(;$>) C<(_)> and C<(;_)> prototypes were given the wrong
132precedence, causing C<foo($a<$b)> to be deparsed without the parentheses.
133
3d37dc2e
FC
134=item *
135
c196824d
TC
136L<File::Glob> has been upgraded from version 1.23 to 1.24.
137
138Avoid SvIV() expanding to call get_sv() three times in a few
139places. [perl #123606]
140
141=item *
142
d676fe86
JK
143L<Module::Metadata> has been upgraded from version 1.000025 to 1.000026.
144
145=item *
146
d2fff9f6
FC
147L<Safe> has been upgraded from version 2.38 to 2.39.
148
149C<reval> was not propagating void context properly.
150
e329daf3
TC
151=item *
152
153L<SDBM_File> has been upgraded from version 1.12 to 1.13.
154
155Simplified the build process. [perl #123413]
156
b5d4d3b9 157=back
ba31029d 158
b5d4d3b9 159=head2 Removed Modules and Pragmata
b045b8b5 160
b5d4d3b9 161=over 4
aa67537d 162
4c7a0d98
DD
163=item *
164
b5d4d3b9 165XXX
4c7a0d98 166
b5d4d3b9 167=back
4c7a0d98 168
b5d4d3b9 169=head1 Documentation
f4eedc6b 170
b5d4d3b9 171=head2 New Documentation
6ed80d55 172
9ce6583e 173=head3 L<perlunicook>
f348c3d8 174
9ce6583e
MH
175This document, by Tom Christiansen, provides examples of handling Unicode in
176Perl.
f348c3d8 177
9ce6583e 178=head1 Diagnostics
f348c3d8 179
9ce6583e
MH
180The following additions or changes have been made to diagnostic output,
181including warnings and fatal error messages. For the complete list of
182diagnostic messages, see L<perldiag>.
f348c3d8 183
9ce6583e 184=head2 New Diagnostics
f348c3d8 185
9ce6583e 186=head3 New Errors
f348c3d8 187
b5d4d3b9 188=over 4
6ed80d55 189
60dde9d3 190=item *
f348c3d8 191
9ce6583e
MH
192L<Bad symbol for scalar|perldiag/"Bad symbol for scalar">
193
194(P) An internal request asked to add a scalar entry to something that
195wasn't a symbol table entry.
196
197=item *
198
199L<:const is not permitted on named subroutines|perldiag/":const is not permitted on named subroutines">
200
201(F) The "const" attribute causes an anonymous subroutine to be run and
202its value captured at the time that it is cloned. Names subroutines are
203not cloned like this, so the attribute does not make sense on them.
4dc623f0 204
b5d4d3b9 205=back
84d03adf 206
9ce6583e 207=head3 New Warnings
ff433f2d 208
9ce6583e 209=over 4
4cd408ba 210
9ce6583e 211=item *
6ed80d55 212
9ce6583e 213L<:const is experimental|perldiag/":const is experimental">
6ed80d55 214
9ce6583e
MH
215(S experimental::const_attr) The "const" attribute is experimental.
216If you want to use the feature, disable the warning with C<no warnings
217'experimental::const_attr'>, but know that in doing so you are taking
218the risk that your code may break in a future Perl version.
6ed80d55 219
9ce6583e 220=item *
f348c3d8 221
9ce6583e
MH
222L<Non-finite repeat count does nothing|perldiag/"Non-finite repeat count does nothing">
223
224(W numeric) You tried to execute the
225L<C<x>|perlop/Multiplicative Operators> repetition operator C<Inf> (or
226C<-Inf>) or C<NaN> times, which doesn't make sense.
ab0b796c 227
60dde9d3 228=item *
8c6180a9 229
c0e46395 230L<Useless use of attribute "const"|perldiag/Useless use of attribute "const">
8c6180a9 231
9ce6583e
MH
232(W misc) The "const" attribute has no effect except
233on anonymous closure prototypes. You applied it to
234a subroutine via L<attributes.pm|attributes>. This is only useful
235inside an attribute handler for an anonymous subroutine.
0561e60b 236
9ce6583e 237=item *
dd200dff 238
9ce6583e
MH
239L<Unusual use of %s in void context|perldiag/"Unusual use of %s in void context">
240
241(W void_unusual) Similar to the "Useless use of %s in void context"
242warning, but only turned on by the top-level "pedantic" warning
243category, used for e.g. C<grep> in void context, which may indicate a
244bug, but could also just be someone using C<grep> for its side-effects
245as a loop.
246
247Enabled as part of "extra" warnings, not in the "all" category. See
248L<warnings> for details
dd200dff 249
73e793fc
FC
250=item *
251
c0e46395 252L<E<quot>use re 'strict'E<quot> is experimental|perldiag/"use re 'strict'" is experimental>
9ce6583e
MH
253
254(S experimental::re_strict) The things that are different when a regular
255expression pattern is compiled under C<'strict'> are subject to change
256in future Perl releases in incompatible ways. This means that a pattern
257that compiles today may not in a future Perl release. This warning is
258to alert you to that risk.
73e793fc 259
613abc6d
KW
260L<Wide character (U+%X) in %s|perldiag/"Wide character (U+%X) in %s">
261
9ce6583e
MH
262(W locale) While in a single-byte locale (I<i.e.>, a non-UTF-8
263one), a multi-byte character was encountered. Perl considers this
264character to be the specified Unicode code point. Combining non-UTF8
265locales and Unicode is dangerous. Almost certainly some characters
266will have two different representations. For example, in the ISO 8859-7
267(Greek) locale, the code point 0xC3 represents a Capital Gamma. But so
268also does 0x393. This will make string comparisons unreliable.
269
270You likely need to figure out how this multi-byte character got mixed up
271with your single-byte locale (or perhaps you thought you had a UTF-8
272locale, but Perl disagrees).
273
b927b7e9
KW
274=item *
275
276L<Both or neither range ends should be Unicode in regex; marked by E<lt>-- HERE in mE<sol>%sE<sol>|perldiag/"Both or neither range ends should be Unicode in regex; marked by <-- HERE in m/%s/">
277
db5cc9f9
MH
278(W regexp) (only under C<S<use re 'strict'>> or within C<(?[...])>)
279
280In a bracketed character class in a regular expression pattern, you
281had a range which has exactly one end of it specified using C<\N{}>, and
282the other end is specified using a non-portable mechanism. Perl treats
283the range as a Unicode range, that is, all the characters in it are
284considered to be the Unicode characters, and which may be different code
285points on some platforms Perl runs on. For example, C<[\N{U+06}-\x08]>
286is treated as if you had instead said C<[\N{U+06}-\N{U+08}]>, that is it
287matches the characters whose code points in Unicode are 6, 7, and 8.
288But that C<\x08> might indicate that you meant something different, so
289the warning gets raised.
290
c877af1b
KW
291=item *
292
293L<Ranges of ASCII printables should be some subset of "0-9", "A-Z", or "a-z" in regex; marked by <-- HERE in mE<sol>%sE<sol>|perldiag/"Ranges of ASCII printables should be some subset of "0-9", "A-Z", or "a-z" in regex; marked by <-- HERE in mE<sol>%sE<sol>">
294
db5cc9f9
MH
295(W regexp) (only under C<S<use re 'strict'>> or within C<(?[...])>)
296
297Stricter rules help to find typos and other errors. Perhaps you didn't
298even intend a range here, if the C<"-"> was meant to be some other
299character, or should have been escaped (like C<"\-">). If you did
300intend a range, the one that was used is not portable between ASCII and
301EBCDIC platforms, and doesn't have an obvious meaning to a casual
302reader.
303
304 [3-7] # OK; Obvious and portable
305 [d-g] # OK; Obvious and portable
306 [A-Y] # OK; Obvious and portable
307 [A-z] # WRONG; Not portable; not clear what is meant
308 [a-Z] # WRONG; Not portable; not clear what is meant
309 [%-.] # WRONG; Not portable; not clear what is meant
310 [\x41-Z] # WRONG; Not portable; not obvious to non-geek
311
312(You can force portablity by specifying a Unicode range, which means that
313the endpoints are specified by
314L<C<\N{...}>|perlrecharclass/Character Ranges>, but the meaning may
315still not be obvious.)
316The stricter rules require that ranges that start or stop with an ASCII
317character that is not a control have all their endpoints be the literal
318character, and not some escape sequence (like C<"\x41">), and the ranges
319must be all digits, or all uppercase letters, or all lowercase letters.
320
c877af1b
KW
321=item *
322
323L<Ranges of digits should be from the same group in regex; marked by <-- HERE in mE<sol>%sE<sol>|perldiag/"Ranges of digits should be from the same group in regex; marked by <-- HERE in m/%s/">
324
db5cc9f9
MH
325(W regexp) (only under C<S<use re 'strict'>> or within C<(?[...])>)
326
327Stricter rules help to find typos and other errors. You included a
328range, and at least one of the end points is a decimal digit. Under the
329stricter rules, when this happens, both end points should be digits in
330the same group of 10 consecutive digits.
331
acdfc3b6
KW
332=item *
333
334L<"%s" is more clearly written simply as "%s" in regex; marked by <-- HERE in mE<sol>%sE<sol>|perldiag/"%s" is more clearly written simply as "%s" in regex; marked by <-- HERE in mE<sol>%sE<sol>>
335
db5cc9f9
MH
336(W regexp) (only under C<S<use re 'strict'>> or within C<(?[...])>)
337
338You specified a character that has the given plainer way of writing it,
339and which is also portable to platforms running with different character
340sets.
341
b5d4d3b9 342=back
8c6180a9 343
b5d4d3b9 344=head2 Changes to Existing Diagnostics
0561e60b 345
b5d4d3b9 346=over 4
4cd408ba 347
1861205d
FC
348=item *
349
780fcc9f
KW
350The message
351L<Locale '%s' may not work well.%s|perldiag/"Locale '%s' may not work well.%s">
352is no longer raised unless the problemtatic locale is actually used in
353the Perl program. Previously it was raised if it merely was the
354underlying locale. All Perl programs have an underlying locale at all
355times, but something like a C<S<use locale>> is needed for that locale
356to actually have some effect. This message will not be raised when
357the underlying locale is hidden.
358
b5d4d3b9 359=back
40a81b59 360
b5d4d3b9 361=head1 Configuration and Compilation
bb8c7e27 362
b5d4d3b9 363=over 4
83b69bfd
DD
364
365=item *
366
9ce6583e
MH
367pthreads and lcl will be linked by default if present. This allows XS modules
368that require threading to work on non-threaded perls. Note that you must still
369pass C<-Dusethreads> if you want a threaded perl.
13adb056 370
b5d4d3b9 371=back
391823f2 372
b5d4d3b9 373=head1 Testing
6ff8f256 374
b5d4d3b9 375=over 4
db98db4e 376
8818afe8
TC
377=item *
378
9ce6583e
MH
379A new test script, F<bigmem/subst.t>, has been added to test memory usage of
380subst on very large strings.
8af808bf 381
9ce6583e 382=item *
8af808bf 383
9ce6583e
MH
384A new test script, F<op/anonconst.t>, has been added to test experimental
385:const subroutines.
fdcaecb7 386
9ce6583e 387=item *
fdcaecb7 388
9ce6583e
MH
389A new test script, F<re/reg_nocapture.t>, has been added to test the new
390C</n> regexp flag.
2af7c6b6 391
4dc623f0 392=back
2af7c6b6 393
9ce6583e 394=head1 Platform Support
9e26817d 395
4dc623f0 396=head2 Platform-Specific Notes
70cee83f 397
b5d4d3b9 398=over 4
e5fbfbc1 399
b4045391 400=item Win32
e5fbfbc1 401
b4045391
DD
402=over 4
403
404=item *
405
406Previously, on Visual C++ for Win64 built Perls only, when compiling every Perl
407XS module (including CPAN ones) and Perl aware .c file with a 64 bit Visual C++,
408would uncondtionally have around a dozen warnings from hv_func.h. These
409warnings have been silenced. GCC all bitness and Visual C++ for Win32 were
410not affected.
411
8c847e66
SH
412=item *
413
414Support for building without PerlIO has been removed from the Windows
415makefiles. Non-PerlIO builds were all but deprecated in Perl 5.18.0 and are
416already not supported by F<Configure> on POSIX systems.
417
d345f487
DD
418=item *
419
420Between 2 and 6 ms and 7 I/O calls have been saved per attempt to open a perl
421module for each path in C<@INC>.
422
b4045391 423=back
353075a0 424
4dc623f0 425=back
353075a0 426
4dc623f0 427=head1 Internal Changes
9f122eef 428
b5d4d3b9 429=over 4
2ec11c70
DM
430
431=item *
432
2683609f
YO
433Added Perl_sv_get_backrefs() to determine if an SV is a weak-referent.
434
435Function either returns an SV * of type AV, which contains the set of
436weakreferences which reference the passed in SV, or a simple RV * which
437is the only weakref to this item.
438
4dc623f0 439=back
c7f058f0 440
4dc623f0 441=head1 Selected Bug Fixes
0ef4323a 442
b5d4d3b9 443=over 4
00ba25b8 444
567291b6
FC
445=item *
446
1a4efbb7
KW
447A bug in regular expression patterns that could lead to segfaults and
448other crashes has been fixed. This occurred only in patterns compiled
449with C<"/i">, while taking into account the current POSIX locale (this usually
450means they have to be compiled within the scope of C<S<"use locale">>),
451and there must be a string of at least 128 consecutive bytes to match.
6471c6b0 452[perl #123539]
fcfb7b86 453
c7fdd20b
FC
454=item *
455
456C<s///> now works on very long strings instead of dying with 'Substitution
457loop'. [perl #103260] [perl #123071]
458
436f6503
FC
459=item *
460
461C<gmtime> no longer crashes with not-a-number values. [perl #123495]
462
f44e0270
FC
463=item *
464
8bfe3865
FC
465C<\()> (reference to an empty list) and C<y///> with lexical $_ in scope
466could do a bad write past the end of the stack. They have been fixed
f44e0270
FC
467to extend the stack first.
468
ea13b07e
FC
469=item *
470
471C<prototype()> with no arguments used to read the previous item on the
472stack, so C<print "foo", prototype()> would print foo's prototype. It has
473been fixed to infer $_ instead. [perl #123514]
474
b65adbec
FC
475=item *
476
477Some cases of lexical state subs inside predeclared subs could crash but no
478longer do.
479
370c71c5
FC
480=item *
481
b94c7836
FC
482Some cases of nested lexical state subs inside anonymous subs could cause
483'Bizarre copy' errors or possibly even crash.
484
485=item *
486
370c71c5
FC
487When trying to emit warnings, perl's default debugger (F<perl5db.pl>) was
488sometimes giving 'Undefined subroutine &DB::db_warn called' instead. This
489bug, which started to occur in Perl 5.18, has been fixed. [perl #123553]
490
439f6100
FC
491=item *
492
493Certain syntax errors in substitutions, such as C<< s/${<>{})// >>, would
494crash, and had done so since Perl 5.10. (In some cases the crash did not
495start happening till 5.16.) The crash has, of course, been fixed.
496[perl #123542]
497
e3e8f263
TC
498=item *
499
500A repeat expression like C<33 x ~3> could cause a large buffer
501overflow since the new output buffer size was not correctly handled by
502SvGROW(). An expression like this now properly produces a memory wrap
503panic. [perl 123554]
504
cb6cc22b
TC
505=item *
506
f63bc603 507C<< formline("@...", "a"); >> would crash. The C<FF_CHECKNL> case in
cb6cc22b
TC
508pp_formline() didn't set the pointer used to mark the chop position,
509which led to the C<FF_MORE> case crashing with a segmentation fault.
510This has been fixed. [perl #123538]
511
b5d4d3b9 512=back
fcfb7b86 513
b5d4d3b9 514=head1 Acknowledgements
01d42a22 515
b5d4d3b9 516XXX Generate this with:
01d42a22 517
b5d4d3b9 518 perl Porting/acknowledgements.pl v5.21.7..HEAD
f5b73711 519
44691e6f
AB
520=head1 Reporting Bugs
521
e08634c5
SH
522If you find what you think is a bug, you might check the articles recently
523posted to the comp.lang.perl.misc newsgroup and the perl bug database at
238894db 524https://rt.perl.org/ . There may also be information at
7ef8b31d 525http://www.perl.org/ , the Perl Home Page.
44691e6f 526
e08634c5
SH
527If you believe you have an unreported bug, please run the L<perlbug> program
528included with your release. Be sure to trim your bug down to a tiny but
529sufficient test case. Your bug report, along with the output of C<perl -V>,
530will be sent off to perlbug@perl.org to be analysed by the Perl porting team.
44691e6f
AB
531
532If the bug you are reporting has security implications, which make it
e08634c5
SH
533inappropriate to send to a publicly archived mailing list, then please send it
534to perl5-security-report@perl.org. This points to a closed subscription
535unarchived mailing list, which includes all the core committers, who will be
536able to help assess the impact of issues, figure out a resolution, and help
f9001595 537co-ordinate the release of patches to mitigate or fix the problem across all
e08634c5
SH
538platforms on which Perl is supported. Please only use this address for
539security issues in the Perl core, not for modules independently distributed on
540CPAN.
44691e6f
AB
541
542=head1 SEE ALSO
543
e08634c5
SH
544The F<Changes> file for an explanation of how to view exhaustive details on
545what changed.
44691e6f
AB
546
547The F<INSTALL> file for how to build Perl.
548
549The F<README> file for general stuff.
550
551The F<Artistic> and F<Copying> files for copyright information.
552
553=cut