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