This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Use F<> for files, not L<>
[perl5.git] / pod / perldelta.pod
CommitLineData
44691e6f
AB
1=encoding utf8
2
3=head1 NAME
4
8c8d6154 5perldelta - what is new for perl v5.21.5
c68523cb 6
238894db 7=head1 DESCRIPTION
c68523cb 8
8c8d6154 9This document describes differences between the 5.21.4 release and the 5.21.5
238894db 10release.
c68523cb 11
8c8d6154
SH
12If you are upgrading from an earlier release such as 5.21.3, first read
13L<perl5214delta>, which describes differences between 5.21.3 and 5.21.4.
8435afd1 14
8c8d6154 15=head1 Core Enhancements
5cfa0642 16
4cad5dc8
FC
17=head2 New double-diamond operator
18
4a573b25 19C<<< <<>> >>> is like C<< <> >> but uses three-argument C<open> to open
4cad5dc8
FC
20each file in @ARGV. So each element of @ARGV is an actual file name, and
21"|foo" won't be treated as a pipe open.
22
a5591204
FC
23=head2 Aliasing via reference
24
25Variables and subroutines can now be aliased by assigning to a reference:
26
27 \$c = \$d;
28 \&x = \&y;
29
30Or by using a backslash before a C<foreach> iterator variable, which is
31perhaps the most useful idiom this feature provides:
32
33 foreach \%hash (@array_of_hash_refs) { ... }
34
35This feature is experimental and must be enabled via C<use feature
36'refaliasing'>. It will warn unless the C<experimental::refaliasing>
37warnings category is disabled.
38
39See L<perlref/Assigning to References>.
40
b15c1b56
AF
41=head2 Perl now supports POSIX 2008 locale currency additions.
42
43On platforms that are able to handle POSIX.1-2008, the
44hash returned by
45L<C<POSIX::localeconv()>|perllocale/The localeconv function>
46includes the international currency fields added by that version of the
47POSIX standard. These are
48C<int_n_cs_precedes>,
49C<int_n_sep_by_space>,
50C<int_n_sign_posn>,
51C<int_p_cs_precedes>,
52C<int_p_sep_by_space>,
53and
54C<int_p_sign_posn>.
55
bb8c7e27
A
56=head2 Packing infinity or not-a-number into a character is now fatal.
57
58Before, when trying to pack infinity or not-a-number into a
59(signed) character, Perl would warn, and assumed you tried to
60pack C<< 0xFF >>; if you gave it as an argument to C<< chr >>,
61C<< U+FFFD >> was returned.
62
63But now, all such actions (C<< pack >>, C<< chr >>, and C<< print '%c' >>)
64result in a fatal error.
65
efc7e149 66=head2 Inf and NaN
9a88d663 67
efc7e149
A
68Many small improvements, bug fixes and added test cases for dealing
69with math related to infinity and not-a-number.
9a88d663 70
8c8d6154 71=head1 Security
5cfa0642 72
ba474e87
JH
73=head2 Perl is now compiled with -fstack-protector-strong if available
74
75Perl has been compiled with the anti-stack-smashing option
76C<-fstack-protector> since 5.10.1. Now Perl uses the newer variant
77called C<-fstack-protector-strong>, if available. (This was added
78already in 5.21.4.)
8435afd1 79
8c8d6154 80=head1 Deprecations
d0ab07ee 81
cc4d09e1
KW
82=head2 Use of multiple /x regexp modifiers
83
84It is now deprecated to say something like any of the following:
85
86 qr/foo/xx;
87 /(?xax:foo)/;
88 use re qw(/amxx);
89
90That is, now C<x> should only occur once in any string of contiguous
91regular expression pattern modifiers. We do not believe there are any
92occurrences of this in all of CPAN. This is in preparation for a future
93Perl release having C</xx> mean to allow white-space for readability in
94bracketed character classes (those enclosed in square brackets:
95C<[...]>).
8435afd1 96
8c8d6154 97=head1 Performance Enhancements
5cfa0642 98
8c8d6154 99=over 4
5cfa0642 100
8435afd1
SH
101=item *
102
1dc08634
FC
103C<length> is up to 20% faster for non-magical/non-tied scalars containing a
104string if it is a non-utf8 string or if C<use bytes;> is in scope.
5cfa0642 105
5b306eef
DD
106=item *
107
108Non-magical/non-tied scalars that contain only a floating point value and are
109on most Perl builds with 64 bit integers now use 8-32 less bytes of memory
110depending on OS.
111
357205d5
FC
112=item *
113
2b7010ba 114In C<@array = split>, the assignment can be optimized away with C<split>
357205d5 115writing directly to the array. This optimisation was happening only for
3a9cf875
FC
116package arrays other than @_ and only
117sometimes. Now this optimisation happens
357205d5
FC
118almost all the time.
119
f704f251
FC
120=item *
121
122C<join> is now subject to constant folding. Moreover, C<join> with a
123scalar or constant for the separator and a single-item list to join is
124simplified to a stringification. The separator doesn't even get evaluated.
125
0cb3abac
FC
126=item *
127
128C<qq(@array)> is implemented using two ops: a stringify op and a join op.
129If the qq contains nothing but a single array, the stringification is
2b7010ba 130optimized away.
0cb3abac 131
deec1830
FC
132=item *
133
134C<our $var> and C<our($s,@a,%h)> in void context are no longer evaluated at
135run time. Even a whole sequence of C<our $foo;> statements will simply be
48795693 136skipped over. The same applies to C<state> variables.
deec1830 137
8c8d6154 138=back
d0ab07ee 139
8c8d6154 140=head1 Modules and Pragmata
d0ab07ee 141
8c8d6154 142=head2 Updated Modules and Pragmata
d99849ae 143
39c4a6cf 144=over 4
d99849ae 145
ff433f2d
PM
146=item *
147
6fa0b0fd
TC
148L<attributes> has been upgraded from version 0.23 to 0.24.
149
150Avoid reading beyond the end of a buffer. [perl #122629]
151
152=item *
153
8883ce71
FC
154L<B::Concise> has been upgraded from version 0.993 to 0.994.
155
156Null ops that are part of the execution chain are now given sequence
157numbers.
158
159Private flags for nulled ops are now dumped with mnemonics as they would be
160for the non-nulled counterparts.
161
432450d2
FC
162L<B::Deparse> has been upgraded from version 1.28 to 1.29.
163
164Parenthesised arrays in lists passed to C<\> are now correctly deparsed
165with parentheses (e.g., C<\(@a, (@b), @c)> now retains the parentheses
166around @b), this preserving the flattening behaviour of referenced
167parenthesised arrays. Formerly, it only worked for one array: C<\(@a)>.
168
4e3e9c07
FC
169C<local our> is now deparsed correctly, with the C<our> included.
170
4a9fafe5
FC
171C<for($foo; !$bar; $baz) {...}> was deparsed without the C<!> (or C<not>).
172This has been fixed.
173
f03d0d50
FC
174Core keywords that conflict with lexical subroutines are now deparsed with
175the C<CORE::> prefix.
176
c3f18a8f
FC
177C<foreach state $x (...) {...}> now deparses correctly with C<state> and
178not C<my>.
179
852ef7e9 180C<our @array = split(...)> now deparses correctly with C<our> in those
2b7010ba 181cases where the assignment is optimized away.
852ef7e9 182
432450d2
FC
183=item *
184
cbfcbc14
TC
185L<DynaLoader> has been upgraded from version 1.26 to 1.27.
186
187Remove dl_nonlazy global if unused in Dynaloader. [perl #122926]
188
189=item *
190
7635ad4d
TC
191L<Fcntl> has been upgraded from version 1.12 to 1.13.
192
193Add support for the Linux pipe buffer size fcntl() commands.
194
195=item *
196
f4eedc6b
DD
197L<File::Find> has been upgraded from version 1.28 to 1.29.
198
199Slightly faster module loading time.
200
201=item *
202
84d03adf
SH
203L<Module::CoreList> has been upgraded from version 5.20140920 to 5.20141020.
204
205Updated to cover the latest releases of Perl.
ff433f2d 206
4cd408ba
TC
207=item *
208
f4eedc6b
DD
209The PathTools module collection has been upgraded from version 3.50 to 3.51.
210
211Slightly faster module loading time.
212
213=item *
214
0561e60b
TC
215L<POSIX> has been upgraded from version 1.44 to 1.45.
216
217POSIX::tmpnam() now produces a deprecation warning. [perl #122005]
218
219=item *
220
4cd408ba
TC
221L<XSLoader> has been upgraded from version 0.17 to 0.18.
222
223Allow XSLoader to load modules from a different namespace.
224[perl #122455]
225
40a81b59
JK
226=item *
227
228L<perlfaq> has been upgraded from version 5.0150045 to version 5.0150046.
229[perl #123008]
230
13900f93 231=back
aac7f82f 232
8c8d6154 233=head1 Documentation
2a395b86 234
8c8d6154 235=head2 Changes to Existing Documentation
8435afd1 236
39b0154e 237=head3 L<perlrecharclass>
8435afd1
SH
238
239=over 4
2a395b86 240
12d22d1f
JK
241=item *
242
09e43397
KW
243Clarifications have been added to L<perlrecharclass/Character Ranges>
244to the effect that Perl guarantees that C<[A-Z]>, C<[a-z]>, C<[0-9]> and
245any subranges thereof in regular expression bracketed character classes
246are guaranteed to match exactly what a naive English speaker would
247expect them to match, even on platforms (such as EBCDIC) where special
248handling is required to accomplish this.
12d22d1f 249
2a395b86
PM
250=back
251
39c4a6cf 252=head1 Diagnostics
2a395b86 253
39c4a6cf
PM
254The following additions or changes have been made to diagnostic output,
255including warnings and fatal error messages. For the complete list of
256diagnostic messages, see L<perldiag>.
2a395b86 257
8c8d6154 258=head2 New Diagnostics
2a395b86 259
8c8d6154 260=head3 New Errors
5cfa0642 261
8c8d6154 262=over 4
2a395b86
PM
263
264=item *
265
86f048f1 266L<Cannot chr %f|perldiag/"Cannot chr %f">
bb8c7e27
A
267
268=item *
269
86f048f1 270L<Cannot compress %f in pack|perldiag/"Cannot compress %f in pack">
bb8c7e27
A
271
272=item *
273
86f048f1 274L<Cannot pack %f with '%c'|perldiag/"Cannot pack %f with '%c'">
bb8c7e27
A
275
276=item *
277
86f048f1 278L<Cannot print %f with '%c'|perldiag/"Cannot printf %f with '%c'">
2a395b86
PM
279
280=back
6d9b7c7c 281
8c8d6154 282=head2 Changes to Existing Diagnostics
363d3025 283
8c8d6154 284=over 4
334464b3
FC
285
286=item *
287
dbe3c929
FC
288'"my" variable &foo::bar can't be in a package' has been reworded to say
289'subroutine' instead of 'variable'.
ef5a9509 290
363d3025
FC
291=back
292
8c8d6154 293=head1 Testing
d72cd2eb 294
0346c3a9 295=over 4
375f5f06 296
2884baee
MH
297=item *
298
bb8c7e27
A
299Some regular expression tests are written in such a way that they will
300run very slowly if certain optimizations break. These tests have been
301moved into new files, F<< t/re/speed.t >> and F<< t/re/speed_thr.t >>,
302and are run with a C<< watchdog() >>.
6f1a844b 303
8c8d6154 304=back
549ea8d4 305
8c8d6154 306=head1 Platform Support
549ea8d4 307
b08dfed6
A
308=head2 Regained Platforms
309
310IRIX and Tru64 platforms are working again.
311(Some C<make test> failures remain.)
312
8c8d6154 313=head2 Platform-Specific Notes
aa292ef2 314
8c8d6154 315=over 4
739e9bee 316
09e43397 317=item EBCDIC
739e9bee 318
09e43397
KW
319Special handling is required on EBCDIC platforms to get C<qr/[i-j]/> to
320match only C<"i"> and C<"j">, since there are 7 characters between the
321code points for C<"i"> and C<"j">. This special handling had only been
322invoked when both ends of the range are literals. Now it is also
323invoked if any of the C<\N{...}> forms for specifying a character by
324name or Unicode code point is used instead of a literal. See
325L<perlrecharclass/Character Ranges>.
b23b2fdb 326
8c8d6154 327=back
b23b2fdb 328
8c8d6154 329=head1 Internal Changes
7d15b1a8 330
8c8d6154 331=over 4
bbca64cf 332
0064f8cc
KW
333=item *
334
13203cef
FC
335SVs of type SVt_NV are now bodyless when a build configure and platform allow
336it, specifically C<sizeof(NV) <= sizeof(IV)>. The bodyless trick is the same one
2b7010ba 337as for IVs since 5.9.2, but for NVs, unlike IVs, is not guaranteed on all
13203cef 338platforms and build configurations.
6ff8f256 339
1b4c7150
TC
340=item *
341
342The C<$DB::single>, C<$DB::signal> and C<$DB::trace> now have set and
343get magic that stores their values as IVs and those IVs are used when
344testing their values in C<pp_dbstate>. This prevents perl from
345recursing infinity if an overloaded object is assigned to any of those
346variables. [perl #122445]
347
a953aca5
DD
348=item *
349
350C<Perl_tmps_grow> which is marked as public API but undocumented has been
351removed from public API. If you use C<EXTEND_MORTAL> macro in your XS code to
352preextend the mortal stack, you are unaffected by this change.
353
8405c65d
FC
354=item *
355
356C<cv_name>, which was introduced in 5.21.4, has been changed incompatibly.
357It now has a flags field that allows the caller to specify whether the name
358should be fully qualified. See L<perlapi/cv_name>.
359
8e2708f3
FC
360=item *
361
362Internally Perl no longer uses the C<SVs_PADMY> flag. C<SvPADMY()> now
363returns a true value for anything not marked PADTMP. C<SVs_PADMY> is now
364defined as 0.
365
bb8c7e27
A
366=item *
367
368The macros SETsv and SETsvUN have been removed. They were no longer used
369in the core since commit 6f1401dc2a, and have not been found present on
370CPAN.
371
372=item *
373
374The C<< SvFAKE >> bit (unused on HVs) got informally reserved by
375David Mitchell for future work on vtables.
376
d712afe5 377=item *
eb0e9c93 378
28482d6c
FC
379The C<sv_catpvn_flags> function accepts C<SV_CATBYTES> and C<SV_CATUTF8>
380flags, which specify whether the appended string is bytes or utf8,
381respectively.
382
28a42920
A
383=item *
384
385A new opcode class, C<< METHOP >> has been introduced, which holds
386class/method related info needed at runtime to improve performance
387of class/object method calls.
388
389C<< OP_METHOD >> and C<< OP_METHOD_NAMED >> are moved from being
390C<< UNOP/SVOP >> to being C<< METHOD >>.
391
8c8d6154 392=back
6ff8f256 393
8c8d6154 394=head1 Selected Bug Fixes
80cc3290 395
8c8d6154 396=over 4
13dd5671 397
bdab7676
FC
398=item *
399
227d08c8 400Locking and unlocking values via L<Hash::Util> or C<Internals::SvREADONLY>
3ec9b05a
KW
401no longer has any effect on values that are read-only to begin.
402Previously, unlocking such values could result in crashes, hangs or
403other erratic behaviour.
bdab7676 404
94959c63
FC
405=item *
406
407The internal C<looks_like_number> function (which L<Scalar::Util> provides
408access to) began erroneously to return true for "-e1" in 5.21.4, affecting
409also C<-'-e1'>. This has been fixed.
410
24d3d8cd
FC
411=item *
412
413The flip-flop operator (C<..> in scalar context) would return the same
b9de5fa2 414scalar each time, unless the containing subroutine was called recursively.
24d3d8cd
FC
415Now it always returns a new scalar. [perl #122829]
416
02dde543
FC
417=item *
418
419Some unterminated C<(?(...)...)> constructs in regular expressions would
420either crash or give erroneous error messages. C</(?(1)/> is one such
421example.
422
5058ae74
FC
423=item *
424
425C<pack "w", $tied> no longer calls FETCH twice.
426
14937635
FC
427=item *
428
429List assignments like C<($x, $z) = (1, $y)> now work correctly if $x and $y
430have been aliased by C<foreach>.
431
325f4225
FC
432=item *
433
434Some patterns including code blocks with syntax errors, such as
435C</ (?{(^{})/>, would hang or fail assertions on debugging builds. Now
436they produce errors.
437
c1662923
FC
438=item *
439
440An assertion failure when parsing C<sort> with debugging enabled has been
441fixed. [perl #122771]
442
7646b3d5
FC
443=item *
444
445C<*a = *b; @a = split //, $b[1]> could do a bad read and produce junk
446results.
447
db98db4e
FC
448=item *
449
450In C<() = @array = split>, the C<() => at the beginning no longer confuses
2b7010ba 451the optimizer, making it assume a limit of 1.
db98db4e 452
8818afe8
TC
453=item *
454
455Fatal warnings no longer prevent the output of syntax errors.
456[perl #122966]
457
bb8c7e27
A
458=item *
459
460Fixed a NaN double to long double conversion error on VMS. For quiet NaNs
461(and only on Itanium, not Alpha) negative infinity instead of NaN was
462produced.
463
464=item *
465
466Fixed the issue that caused C<< make distclean >> to leave files behind
467that shouldn't. [perl #122820]
468
469=item *
470
471AIX now sets the length in C<< getsockopt >> correctly. [perl #120835],
472[rt #91183], [rt #85570].
473
74f9f9ed
A
474=item *
475
476During the pattern optimization phase, we no longer recurse into
477GOSUB/GOSTART when not SCF_DO_SUBSTR. This prevents the optimizer
478to run "forever" and exhaust all memory. [perl #122283]
479
28a42920
A
480=item *
481
482F<< t/op/crypt.t >> now performs SHA-256 algorithm if the default one
483is disabled. [perl #121591]
484
485=item *
486
487Fixed an off-by-one error when setting the size of shared array.
488[perl #122950]
489
490=item *
491
2b7010ba 492Fixed a bug that could cause perl to execute an infinite loop during
28a42920
A
493compilation. [perl #122995]
494
8c8d6154 495=back
3a085d00 496
8c8d6154 497=head1 Acknowledgements
c0c55a9b 498
8c8d6154 499XXX Generate this with:
e831f11a 500
8c8d6154 501 perl Porting/acknowledgements.pl v5.21.4..HEAD
f5b73711 502
44691e6f
AB
503=head1 Reporting Bugs
504
e08634c5
SH
505If you find what you think is a bug, you might check the articles recently
506posted to the comp.lang.perl.misc newsgroup and the perl bug database at
238894db 507https://rt.perl.org/ . There may also be information at
7ef8b31d 508http://www.perl.org/ , the Perl Home Page.
44691e6f 509
e08634c5
SH
510If you believe you have an unreported bug, please run the L<perlbug> program
511included with your release. Be sure to trim your bug down to a tiny but
512sufficient test case. Your bug report, along with the output of C<perl -V>,
513will be sent off to perlbug@perl.org to be analysed by the Perl porting team.
44691e6f
AB
514
515If the bug you are reporting has security implications, which make it
e08634c5
SH
516inappropriate to send to a publicly archived mailing list, then please send it
517to perl5-security-report@perl.org. This points to a closed subscription
518unarchived mailing list, which includes all the core committers, who will be
519able to help assess the impact of issues, figure out a resolution, and help
f9001595 520co-ordinate the release of patches to mitigate or fix the problem across all
e08634c5
SH
521platforms on which Perl is supported. Please only use this address for
522security issues in the Perl core, not for modules independently distributed on
523CPAN.
44691e6f
AB
524
525=head1 SEE ALSO
526
e08634c5
SH
527The F<Changes> file for an explanation of how to view exhaustive details on
528what changed.
44691e6f
AB
529
530The F<INSTALL> file for how to build Perl.
531
532The F<README> file for general stuff.
533
534The F<Artistic> and F<Copying> files for copyright information.
535
536=cut