This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldelata: consolate PERL_OP_PARENT stuff
[perl5.git] / pod / perldelta.pod
CommitLineData
44691e6f
AB
1=encoding utf8
2
3=head1 NAME
4
eabfc7bc 5perldelta - what is new for perl v5.22.0
c68523cb 6
238894db 7=head1 DESCRIPTION
c68523cb 8
eabfc7bc 9This document describes differences between the 5.22.0 release and the 5.20.0
238894db 10release.
c68523cb 11
eabfc7bc
RS
12If you are upgrading from an earlier release such as 5.18.0, first read
13L<perl5200delta>, which describes differences between 5.18.0 and 5.20.0.
14
15=head1 Core Enhancements
2ec11c70 16
eabfc7bc 17=head2 New bitwise operators
b9c683b3 18
eabfc7bc
RS
19A new experimental facility has been added that makes the four standard
20bitwise operators (C<& | ^ ~>) treat their operands consistently as
21numbers, and introduces four new dotted operators (C<&. |. ^. ~.>) that
22treat their operands consistently as strings. The same applies to the
23assignment variants (C<&= |= ^= &.= |.= ^.=>).
2e4abf26 24
eabfc7bc
RS
25To use this, enable the "bitwise" feature and disable the
26"experimental::bitwise" warnings category. See L<perlop/Bitwise String
27Operators> for details. [rt.perl.org #123466]
28
29=head2 New double-diamond operator
30
31C<<< <<>> >>> is like C<< <> >> but uses three-argument C<open> to open
32each file in @ARGV. So each element of @ARGV is an actual file name, and
33"|foo" won't be treated as a pipe open.
34
35=head2 New \b boundaries in regular expressions
36
37=head3 qr/\b{gcb}/
38
39C<gcb> stands for Grapheme Cluster Boundary. It is a Unicode property
40that finds the boundary between sequences of characters that look like a
41single character to a native speaker of a language. Perl has long had
42the ability to deal with these through the C<\X> regular escape
43sequence. Now, there is an alternative way of handling these. See
44L<perlrebackslash/\b{}, \b, \B{}, \B> for details.
45
46=head3 qr/\b{wb}/
47
48C<wb> stands for Word Boundary. It is a Unicode property
49that finds the boundary between words. This is similar to the plain
50C<\b> (without braces) but is more suitable for natural language
51processing. It knows, for example that apostrophes can occur in the
52middle of words. See L<perlrebackslash/\b{}, \b, \B{}, \B> for details.
53
54=head3 qr/\b{sb}/
55
56C<sb> stands for Sentence Boundary. It is a Unicode property
57to aid in parsing natural language sentences.
58See L<perlrebackslash/\b{}, \b, \B{}, \B> for details.
59
60=head2 C<no re> covers more and is lexical
61
62Previously running C<no re> would only turn off a few things. Now it
63turns off all the enabled things. For example, previously, you
64couldn't turn off debugging, once enabled, inside the same block.
65
66=head2 Non-Capturing Regular Expression Flag
67
68Regular expressions now support a C</n> flag that disables capturing
69and filling in C<$1>, C<$2>, etc... inside of groups:
70
71 "hello" =~ /(hi|hello)/n; # $1 is not set
72
73This is equivalent to putting C<?:> at the beginning of every capturing group.
74
75See L<perlre/"n"> for more information.
76
77=head2 C<use re 'strict'>
78
79This applies stricter syntax rules to regular expression patterns
80compiled within its scope, which hopefully will alert you to typos and
81other unintentional behavior that backwards-compatibility issues prevent
82us from doing in normal regular expression compilations. Because the
83behavior of this is subject to change in future Perl releases as we gain
84experience, using this pragma will raise a category
85C<experimental::re_strict> warning.
86See L<'strict' in re|re/'strict' mode>.
87
88=head2 C<qr/foo/x> now ignores any Unicode pattern white space
89
90The C</x> regular expression modifier allows the pattern to contain
91white space and comments, both of which are ignored, for improved
92readability. Until now, not all the white space characters that Unicode
93designates for this purpose were handled. The additional ones now
94recognized are
95U+0085 NEXT LINE,
96U+200E LEFT-TO-RIGHT MARK,
97U+200F RIGHT-TO-LEFT MARK,
98U+2028 LINE SEPARATOR,
99and
100U+2029 PARAGRAPH SEPARATOR.
101
102=head2 Unicode 7.0 is now supported
103
104For details on what is in this release, see
105L<http://www.unicode.org/versions/Unicode7.0.0/>.
106
107=head2 S<C<use locale>> can restrict which locale categories are affected
108
109It is now possible to pass a parameter to S<C<use locale>> to specify
110a subset of locale categories to be locale-aware, with the remaining
111ones unaffected. See L<perllocale/The "use locale" pragma> for details.
112
113=head2 Perl now supports POSIX 2008 locale currency additions.
114
115On platforms that are able to handle POSIX.1-2008, the
116hash returned by
117L<C<POSIX::localeconv()>|perllocale/The localeconv function>
118includes the international currency fields added by that version of the
119POSIX standard. These are
120C<int_n_cs_precedes>,
121C<int_n_sep_by_space>,
122C<int_n_sign_posn>,
123C<int_p_cs_precedes>,
124C<int_p_sep_by_space>,
125and
126C<int_p_sign_posn>.
127
128=head2 Better heuristics on older platforms for determining locale UTF8ness
129
130On platforms that implement neither the C99 standard nor the POSIX 2001
131standard, determining if the current locale is UTF8 or not depends on
132heuristics. These are improved in this release.
133
134=head2 Aliasing via reference
135
136Variables and subroutines can now be aliased by assigning to a reference:
137
138 \$c = \$d;
139 \&x = \&y;
140
141Or by using a backslash before a C<foreach> iterator variable, which is
142perhaps the most useful idiom this feature provides:
143
144 foreach \%hash (@array_of_hash_refs) { ... }
145
146This feature is experimental and must be enabled via C<use feature
147'refaliasing'>. It will warn unless the C<experimental::refaliasing>
148warnings category is disabled.
149
150See L<perlref/Assigning to References>
151
152=head2 C<prototype> with no arguments
153
154C<prototype()> with no arguments now infers C<$_>. [perl #123514]
155
156=head2 New "const" subroutine attribute
157
158The "const" attribute can be applied to an anonymous subroutine. It causes
159it to be executed immediately when it is cloned. Its value is captured and
160used to create a new constant subroutine that is returned. This feature is
161experimental. See L<perlsub/Constant Functions>.
162
163=head2 C<fileno> now works on directory handles
164
165When the relevant support is available in the operating system, the
166C<fileno> builtin now works on directory handles, yielding the
167underlying file descriptor in the same way as for filehandles. On
168operating systems without such support, C<fileno> on a directory handle
169continues to return the undefined value, as before, but also sets C<$!> to
170indicate that the operation is not supported.
171
172Currently, this uses either a C<dd_fd> member in the OS C<DIR>
173structure, or a dirfd(3) function as specified by POSIX.1-2008.
174
175=head2 List form of pipe open implemented for Win32
176
177The list form of pipe:
178
179 open my $fh, "-|", "program", @arguments;
180
181is now implemented on Win32. It has the same limitations as C<system
182LIST> on Win32, since the Win32 API doesn't accept program arguments
183as a list.
184
185=head2 C<close> now sets C<$!>
186
187When an I/O error occurs, the fact that there has been an error is recorded
188in the handle. C<close> returns false for such a handle. Previously, the
189value of C<$!> would be untouched by C<close>, so the common convention of
190writing C<close $fh or die $!> did not work reliably. Now the handle
191records the value of C<$!>, too, and C<close> restores it.
192
193=head2 Assignment to list repetition
194
195C<(...) x ...> can now be used within a list that is assigned to, as long
196as the left-hand side is a valid lvalue. This allows C<(undef,undef,$foo)
197= that_function()> to be written as C<((undef)x2, $foo) = that_function()>.
198
199=head2 Infinity and NaN (not-a-number) handling improved
200
201Floating point values are able to hold the special values infinity (also
202-infinity), and NaN (not-a-number). Now we more robustly recognize and
203propagate the value in computations, and on output normalize them to C<Inf> and
204C<NaN>.
205
206See also the L<POSIX> enhancements.
207
208=head2 Floating point parsing has been improved
209
210Parsing and printing of floating point values has been improved.
211
212As a completely new feature, hexadecimal floating point literals
213(like 0x1.23p-4) are now supported, and they can be output with
214C<printf %a>.
215
216=head2 Packing infinity or not-a-number into a character is now fatal
217
218Before, when trying to pack infinity or not-a-number into a
219(signed) character, Perl would warn, and assumed you tried to
220pack C<< 0xFF >>; if you gave it as an argument to C<< chr >>,
221C<< U+FFFD >> was returned.
222
223But now, all such actions (C<< pack >>, C<< chr >>, and C<< print '%c' >>)
224result in a fatal error.
225
226=head2 Experimental C Backtrace API
2e4abf26 227
eabfc7bc
RS
228Starting from Perl 5.21.1, on some platforms Perl supports retrieving
229the C level backtrace (similar to what symbolic debuggers like gdb do).
fea59588 230
eabfc7bc
RS
231The backtrace returns the stack trace of the C call frames,
232with the symbol names (function names), the object names (like "perl"),
233and if it can, also the source code locations (file:line).
234
235The supported platforms are Linux and OS X (some *BSD might work at
236least partly, but they have not yet been tested).
237
238The feature needs to be enabled with C<Configure -Dusecbacktrace>.
239
240Also included is a C API to retrieve backtraces.
241
242See L<perlhacktips/"C backtrace"> for more information.
83a5d6b6 243
7f9fef93 244=head1 Security
e455391f 245
eabfc7bc
RS
246=head2 Perl is now compiled with -fstack-protector-strong if available
247
248Perl has been compiled with the anti-stack-smashing option
249C<-fstack-protector> since 5.10.1. Now Perl uses the newer variant
250called C<-fstack-protector-strong>, if available.
251
252=head2 The L<Safe> module could allow outside packages to be replaced
253
254Critical bugfix: outside packages could be replaced. L<Safe> has
255been patched to 2.38 to address this.
256
257=head2 Perl is now always compiled with -D_FORTIFY_SOURCE=2 if available
e455391f 258
eabfc7bc
RS
259The 'code hardening' option called C<_FORTIFY_SOURCE>, available in
260gcc 4.*, is now always used for compiling Perl, if available.
261
262Note that this isn't necessarily a huge step since in many platforms
263the step had already been taken several years ago: many Linux
264distributions (like Fedora) have been using this option for Perl,
265and OS X has enforced the same for many years.
53902397 266
7f9fef93 267=head1 Incompatible Changes
79a77127 268
eabfc7bc
RS
269=head2 Subroutine signatures moved before attributes
270
271The experimental sub signatures feature, as introduced in 5.20, parsed
272signatures after attributes. In this release, the positioning has been
273moved such that signatures occur after the subroutine name (if any) and
274before the attribute list (if any).
275
276=head2 C<&> and C<\&> prototypes accepts only subs
277
278The C<&> prototype character now accepts only anonymous subs (C<sub {...}>)
279and things beginning with C<\&>. Formerly it erroneously also allowed
280C<undef> and references to array, hashes, and lists. [perl #4539]
281[perl #123062]
282
283The C<\&> prototype was allowing subroutine calls, whereas now it only
284allows subroutines. C<&foo> is permitted. C<&foo()> and C<foo()> are not.
285[perl #77860]
286
287=head2 C<use encoding> is now lexical
288
289The L<encoding> pragma's effect is now limited to lexical scope. This
290pragma is deprecated, but in the meantime, it could adversely affect
291unrelated modules that are included in the same program.
292
293=head2 List slices returning empty lists
294
295List slices return an empty list now only if the original list was empty
296(or if there are no indices). Formerly, a list slice would return an empty
297list if all indices fell outside the original list. [perl #114498]
298
299=head2 C<\N{}> with a sequence of multiple spaces is now a fatal error.
300
301This has been deprecated since v5.18.
302
303=head2 S<C<use UNIVERSAL '...'>> is now a fatal error
304
305Importing functions from C<UNIVERSAL> has been deprecated since v5.12, and
306is now a fatal error. S<C<"use UNIVERSAL">> without any arguments is still
307allowed.
308
309=head2 In double-quotish C<\cI<X>>, I<X> must now be a printable ASCII character
310
311In prior releases, failure to do this raised a deprecation warning.
312
313=head2 Splitting the tokens C<(?> and C<(*> in regular expressions is
314now a fatal compilation error.
315
316These had been deprecated since v5.18.
317
318=head2 5 additional characters are treated as white space under C</x> in
319regex patterns (unless escaped)
320
321The use of these characters with C</x> outside bracketed character
322classes and when not preceded by a backslash has raised a deprecation
323warning since v5.18. Now they will be ignored. See L</"qr/foo/x">
324for the list of the five characters.
325
326=head2 Comment lines within S<C<(?[ ])>> now are ended only by a C<\n>
327
328S<C<(?[ ])>> is an experimental feature, introduced in v5.18. It operates
329as if C</x> is always enabled. But there was a difference, comment
330lines (following a C<#> character) were terminated by anything matching
331C<\R> which includes all vertical whitespace, such as form feeds. For
332consistency, this is now changed to match what terminates comment lines
333outside S<C<(?[ ])>>, namely a C<\n> (even if escaped), which is the
334same as what terminates a heredoc string and formats.
335
336=head2 C<(?[...])> operators now follow standard Perl precedence
337
338This experimental feature allows set operations in regular expression patterns.
339Prior to this, the intersection operator had the same precedence as the other
340binary operators. Now it has higher precedence. This could lead to different
341outcomes than existing code expects (though the documentation has always noted
342that this change might happen, recommending fully parenthesizing the
343expressions). See L<perlrecharclass/Extended Bracketed Character Classes>.
344
345=head2 Omitting % and @ on hash and array names is no longer permitted
c14a43b7 346
eabfc7bc
RS
347Really old Perl let you omit the @ on array names and the % on hash
348names in some spots. This has issued a deprecation warning since Perl
3495.0, and is no longer permitted.
c14a43b7 350
eabfc7bc
RS
351=head2 C<"$!"> text is now in English outside C<"use locale"> scope
352
353Previously, the text, unlike almost everything else, always came out
354based on the current underlying locale of the program. (Also affected
355on some systems is C<"$^E>".) For programs that are unprepared to
356handle locale, this can cause garbage text to be displayed. It's better
357to display text that is translatable via some tool than garbage text
358which is much harder to figure out.
359
360=head2 C<"$!"> text will be returned in UTF-8 when appropriate
361
362The stringification of C<$!> and C<$^E> will have the UTF-8 flag set
363when the text is actually non-ASCII UTF-8. This will enable programs
364that are set up to be locale-aware to properly output messages in the
365user's native language. Code that needs to continue the 5.20 and
366earlier behavior can do the stringification within the scopes of both
367'use bytes' and 'use locale ":messages". No other Perl operations will
368be affected by locale; only C<$!> and C<$^E> stringification. The
369'bytes' pragma causes the UTF-8 flag to not be set, just as in previous
370Perl releases. This resolves [perl #112208].
371
372=head2 Support for C<?PATTERN?> without explicit operator has been removed
373
374Starting regular expressions matching only once directly with the
375question mark delimiter is now a syntax error, so that the question mark
376can be available for use in new operators. Write C<m?PATTERN?> instead,
377explicitly using the C<m> operator: the question mark delimiter still
378invokes match-once behaviour.
379
380=head2 C<defined(@array)> and C<defined(%hash)> are now fatal errors
381
382These have been deprecated since v5.6.1 and have raised deprecation
383warnings since v5.16.
384
385=head2 Using a hash or an array as a reference are now fatal errors.
386
387For example, C<%foo-E<gt>{"bar"}> now causes a fatal compilation
388error. These have been deprecated since before v5.8, and have raised
389deprecation warnings since then.
390
391=head2 Changes to the C<*> prototype
392
393The C<*> character in a subroutine's prototype used to allow barewords to take
394precedence over most, but not all subroutines. It was never consistent and
395exhibited buggy behaviour.
396
397Now it has been changed, so subroutines always take precedence over barewords,
398which brings it into conformity with similarly prototyped built-in functions:
399
400 sub splat(*) { ... }
401 sub foo { ... }
402 splat(foo); # now always splat(foo())
403 splat(bar); # still splat('bar') as before
404 close(foo); # close(foo())
405 close(bar); # close('bar')
c14a43b7 406
7f9fef93 407=head1 Deprecations
47cb8ddb 408
eabfc7bc 409=head2 Setting C<${^ENCODING}> to anything but C<undef>
c14a43b7 410
eabfc7bc
RS
411This variable allows Perl scripts to be written in a non-ASCII,
412non-UTF-8 encoding. However, it affects all modules globally, leading
413to wrong answers and segmentation faults. New scripts should be written
414in UTF-8; old scripts should be converted to UTF-8, which is easily done
415with the L<encoding> pragma.
c14a43b7 416
eabfc7bc 417=head2 C<< /\C/ >> character class
c14a43b7 418
eabfc7bc
RS
419This character class, which matches a single byte, even if it appears
420in a multi-byte character has been deprecated. Matching single bytes
421in a multi-byte character breaks encapsulation, and can corrupt utf8
422strings.
51c2f40f 423
eabfc7bc 424=head2 Use of non-graphic characters in single-character variable names
51c2f40f 425
eabfc7bc
RS
426The syntax for single-character variable names is more lenient than
427for longer variable names, allowing the one-character name to be a
428punctuation character or even invisible (a non-graphic). Perl v5.20
429deprecated the ASCII-range controls as such a name. Now, all
430non-graphic characters that formerly were allowed are deprecated.
431The practical effect of this occurs only when not under C<S<"use
432utf8">>, and affects just the C1 controls (code points 0x80 through
4330xFF), NO-BREAK SPACE, and SOFT HYPHEN.
83a5d6b6 434
eabfc7bc 435=head2 Inlining of C<sub () { $var }> with observable side-effects
abec5bed 436
eabfc7bc
RS
437In many cases Perl makes sub () { $var } into an inlinable constant
438subroutine, capturing the value of $var at the time the C<sub> expression
439is evaluated. This can break the closure behaviour in those cases where
440$var is subsequently modified. The subroutine won't return the new value.
abec5bed 441
eabfc7bc
RS
442This usage is now deprecated in those cases where the variable could be
443modified elsewhere. Perl detects those cases and emits a deprecation
444warning. Such code will likely change in the future and stop producing a
445constant.
abec5bed 446
eabfc7bc
RS
447If your variable is only modified in the place where it is declared, then
448Perl will continue to make the sub inlinable with no warnings.
c14a43b7 449
eabfc7bc
RS
450 sub make_constant {
451 my $var = shift;
452 return sub () { $var }; # fine
453 }
c14a43b7 454
eabfc7bc
RS
455 sub make_constant_deprecated {
456 my $var;
457 $var = shift;
458 return sub () { $var }; # deprecated
459 }
c14a43b7 460
eabfc7bc
RS
461 sub make_constant_deprecated2 {
462 my $var = shift;
463 log_that_value($var); # could modify $var
464 return sub () { $var }; # deprecated
465 }
c14a43b7 466
eabfc7bc
RS
467In the second example above, detecting that $var is assigned to only once
468is too hard to detect. That it happens in a spot other than the C<my>
469declaration is enough for Perl to find it suspicious.
7f9fef93 470
eabfc7bc
RS
471This deprecation warning happens only for a simple variable for the body of
472the sub. (A C<BEGIN> block or C<use> statement inside the sub is ignored,
473because it does not become part of the sub's body.) For more complex
474cases, such as C<sub () { do_something() if 0; $var }> the behaviour has
475changed such that inlining does not happen if the variable is modifiable
476elsewhere. Such cases should be rare.
c14a43b7 477
eabfc7bc 478=head2 Use of multiple /x regexp modifiers
c14a43b7 479
eabfc7bc 480It is now deprecated to say something like any of the following:
c14a43b7 481
eabfc7bc
RS
482 qr/foo/xx;
483 /(?xax:foo)/;
484 use re qw(/amxx);
be39acb2 485
eabfc7bc
RS
486That is, now C<x> should only occur once in any string of contiguous
487regular expression pattern modifiers. We do not believe there are any
488occurrences of this in all of CPAN. This is in preparation for a future
489Perl release having C</xx> mean to allow white-space for readability in
490bracketed character classes (those enclosed in square brackets:
491C<[...]>).
c14a43b7 492
eabfc7bc
RS
493=head2 Using a NO-BREAK space in a character alias for C<\N{...}> is now
494deprecated
60dcce55 495
eabfc7bc
RS
496This non-graphic character is essentially indistinguishable from a
497regular space, and so should not be allowed. See
498L<charnames/CUSTOM ALIASES>.
60dcce55 499
eabfc7bc
RS
500=head2 A literal C<"{"> should now be escaped in a pattern
501
502If you want a literal left curly bracket (also called a left brace) in a
503regular expression pattern, you should now escape it by either
504preceding it with a backslash (C<"\{">) or enclosing it within square
505brackets C<"[{]">, or by using C<\Q>; otherwise a deprecation warning
506will be raised. This was first announced as forthcoming in the v5.16
507release; it will allow future extensions to the language to happen.
508
509=head2 Making all warnings fatal is discouraged
510
511The documentation for L<fatal warnings|warnings/Fatal Warnings> notes that
512C<< use warnings FATAL => 'all' >> is discouraged and provides stronger
513language about the risks of fatal warnings in general.
514
515=head1 Performance Enhancements
79a77127 516
7f9fef93 517=over 4
abec5bed
DIM
518
519=item *
520
eabfc7bc
RS
521If method and class names are known at compile time, hashes are precomputed
522to speed up run-time method lookup. Also, compound method names like
523C<SUPER::new> are parsed at compile time, to save having to parse them at
524run time.
9749148e 525
eabfc7bc 526=item *
9749148e 527
eabfc7bc
RS
528Array and hash lookups (especially nested ones) that use only constants
529or simple variables as keys, are now considerably faster. See
530L</Internal Changes> for more details.
abec5bed
DIM
531
532=item *
533
eabfc7bc
RS
534C<(...)x1>, C<("constant")x0> and C<($scalar)x0> are now optimised in list
535context. If the right-hand argument is a constant 1, the repetition
536operator disappears. If the right-hand argument is a constant 0, the whole
537expressions is optimised to the empty list, so long as the left-hand
538argument is a simple scalar or constant. C<(foo())x0> is not optimised.
6bb5549b 539
eabfc7bc 540=item *
7f9fef93 541
eabfc7bc
RS
542C<substr> assignment is now optimised into 4-argument C<substr> at the end
543of a subroutine (or as the argument to C<return>). Previously, this
544optimisation only happened in void context.
abec5bed 545
eabfc7bc 546=item *
7f9fef93 547
eabfc7bc
RS
548Assignment to lexical variables is often optimised away. For instance, in
549C<$lexical = chr $foo>, the C<chr> operator writes directly to the lexical
550variable instead of returning a value that gets copied. This optimisation
551has been extended to C<split>, C<x> and C<vec> on the right-hand side. It
552has also been made to work with state variable initialization.
be39acb2 553
2e4abf26
DG
554=item *
555
eabfc7bc
RS
556In "\L...", "\Q...", etc., the extra "stringify" op is now optimised away,
557making these just as fast as C<lcfirst>, C<quotemeta>, etc.
2e4abf26 558
eabfc7bc 559=item *
83a5d6b6 560
eabfc7bc
RS
561Assignment to an empty list is now sometimes faster. In particular, it
562never calls C<FETCH> on tied arguments on the right-hand side, whereas it
563used to sometimes.
564
565=item *
83a5d6b6 566
eabfc7bc
RS
567C<length> is up to 20% faster for non-magical/non-tied scalars containing a
568string if it is a non-utf8 string or if C<use bytes;> is in scope.
338906ce 569
eabfc7bc 570=item *
5de148ee 571
eabfc7bc
RS
572Non-magical/non-tied scalars that contain only a floating point value and are
573on most Perl builds with 64 bit integers now use 8-32 less bytes of memory
574depending on OS.
5de148ee 575
eabfc7bc 576=item *
5de148ee 577
eabfc7bc
RS
578In C<@array = split>, the assignment can be optimized away with C<split>
579writing directly to the array. This optimisation was happening only for
580package arrays other than @_ and only
581sometimes. Now this optimisation happens
582almost all the time.
5de148ee 583
eabfc7bc 584=item *
7f9fef93 585
eabfc7bc
RS
586C<join> is now subject to constant folding. Moreover, C<join> with a
587scalar or constant for the separator and a single-item list to join is
588simplified to a stringification. The separator doesn't even get evaluated.
5de148ee 589
eabfc7bc 590=item *
47cb8ddb 591
eabfc7bc
RS
592C<qq(@array)> is implemented using two ops: a stringify op and a join op.
593If the qq contains nothing but a single array, the stringification is
594optimized away.
47cb8ddb
SH
595
596=item *
597
eabfc7bc
RS
598C<our $var> and C<our($s,@a,%h)> in void context are no longer evaluated at
599run time. Even a whole sequence of C<our $foo;> statements will simply be
600skipped over. The same applies to C<state> variables.
47cb8ddb 601
eabfc7bc 602=item *
47cb8ddb 603
eabfc7bc
RS
604Many internal functions have been refactored to improve performance and reduce
605their memory footprints.
47cb8ddb 606
eabfc7bc
RS
607L<[perl #121436]|https://rt.perl.org/Ticket/Display.html?id=121436>
608L<[perl #121906]|https://rt.perl.org/Ticket/Display.html?id=121906>
609L<[perl #121969]|https://rt.perl.org/Ticket/Display.html?id=121969>
47cb8ddb 610
eabfc7bc 611=item *
47cb8ddb 612
eabfc7bc 613C<-T> and C<-B> filetests will return sooner when an empty file is detected.
47cb8ddb 614
eabfc7bc 615L<perl #121489|https://rt.perl.org/Ticket/Display.html?id=121489>
47cb8ddb 616
eabfc7bc 617=item *
5de148ee 618
eabfc7bc 619Refactoring of C<< pp_tied >> and CC<< pp_ref >> for small improvements.
5de148ee
SH
620
621=item *
622
eabfc7bc 623Pathtools don't try to load XS on miniperl.
5de148ee 624
eabfc7bc 625=item *
5de148ee 626
eabfc7bc 627A typo fix reduces the size of the C<< OP >> structure.
be39acb2 628
eabfc7bc
RS
629=item *
630
631Hash lookups where the key is a constant is faster.
be39acb2
SH
632
633=item *
634
eabfc7bc
RS
635Subroutines with an empty prototype and bodies containing just C<undef> are now
636eligible for inlining.
637L<[perl #122728]|https://rt.perl.org/Ticket/Display.html?id=122728>
be39acb2 638
eabfc7bc 639=item *
be39acb2 640
eabfc7bc
RS
641Subroutines in packages no longer need to carry typeglobs around with them.
642Declaring a subroutine will now put a simple sub reference in the stash if
643possible, saving memory. The typeglobs still notionally exist, so accessing
644them will cause the subroutine reference to be upgraded to a typeglob. This
645optimization does not currently apply to XSUBs or exported subroutines, and
646method calls will undo it, since they cache things in typeglobs.
647L<[perl #120441]|https://rt.perl.org/Ticket/Display.html?id=120441>
7f9fef93 648
eabfc7bc 649=item *
be39acb2 650
eabfc7bc
RS
651The functions C<utf8::native_to_unicode()> and C<utf8::unicode_to_native()>
652(see L<utf8>) are now optimized out on ASCII platforms. There is now not even
653a minimal performance hit in writing code portable between ASCII and EBCDIC
654platforms.
be39acb2
SH
655
656=item *
657
eabfc7bc
RS
658Win32 Perl uses 8 KB less of per-process memory than before for every perl
659process of this version. This data is now memory mapped from disk and shared
660between perl processes from the same perl binary.
be39acb2
SH
661
662=back
663
eabfc7bc 664=head1 Modules and Pragmata
83a5d6b6 665
eabfc7bc
RS
666XXX All changes to installed files in F<cpan/>, F<dist/>, F<ext/> and F<lib/>
667go here. If Module::CoreList is updated, generate an initial draft of the
668following sections using F<Porting/corelist-perldelta.pl>. A paragraph summary
669for important changes should then be added by hand. In an ideal world,
670dual-life modules would have a F<Changes> file that could be cribbed.
83a5d6b6 671
eabfc7bc 672[ Within each section, list entries as a =item entry ]
338906ce 673
eabfc7bc 674=head2 New Modules and Pragmata
cd7bac54 675
b5d4d3b9 676=over 4
83b69bfd
DD
677
678=item *
679
7f9fef93 680XXX
13adb056 681
b5d4d3b9 682=back
391823f2 683
eabfc7bc
RS
684=head2 Updated Modules and Pragmata
685
686=over 4
687
688=item *
689
690L<XXX> has been upgraded from version A.xx to B.yy.
6c8457e9 691
eabfc7bc 692=back
2bf83140 693
eabfc7bc 694=head2 Removed Modules and Pragmata
041a5927 695
7f9fef93 696=over 4
69e954a5 697
7f9fef93 698=item *
86e0176a 699
7f9fef93 700XXX
69e954a5 701
e5998677 702=back
20b5e916 703
eabfc7bc
RS
704=head1 Documentation
705
706=head2 New Documentation
532ecd00 707
eabfc7bc 708=head3 L<perlunicook>
d76c14eb 709
eabfc7bc
RS
710This document, by Tom Christiansen, provides examples of handling Unicode in
711Perl.
712
713=head2 Changes to Existing Documentation
714
715=head3 L<perlapi>
d547bad0 716
e5998677 717=over 4
d547bad0 718
8a95d307
FC
719=item *
720
eabfc7bc 721Note that C<SvSetSV> doesn't do set magic.
532ecd00 722
eabfc7bc 723=item *
532ecd00 724
eabfc7bc
RS
725C<sv_usepvn_flags> - Fix documentation to mention the use of C<NewX> instead of
726C<malloc>.
532ecd00 727
eabfc7bc 728L<[perl #121869]|https://rt.perl.org/Ticket/Display.html?id=121869>
532ecd00 729
eabfc7bc 730=item *
532ecd00 731
eabfc7bc 732Clarify where C<NUL> may be embedded or is required to terminate a string.
532ecd00 733
eabfc7bc 734=item *
532ecd00 735
eabfc7bc 736Previously missing documentation due to formatting errors are now included.
532ecd00 737
eabfc7bc 738=item *
532ecd00 739
eabfc7bc 740Entries are now organized into groups rather than by file where they are found.
532ecd00 741
eabfc7bc 742=item *
532ecd00 743
eabfc7bc
RS
744Alphabetical sorting of entries is now handled by the POD generator to make
745entries easier to find when scanning.
746
747=back
338906ce 748
eabfc7bc 749=head3 L<perldata>
338906ce 750
e5998677 751=over 4
338906ce 752
eabfc7bc 753=item *
2f304be9 754
eabfc7bc
RS
755The syntax of single-character variable names has been brought
756up-to-date and more fully explained.
9749148e 757
7f9fef93 758=back
9749148e 759
eabfc7bc 760=head3 L<perlebcdic>
47cb8ddb 761
7f9fef93 762=over 4
47cb8ddb 763
eabfc7bc 764=item *
47cb8ddb 765
eabfc7bc
RS
766This document has been significantly updated in the light of recent
767improvements to EBCDIC support.
47cb8ddb 768
7f9fef93 769=back
47cb8ddb 770
eabfc7bc 771=head3 L<perlfunc>
be39acb2 772
eabfc7bc 773=over 4
be39acb2 774
eabfc7bc 775=item *
be39acb2 776
eabfc7bc 777Mention that C<study()> is currently a no-op.
be39acb2
SH
778
779=item *
780
eabfc7bc
RS
781Calling C<delete> or C<exists> on array values is now described as "strongly
782discouraged" rather than "deprecated".
be39acb2 783
eabfc7bc 784=item *
7f9fef93 785
eabfc7bc 786Improve documentation of C<< our >>.
be39acb2 787
eabfc7bc 788=item *
be39acb2 789
eabfc7bc
RS
790C<-l> now notes that it will return false if symlinks aren't supported by the
791file system.
be39acb2 792
eabfc7bc 793L<[perl #121523]|https://rt.perl.org/Ticket/Display.html?id=121523>
be39acb2
SH
794
795=item *
796
eabfc7bc
RS
797Note that C<exec LIST> and C<system LIST> may fall back to the shell on
798Win32. Only C<exec PROGRAM LIST> and C<system PROGRAM LIST> indirect object
799syntax will reliably avoid using the shell.
800
801This has also been noted in L<perlport>.
802
803L<[perl #122046]|https://rt.perl.org/Ticket/Display.html?id=122046>
be39acb2 804
7f9fef93 805=back
be39acb2 806
eabfc7bc
RS
807=head3 L<perlguts>
808
809=over 4
810
811=item *
812
813The OOK example has been updated to account for COW changes and a change in the
814storage of the offset.
815
816=item *
be39acb2 817
eabfc7bc 818Details on C level symbols and libperl.t added.
be39acb2 819
eabfc7bc
RS
820=back
821
822=head3 L<perlhacktips>
7f9fef93
SH
823
824=over 4
be39acb2
SH
825
826=item *
827
eabfc7bc
RS
828Documentation has been added illustrating the perils of assuming the contents
829of static memory pointed to by the return values of Perl wrappers for C library
830functions doesn't change.
831
832=item *
833
834Recommended replacements for tmpfile, atoi, strtol, and strtoul added.
835
836=item *
837
838Updated documentation for the C<test.valgrind> C<make> target.
839
840L<[perl #121431]|https://rt.perl.org/Ticket/Display.html?id=121431>
be39acb2 841
a9c3e753 842=back
ea13b07e 843
eabfc7bc 844=head3 L<perlmodstyle>
0d42058e 845
7f9fef93
SH
846=over 4
847
848=item *
2a7a05b4 849
eabfc7bc
RS
850Instead of pointing to the module list, we are now pointing to
851L<PrePAN|http://prepan.org/>.
2a7a05b4 852
7f9fef93
SH
853=back
854
eabfc7bc
RS
855=head3 L<perlpolicy>
856
857=over 4
858
859=item *
860
861We now have a code of conduct for the I<< p5p >> mailing list, as documented
862in L<< perlpolicy/STANDARDS OF CONDUCT >>.
2a7a05b4 863
eabfc7bc
RS
864=item *
865
866The conditions for marking an experimental feature as non-experimental are now
867set out.
868
869=back
870
871=head3 L<perlport>
872
873=over 4
874
875=item *
876
877Out-of-date VMS-specific information has been fixed/simplified.
878
879=back
880
881=head3 L<perlre>
882
883=over 4
884
885=item *
886
887The C</x> modifier has been clarified to note that comments cannot be continued
888onto the next line by escaping them.
889
890=back
891
892=head3 L<perlrebackslash>
893
894=over 4
895
896=item *
897
898Added documentation of C<\b{sb}>, C<\b{wb}>, C<\b{gcb}>, and C<\b{g}>.
899
900=back
901
902=head3 L<perlrecharclass>
903
904=over 4
905
906=item *
907
908Clarifications have been added to L<perlrecharclass/Character Ranges>
909to the effect that Perl guarantees that C<[A-Z]>, C<[a-z]>, C<[0-9]> and
910any subranges thereof in regular expression bracketed character classes
911are guaranteed to match exactly what a naive English speaker would
912expect them to match, even on platforms (such as EBCDIC) where special
913handling is required to accomplish this.
914
915=item *
916
917The documentation of Bracketed Character Classes has been expanded to cover the
918improvements in C<qr/[\N{named sequence}]/> (see under L</Selected Bug Fixes>).
919
920=back
921
922=head3 L<perlsec>
923
924=over 4
925
926=item *
927
928Comments added on algorithmic complexity and tied hashes.
929
930=back
931
932=head3 L<perlsyn>
933
934=over 4
935
936=item *
937
938An ambiguity in the documentation of the C<...> statement has been corrected.
939L<[perl #122661]|https://rt.perl.org/Ticket/Display.html?id=122661>
940
941=item *
942
943The empty conditional in C<< for >> and C<< while >> is now documented
944in L<< perlsyn >>.
945
946=back
947
948=head3 L<perlunicode>
949
950=over 4
951
952=item *
953
954Update B<Default Word Boundaries> under
955L<perlunicode/"Unicode Regular Expression Support Level">'s
956B<Extended Unicode Support>.
957
958=back
959
960=head3 L<perluniintro>
961
962=over 4
963
964=item *
965
966Advice for how to make sure your strings and regular expression patterns are
967interpreted as Unicode has been revised to account for the new Perl 5.22 EBCDIC
968handling.
969
970=back
971
972=head3 L<perlvar>
973
974=over 4
975
976=item *
977
978Further clarify version number representations and usage.
979
980=back
981
982=head3 L<perlvms>
983
984=over 4
985
986=item *
987
988Out-of-date and/or incorrect material has been removed.
989
990=item *
991
992Updated documentation on environment and shell interaction in VMS.
993
994=back
995
996=head3 L<perlxs>
997
998=over 4
999
1000=item *
1001
1002Added a discussion of locale issues in XS code.
1003
1004=back
1005
1006=head1 Diagnostics
1007
1008The following additions or changes have been made to diagnostic output,
1009including warnings and fatal error messages. For the complete list of
1010diagnostic messages, see L<perldiag>.
1011
1012=head2 New Diagnostics
1013
1014=head3 New Errors
1015
1016=over 4
1017
1018=item *
1019
1020L<Bad symbol for scalar|perldiag/"Bad symbol for scalar">
1021
1022(P) An internal request asked to add a scalar entry to something that
1023wasn't a symbol table entry.
1024
1025=item *
1026
1027L<Can't use a hash as a reference|perldiag/"Can't use a hash as a reference">
1028
1029(F) You tried to use a hash as a reference, as in
1030C<< %foo->{"bar"} >> or C<< %$ref->{"hello"} >>. Versions of perl E<lt>= 5.6.1
1031used to allow this syntax, but shouldn't have.
1032
1033=item *
1034
1035L<Can't use an array as a reference|perldiag/"Can't use an array as a reference">
1036
1037(F) You tried to use an array as a reference, as in
1038C<< @foo->[23] >> or C<< @$ref->[99] >>. Versions of perl E<lt>= 5.6.1 used to
1039allow this syntax, but shouldn't have.
1040
1041=item *
1042
1043L<Can't use 'defined(@array)' (Maybe you should just omit the defined()?)|perldiag/"Can't use 'defined(@array)' (Maybe you should just omit the defined()?)">
1044
1045(F) defined() is not useful on arrays because it
1046checks for an undefined I<scalar> value. If you want to see if the
1047array is empty, just use C<if (@array) { # not empty }> for example.
1048
1049=item *
1050
1051L<Can't use 'defined(%hash)' (Maybe you should just omit the defined()?)|perldiag/"Can't use 'defined(%hash)' (Maybe you should just omit the defined()?)">
1052
1053(F) C<defined()> is not usually right on hashes.
1054
1055Although C<defined %hash> is false on a plain not-yet-used hash, it
1056becomes true in several non-obvious circumstances, including iterators,
1057weak references, stash names, even remaining true after C<undef %hash>.
1058These things make C<defined %hash> fairly useless in practice, so it now
1059generates a fatal error.
1060
1061If a check for non-empty is what you wanted then just put it in boolean
1062context (see L<perldata/Scalar values>):
1063
1064 if (%hash) {
1065 # not empty
1066 }
1067
1068If you had C<defined %Foo::Bar::QUUX> to check whether such a package
1069variable exists then that's never really been reliable, and isn't
1070a good way to enquire about the features of a package, or whether
1071it's loaded, etc.
1072
1073=item *
1074
1075L<Cannot chr %f|perldiag/"Cannot chr %f">
1076
c21a1c59
RS
1077(F) You passed an invalid number (like an infinity or not-a-number) to
1078C<chr>.
1079
eabfc7bc
RS
1080=item *
1081
1082L<Cannot compress %f in pack|perldiag/"Cannot compress %f in pack">
1083
c21a1c59
RS
1084(F) You tried converting an infinity or not-a-number to an unsigned
1085character, which makes no sense.
1086
eabfc7bc
RS
1087=item *
1088
1089L<Cannot pack %f with '%c'|perldiag/"Cannot pack %f with '%c'">
1090
c21a1c59
RS
1091(F) You tried converting an infinity or not-a-number to a character,
1092which makes no sense.
1093
eabfc7bc
RS
1094=item *
1095
1096L<Cannot print %f with '%c'|perldiag/"Cannot printf %f with '%c'">
1097
c21a1c59
RS
1098(F) You tried printing an infinity or not-a-number as a character (%c),
1099which makes no sense. Maybe you meant '%s', or just stringifying it?
1100
eabfc7bc
RS
1101=item *
1102
1103L<charnames alias definitions may not contain a sequence of multiple spaces|perldiag/"charnames alias definitions may not contain a sequence of multiple spaces">
1104
1105(F) You defined a character name which had multiple space
1106characters in a row. Change them to single spaces. Usually these
1107names are defined in the C<:alias> import argument to C<use charnames>, but
1108they could be defined by a translator installed into C<$^H{charnames}>.
1109See L<charnames/CUSTOM ALIASES>.
1110
1111=item *
1112
1113L<charnames alias definitions may not contain trailing white-space|perldiag/"charnames alias definitions may not contain trailing white-space">
1114
1115(F) You defined a character name which ended in a space
1116character. Remove the trailing space(s). Usually these names are
1117defined in the C<:alias> import argument to C<use charnames>, but they
1118could be defined by a translator installed into C<$^H{charnames}>.
1119See L<charnames/CUSTOM ALIASES>.
1120
1121=item *
1122
1123L<:const is not permitted on named subroutines|perldiag/":const is not permitted on named subroutines">
1124
1125(F) The "const" attribute causes an anonymous subroutine to be run and
1126its value captured at the time that it is cloned. Names subroutines are
1127not cloned like this, so the attribute does not make sense on them.
1128
1129=item *
1130
1131L<Hexadecimal float: internal error|perldiag/"Hexadecimal float: internal error">
1132
1133(F) Something went horribly bad in hexadecimal float handling.
1134
1135=item *
1136
1137L<Hexadecimal float: unsupported long double format|perldiag/"Hexadecimal float: unsupported long double format">
1138
1139(F) You have configured Perl to use long doubles but
1140the internals of the long double format are unknown,
1141therefore the hexadecimal float output is impossible.
1142
1143=item *
1144
1145L<Illegal suidscript|perldiag/"Illegal suidscript">
1146
1147(F) The script run under suidperl was somehow illegal.
1148
1149=item *
1150
1151L<In '(?...)', the '(' and '?' must be adjacent in regex; marked by S<<-- HERE> in mE<sol>%sE<sol>|perldiag/"In '(?...)', the '(' and '?' must be adjacent in regex; marked by <-- HERE in m/%s/">
1152
1153(F) The two-character sequence C<"(?"> in
1154this context in a regular expression pattern should be an
1155indivisible token, with nothing intervening between the C<"(">
1156and the C<"?">, but you separated them.
1157
1158=item *
1159
1160L<In '(*VERB...)', the '(' and '*' must be adjacent in regex; marked by S<<-- HERE> in mE<sol>%sE<sol>|perldiag/"In '(*VERB...)', the '(' and '*' must be adjacent in regex; marked by <-- HERE in m/%s/">
1161
1162(F) The two-character sequence C<"(*"> in
1163this context in a regular expression pattern should be an
1164indivisible token, with nothing intervening between the C<"(">
1165and the C<"*">, but you separated them.
1166
1167=item *
1168
1169L<Invalid quantifier in {,} in regex; marked by <-- HERE in mE<sol>%sE<sol>|perldiag/"Invalid quantifier in {,} in regex; marked by <-- HERE in m/%s/">
1170
1171(F) The pattern looks like a {min,max} quantifier, but the min or max could not
1172be parsed as a valid number - either it has leading zeroes, or it represents
1173too big a number to cope with. The S<<-- HERE> shows where in the regular
1174expression the problem was discovered. See L<perlre>.
1175
1176=back
1177
1178=head3 New Warnings
1179
1180=over 4
1181
1182=item *
1183
1184L<'%s' is an unknown bound type in regex|perldiag/"'%s' is an unknown bound type in regex; marked by <-- HERE in m/%s/">
1185
1186You used C<\b{...}> or C<\B{...}> and the C<...> is not known to
1187Perl. The current valid ones are given in
1188L<perlrebackslash/\b{}, \b, \B{}, \B>.
1189
1190=item *
1191
1192L<"%s" is more clearly written simply as "%s" in regex; marked by E<lt>-- 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>>
1193
1194(W regexp) (only under C<S<use re 'strict'>> or within C<(?[...])>)
1195
1196You specified a character that has the given plainer way of writing it,
1197and which is also portable to platforms running with different character
1198sets.
1199
1200=item *
1201
1202L<Argument "%s" treated as 0 in increment (++)|perldiag/"Argument "%s" treated
1203as 0 in increment (++)">
1204
1205(W numeric) The indicated string was fed as an argument to the C<++> operator
1206which expects either a number or a string matching C</^[a-zA-Z]*[0-9]*\z/>.
1207See L<perlop/Auto-increment and Auto-decrement> for details.
1208
1209=item *
1210
1211L<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/">
1212
1213(W regexp) (only under C<S<use re 'strict'>> or within C<(?[...])>)
1214
1215In a bracketed character class in a regular expression pattern, you
1216had a range which has exactly one end of it specified using C<\N{}>, and
1217the other end is specified using a non-portable mechanism. Perl treats
1218the range as a Unicode range, that is, all the characters in it are
1219considered to be the Unicode characters, and which may be different code
1220points on some platforms Perl runs on. For example, C<[\N{U+06}-\x08]>
1221is treated as if you had instead said C<[\N{U+06}-\N{U+08}]>, that is it
1222matches the characters whose code points in Unicode are 6, 7, and 8.
1223But that C<\x08> might indicate that you meant something different, so
1224the warning gets raised.
1225
1226=item *
1227
eabfc7bc
RS
1228L<:const is experimental|perldiag/":const is experimental">
1229
1230(S experimental::const_attr) The "const" attribute is experimental.
1231If you want to use the feature, disable the warning with C<no warnings
1232'experimental::const_attr'>, but know that in doing so you are taking
1233the risk that your code may break in a future Perl version.
1234
1235=item *
1236
1237L<gmtime(%f) failed|perldiag/"gmtime(%f) failed">
1238
1239(W overflow) You called C<gmtime> with a number that it could not handle:
1240too large, too small, or NaN. The returned value is C<undef>.
1241
1242=item *
1243
1244L<Hexadecimal float: exponent overflow|perldiag/"Hexadecimal float: exponent overflow">
1245
1246(W overflow) The hexadecimal floating point has larger exponent
1247than the floating point supports.
1248
1249=item *
1250
1251L<Hexadecimal float: exponent underflow|perldiag/"Hexadecimal float: exponent underflow">
1252
1253(W overflow) The hexadecimal floating point has smaller exponent
1254than the floating point supports.
1255
1256=item *
1257
1258L<Hexadecimal float: mantissa overflow|perldiag/"Hexadecimal float: mantissa overflow">
1259
1260(W overflow) The hexadecimal floating point literal had more bits in
1261the mantissa (the part between the 0x and the exponent, also known as
1262the fraction or the significand) than the floating point supports.
1263
1264=item *
1265
1266L<Hexadecimal float: precision loss|perldiag/"Hexadecimal float: precision loss">
1267
1268(W overflow) The hexadecimal floating point had internally more
1269digits than could be output. This can be caused by unsupported
1270long double formats, or by 64-bit integers not being available
1271(needed to retrieve the digits under some configurations).
1272
eabfc7bc
RS
1273=item *
1274
1275L<localtime(%f) failed|perldiag/"localtime(%f) failed">
1276
1277(W overflow) You called C<localtime> with a number that it could not handle:
1278too large, too small, or NaN. The returned value is C<undef>.
1279
1280=item *
1281
1282L<Negative repeat count does nothing|perldiag/"Negative repeat count does nothing">
1283
1284(W numeric) You tried to execute the
1285L<C<x>|perlop/Multiplicative Operators> repetition operator fewer than 0
1286times, which doesn't make sense.
1287
1288=item *
1289
1290L<NO-BREAK SPACE in a charnames alias definition is deprecated|perldiag/"NO-BREAK SPACE in a charnames alias definition is deprecated">
1291
1292(D deprecated) You defined a character name which contained a no-break
1293space character. Change it to a regular space. Usually these names are
1294defined in the C<:alias> import argument to C<use charnames>, but they
1295could be defined by a translator installed into C<$^H{charnames}>. See
1296L<charnames/CUSTOM ALIASES>.
1297
1298=item *
1299
1300L<Non-finite repeat count does nothing|perldiag/"Non-finite repeat count does nothing">
1301
1302(W numeric) You tried to execute the
1303L<C<x>|perlop/Multiplicative Operators> repetition operator C<Inf> (or
1304C<-Inf>) or C<NaN> times, which doesn't make sense.
1305
1306=item *
1307
1308L<PerlIO layer ':win32' is experimental|perldiag/"PerlIO layer ':win32' is experimental">
1309
1310(S experimental::win32_perlio) The C<:win32> PerlIO layer is
1311experimental. If you want to take the risk of using this layer,
1312simply disable this warning:
1313
1314 no warnings "experimental::win32_perlio";
1315
1316=item *
1317
1318L<Ranges of ASCII printables should be some subset of "0-9", "A-Z", or "a-z" in regex; marked by E<lt>-- 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>">
1319
1320(W regexp) (only under C<S<use re 'strict'>> or within C<(?[...])>)
1321
1322Stricter rules help to find typos and other errors. Perhaps you didn't
1323even intend a range here, if the C<"-"> was meant to be some other
1324character, or should have been escaped (like C<"\-">). If you did
1325intend a range, the one that was used is not portable between ASCII and
1326EBCDIC platforms, and doesn't have an obvious meaning to a casual
1327reader.
1328
1329 [3-7] # OK; Obvious and portable
1330 [d-g] # OK; Obvious and portable
1331 [A-Y] # OK; Obvious and portable
1332 [A-z] # WRONG; Not portable; not clear what is meant
1333 [a-Z] # WRONG; Not portable; not clear what is meant
1334 [%-.] # WRONG; Not portable; not clear what is meant
1335 [\x41-Z] # WRONG; Not portable; not obvious to non-geek
1336
1337(You can force portability by specifying a Unicode range, which means that
1338the endpoints are specified by
1339L<C<\N{...}>|perlrecharclass/Character Ranges>, but the meaning may
1340still not be obvious.)
1341The stricter rules require that ranges that start or stop with an ASCII
1342character that is not a control have all their endpoints be the literal
1343character, and not some escape sequence (like C<"\x41">), and the ranges
1344must be all digits, or all uppercase letters, or all lowercase letters.
1345
1346=item *
1347
1348L<Ranges of digits should be from the same group in regex; marked by E<lt>-- HERE in mE<sol>%sE<sol>|perldiag/"Ranges of digits should be from the same group in regex; marked by <-- HERE in m/%s/">
1349
1350(W regexp) (only under C<S<use re 'strict'>> or within C<(?[...])>)
1351
1352Stricter rules help to find typos and other errors. You included a
1353range, and at least one of the end points is a decimal digit. Under the
1354stricter rules, when this happens, both end points should be digits in
1355the same group of 10 consecutive digits.
1356
1357=item *
1358
1359L<Redundant argument in %s|perldiag/Redundant argument in %s>
1360
1361(W redundant) You called a function with more arguments than other
1362arguments you supplied indicated would be needed. Currently only
1363emitted when a printf-type format required fewer arguments than were
1364supplied, but might be used in the future for e.g. L<perlfunc/pack>.
1365
1366The warnings category C<< redundant >> is new. See also [RT #121025]
1367
1368=item *
1369
1370L<Use of \b{} for non-UTF-8 locale is wrong. Assuming a UTF-8 locale|perldiag/"Use of \b{} for non-UTF-8 locale is wrong. Assuming a UTF-8 locale">
1371
1372You are matching a regular expression using locale rules,
1373and a Unicode boundary is being matched, but the locale is not a Unicode
1374one. This doesn't make sense. Perl will continue, assuming a Unicode
1375(UTF-8) locale, but the results could well be wrong except if the locale
1376happens to be ISO-8859-1 (Latin1) where this message is spurious and can
1377be ignored.
1378
1379=item *
1380
1381L<< Using E<sol>u for '%s' instead of E<sol>%s in regex; marked by E<lt>-- HERE in mE<sol>%sE<sol>|perldiag/"Using E<sol>u for '%s' instead of E<sol>%s in regex; marked by <-- HERE in mE<sol>%sE<sol>" >>
1382
1383You used a Unicode boundary (C<\b{...}> or C<\B{...}>) in a
1384portion of a regular expression where the character set modifiers C</a>
1385or C</aa> are in effect. These two modifiers indicate an ASCII
1386interpretation, and this doesn't make sense for a Unicode definition.
1387The generated regular expression will compile so that the boundary uses
1388all of Unicode. No other portion of the regular expression is affected.
1389
1390=item *
1391
1392L<The bitwise feature is experimental|perldiag/"The bitwise feature is experimental">
1393
1394This warning is emitted if you use bitwise
1395operators (C<& | ^ ~ &. |. ^. ~.>) with the "bitwise" feature enabled.
1396Simply suppress the warning if you want to use the feature, but know
1397that in doing so you are taking the risk of using an experimental
1398feature which may change or be removed in a future Perl version:
1399
1400 no warnings "experimental::bitwise";
1401 use feature "bitwise";
1402 $x |.= $y;
1403
1404=item *
1405
1406L<Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in mE<sol>%sE<sol>|perldiag/"Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/%s/">
1407
1408(D deprecated, regexp) You used a literal C<"{"> character in a regular
1409expression pattern. You should change to use C<"\{"> instead, because a future
1410version of Perl (tentatively v5.26) will consider this to be a syntax error. If
1411the pattern delimiters are also braces, any matching right brace
1412(C<"}">) should also be escaped to avoid confusing the parser, for
1413example,
1414
1415 qr{abc\{def\}ghi}
1416
1417=item *
1418
1419L<Use of literal non-graphic characters in variable names is deprecated|perldiag/"Use of literal non-graphic characters in variable names is deprecated">
1420
1421=item *
1422
1423L<Useless use of attribute "const"|perldiag/Useless use of attribute "const">
1424
1425(W misc) The "const" attribute has no effect except
1426on anonymous closure prototypes. You applied it to
1427a subroutine via L<attributes.pm|attributes>. This is only useful
1428inside an attribute handler for an anonymous subroutine.
1429
1430=item *
1431
1432L<E<quot>use re 'strict'E<quot> is experimental|perldiag/"use re 'strict'" is experimental>
1433
1434(S experimental::re_strict) The things that are different when a regular
1435expression pattern is compiled under C<'strict'> are subject to change
1436in future Perl releases in incompatible ways. This means that a pattern
1437that compiles today may not in a future Perl release. This warning is
1438to alert you to that risk.
1439
1440=item *
1441
1442L<Warning: unable to close filehandle %s properly: %s|perldiag/"Warning: unable to close filehandle %s properly: %s">
1443
1444=item *
1445
1446L<Wide character (U+%X) in %s|perldiag/"Wide character (U+%X) in %s">
1447
1448(W locale) While in a single-byte locale (I<i.e.>, a non-UTF-8
1449one), a multi-byte character was encountered. Perl considers this
1450character to be the specified Unicode code point. Combining non-UTF8
1451locales and Unicode is dangerous. Almost certainly some characters
1452will have two different representations. For example, in the ISO 8859-7
1453(Greek) locale, the code point 0xC3 represents a Capital Gamma. But so
1454also does 0x393. This will make string comparisons unreliable.
1455
1456You likely need to figure out how this multi-byte character got mixed up
1457with your single-byte locale (or perhaps you thought you had a UTF-8
1458locale, but Perl disagrees).
1459
1460=item *
1461
1462The following two warnings for C<tr///> used to be skipped if the
1463transliteration contained wide characters, but now they occur regardless of
1464whether there are wide characters or not:
1465
1466L<Useless use of E<sol>d modifier in transliteration operator|perldiag/"Useless use of /d modifier in transliteration operator">
1467
1468L<Replacement list is longer than search list|perldiag/Replacement list is longer than search list>
1469
1470=item *
1471
1472A new C<locale> warning category has been created, with the following warning
1473messages currently in it:
1474
1475=over 4
1476
1477=item *
1478
1479L<Locale '%s' may not work well.%s|perldiag/Locale '%s' may not work well.%s>
1480
1481=item *
1482
1483L<Can't do %s("%s") on non-UTF-8 locale; resolved to "%s".|perldiag/Can't do %s("%s") on non-UTF-8 locale; resolved to "%s".>
1484
1485=back
1486
1487=back
1488
1489=head2 Changes to Existing Diagnostics
1490
1491=over 4
1492
1493=item *
1494
1495<> should be quotes
1496
1497This warning has been changed to
1498L<< <> at require-statement should be quotes|perldiag/"<> at require-statement should be quotes" >>
1499to make the issue more identifiable.
1500
1501=item *
1502
1503L<Argument "%s" isn't numeric%s|perldiag/"Argument "%s" isn't numeric%s">
1504now adds the following note:
1505
77c2376a
KW
1506 Note that for the C<Inf> and C<NaN> (infinity and not-a-number) the
1507 definition of "numeric" is somewhat unusual: the strings themselves
1508 (like "Inf") are considered numeric, and anything following them is
1509 considered non-numeric.
eabfc7bc
RS
1510
1511=item *
1512
1513L<Global symbol "%s" requires explicit package name|perldiag/"Global symbol "%s" requires explicit package name (did you forget to declare "my %s"?)">
1514
1515This message has had '(did you forget to declare "my %s"?)' appended to it, to
1516make it more helpful to new Perl programmers.
1517L<[perl #121638]|https://rt.perl.org/Ticket/Display.html?id=121638>
1518
1519=item *
1520
1521'"my" variable &foo::bar can't be in a package' has been reworded to say
1522'subroutine' instead of 'variable'.
1523
1524=item *
1525
022a330c 1526L<\N{} in character class restricted to one character in regex; marked by S<<-- HERE> in mE<sol>%sE<sol>|perldiag/"\N{} in inverted character class or as a range end-point is restricted to one character in regex; marked by <-- HERE in m/%s/">
eabfc7bc
RS
1527
1528This message has had 'character class' changed to 'inverted character class or
1529as a range end-point is' to reflect improvements in C<qr/[\N{named sequence}]/>
1530(see under L</Selected Bug Fixes>).
1531
1532=item *
1533
1534L<panic: frexp|perldiag/"panic: frexp: %f">
1535
1536This message has had ': %f' appended to it, to show what the offending floating
1537point number is.
1538
1539=item *
1540
1541B<Possible precedence problem on bitwise %c operator> reworded as
1542L<Possible precedence problem on bitwise %s operator|perldiag/"Possible precedence problem on bitwise %s operator">.
1543
1544=item *
1545
1546C<require> with no argument or undef used to warn about a Null filename; now
1547it dies with C<Missing or undefined argument to require>.
1548
1549=item *
1550
1551L<Unsuccessful %s on filename containing newline|perldiag/"Unsuccessful %s on filename containing newline">
1552
1553This warning is now only produced when the newline is at the end of
1554the filename.
1555
1556=item *
1557
1558"Variable %s will not stay shared" has been changed to say "Subroutine"
1559when it is actually a lexical sub that will not stay shared.
1560
1561=item *
1562
1563L<Variable length lookbehind not implemented in regex mE<sol>%sE<sol>|perldiag/"Variable length lookbehind not implemented in regex m/%s/">
1564
1565Information about Unicode behaviour has been added.
1566
1567=back
1568
1569=head2 Diagnostic Removals
1570
1571=over
1572
1573=item *
1574
1575"Ambiguous use of -foo resolved as -&foo()"
1576
1577There is actually no ambiguity here, and this impedes the use of negated
1578constants; e.g., C<-Inf>.
1579
1580=item *
1581
1582"Constant is not a FOO reference"
1583
1584Compile-time checking of constant dereferencing (e.g., C<< my_constant->() >>)
1585has been removed, since it was not taking overloading into account.
1586L<[perl #69456]|https://rt.perl.org/Ticket/Display.html?id=69456>
1587L<[perl #122607]|https://rt.perl.org/Ticket/Display.html?id=122607>
1588
1589=back
1590
1591=head1 Utility Changes
1592
1593=head2 F<x2p/>
1594
1595=over 4
1596
1597=item *
1598
1599The F<x2p/> directory has been removed from the Perl core.
1600
1601This removes find2perl, s2p and a2p. They have all been released to CPAN as
1602separate distributions (App::find2perl, App::s2p, App::a2p).
1603
1604=back
1605
1606=head2 L<h2ph>
1607
1608=over 4
1609
1610=item *
1611
1612F<h2ph> now handles hexadecimal constants in the compiler's predefined
1613macro definitions, as visible in C<$Config{cppsymbols}>. [rt.perl.org
1614#123784]
1615
1616=back
1617
1618=head2 L<encguess>
1619
1620=over 4
1621
1622=item *
1623
1624No longer depends on non-core module anymore.
1625
1626=back
1627
1628=head1 Configuration and Compilation
1629
1630=over 4
1631
1632=item *
1633
1634F<Configure> now checks for F<lrintl>, F<lroundl>, F<llrintl>, and F<llroundl>.
1635
1636=item *
1637
1638F<Configure> with C<-Dmksymlinks> should now be faster. [perl #122002]
1639
1640=item *
1641
1642pthreads and lcl will be linked by default if present. This allows XS modules
1643that require threading to work on non-threaded perls. Note that you must still
1644pass C<-Dusethreads> if you want a threaded perl.
1645
1646=item *
1647
1648For long doubles (to get more precision and range for floating point numbers)
1649one can now use the GCC quadmath library which implements the quadruple
1650precision floating point numbers in x86 and ia64 platforms. See F<INSTALL> for
1651details.
1652
1653=item *
1654
1655MurmurHash64A and MurmurHash64B can now be configured as the internal hash
1656function.
1657
1658=item *
1659
1660C<make test.valgrind> now supports parallel testing.
1661
1662For example:
1663
1664 TEST_JOBS=9 make test.valgrind
1665
1666See L<perlhacktips/valgrind> for more information.
1667
1668L<[perl #121431]|https://rt.perl.org/Ticket/Display.html?id=121431>
1669
1670=item *
1671
1672The MAD (Misc Attribute Decoration) build option has been removed
1673
1674This was an unmaintained attempt at preserving
1675the Perl parse tree more faithfully so that automatic conversion of
1676Perl 5 to Perl 6 would have been easier.
1677
1678This build-time configuration option had been unmaintained for years,
1679and had probably seriously diverged on both Perl 5 and Perl 6 sides.
1680
1681=item *
1682
1683A new compilation flag, C<< -DPERL_OP_PARENT >> is available. For details,
1684see the discussion below at L<< /Internal Changes >>.
1685
1686=back
1687
1688=head1 Testing
1689
1690=over 4
1691
1692=item *
1693
1694F<t/porting/re_context.t> has been added to test that L<utf8> and its
1695dependencies only use the subset of the C<$1..$n> capture vars that
1696Perl_save_re_context() is hard-coded to localize, because that function has no
1697efficient way of determining at runtime what vars to localize.
1698
1699=item *
1700
1701Tests for performance issues have been added in the file F<t/perf/taint.t>.
1702
1703=item *
1704
1705Some regular expression tests are written in such a way that they will
1706run very slowly if certain optimizations break. These tests have been
1707moved into new files, F<< t/re/speed.t >> and F<< t/re/speed_thr.t >>,
1708and are run with a C<< watchdog() >>.
1709
1710=item *
1711
1712C<< test.pl >> now allows C<< plan skip_all => $reason >>, to make it
1713more compatible with C<< Test::More >>.
1714
1715=item *
1716
1717A new test script, F<op/infnan.t>, has been added to test if Inf and NaN are
1718working correctly. See L</Infinity and NaN (not-a-number) handling improved>.
1719
1720=back
1721
1722=head1 Platform Support
1723
1724=head2 Regained Platforms
1725
1726=over 4
1727
1728=item IRIX and Tru64 platforms are working again.
1729
1730(Some C<make test> failures remain.)
1731
1732=item z/OS running EBCDIC Code Page 1047
1733
1734Core perl now works on this EBCDIC platform. Earlier perls also worked, but,
1735even though support wasn't officially withdrawn, recent perls would not compile
1736and run well. Perl 5.20 would work, but had many bugs which have now been
1737fixed. Many CPAN modules that ship with Perl still fail tests, including
1738Pod::Simple. However the version of Pod::Simple currently on CPAN should work;
1739it was fixed too late to include in Perl 5.22. Work is under way to fix many
1740of the still-broken CPAN modules, which likely will be installed on CPAN when
1741completed, so that you may not have to wait until Perl 5.24 to get a working
1742version.
1743
1744=back
1745
1746=head2 Discontinued Platforms
1747
1748=over 4
1749
1750=item NeXTSTEP/OPENSTEP
1751
1752NeXTSTEP was proprietary OS bundled with NeXT's workstations in the early
1753to mid 90's; OPENSTEP was an API specification that provided a NeXTSTEP-like
1754environment on a non-NeXTSTEP system. Both are now long dead, so support
1755for building Perl on them has been removed.
1756
1757=back
1758
1759=head2 Platform-Specific Notes
1760
1761=over 4
1762
1763=item EBCDIC
1764
1765Special handling is required on EBCDIC platforms to get C<qr/[i-j]/> to
1766match only C<"i"> and C<"j">, since there are 7 characters between the
1767code points for C<"i"> and C<"j">. This special handling had only been
1768invoked when both ends of the range are literals. Now it is also
1769invoked if any of the C<\N{...}> forms for specifying a character by
1770name or Unicode code point is used instead of a literal. See
1771L<perlrecharclass/Character Ranges>.
1772
1773=item HP-UX
1774
1775The archname now distinguishes use64bitint from use64bitall.
1776
1777=item Android
1778
1779Build support has been improved for cross-compiling in general and for
1780Android in particular.
1781
1782=item VMS
1783
1784=over 4
1785
1786=item *
1787
1788When spawning a subprocess without waiting, the return value is now
1789the correct PID.
1790
1791=item *
1792
1793Fix a prototype so linking doesn't fail under the VMS C++ compiler.
1794
1795=item *
1796
1797C<finite>, C<finitel>, and C<isfinite> detection has been added to
1798C<configure.com>, environment handling has had some minor changes, and
1799a fix for legacy feature checking status.
1800
1801=back
1802
1803=item Win32
1804
1805=over 4
1806
1807=item *
1808
1809F<miniperl.exe> is now built with C<-fno-strict-aliasing>, allowing 64-bit
1810builds to complete on GCC 4.8.
1811L<[perl #123976]|https://rt.perl.org/Ticket/Display.html?id=123976>
1812
1813=item *
1814
1815C<test-prep> again depends on C<test-prep-gcc> for GCC builds.
1816L<[perl #124221]|https://rt.perl.org/Ticket/Display.html?id=124221>
1817
1818=item *
1819
1820Perl can now be built in C++ mode on Windows by setting the makefile macro
1821C<USE_CPLUSPLUS> to the value "define".
1822
1823=item *
1824
1825List form pipe open no longer falls back to the shell.
1826
1827=item *
1828
1829In release 5.21.8 compiling on VC with dmake was broken. Fixed.
1830
1831=item *
1832
1833New C<DebugSymbols> and C<DebugFull> configuration options added to
1834Windows makefiles.
1835
1836=item *
1837
1838L<B> now compiles again on Windows.
1839
1840=item *
1841
1842Previously, on Visual C++ for Win64 built Perls only, when compiling every Perl
1843XS module (including CPAN ones) and Perl aware .c file with a 64 bit Visual C++,
1844would unconditionally have around a dozen warnings from hv_func.h. These
1845warnings have been silenced. GCC all bitness and Visual C++ for Win32 were
1846not affected.
1847
1848=item *
1849
1850Support for building without PerlIO has been removed from the Windows
1851makefiles. Non-PerlIO builds were all but deprecated in Perl 5.18.0 and are
1852already not supported by F<Configure> on POSIX systems.
1853
1854=item *
1855
1856Between 2 and 6 ms and 7 I/O calls have been saved per attempt to open a perl
1857module for each path in C<@INC>.
1858
1859=item *
1860
1861Intel C builds are now always built with C99 mode on.
1862
1863=item *
1864
1865C<%I64d> is now being used instead of C<%lld> for MinGW.
1866
1867=item *
1868
1869In the experimental C<:win32> layer, a crash in C<open> was fixed. Also
1870opening C</dev/null>, which works the Win32 Perl's normal C<:unix> layer, was
1871implemented for C<:win32>.
1872L<[perl #122224]|https://rt.perl.org/Ticket/Display.html?id=122224>
1873
1874=item *
1875
1876A new makefile option, C<USE_LONG_DOUBLE>, has been added to the Windows
1877dmake makefile for gcc builds only. Set this to "define" if you want perl to
1878use long doubles to give more accuracy and range for floating point numbers.
1879
1880=back
1881
1882=item OpenBSD
1883
1884On OpenBSD, Perl will now default to using the system C<malloc> due to the
1885security features it provides. Perl's own malloc wrapper has been in use
1886since v5.14 due to performance reasons, but the OpenBSD project believes
1887the tradeoff is worth it and would prefer that users who need the speed
1888specifically ask for it.
1889
1890L<[perl #122000]|https://rt.perl.org/Ticket/Display.html?id=122000>.
1891
1892=item Solaris
1893
1894=over 4
1895
1896=item *
1897
1898We now look for the Sun Studio compiler in both F</opt/solstudio*> and
1899F</opt/solarisstudio*>.
1900
1901=item *
1902
1903Builds on Solaris 10 with C<-Dusedtrace> would fail early since make
1904didn't follow implied dependencies to build C<perldtrace.h>. Added an
1905explicit dependency to C<depend>.
1906L<[perl #120120]|https://rt.perl.org/Ticket/Display.html?id=120120>
1907
1908=item *
1909
1910C<c99> options have been cleaned up, hints look for C<solstudio>
1911as well as C<SUNWspro>, and support for native C<setenv> has been added.
1912
1913=back
1914
1915=back
1916
1917=head1 Internal Changes
1918
1919=over 4
1920
1921=item *
1922
bad0181b
DM
1923Experimental support has been added to allow ops in the optree to locate
1924their parent, if any. This is enabled by the non-default build option
1925C<-DPERL_OP_PARENT>. It is envisaged that this will eventually become
1926enabled by default, so XS code which directly accesses the C<op_silbing>
1927field of ops should be updated to be future-proofed.
eabfc7bc
RS
1928
1929On C<PERL_OP_PARENT> builds, the C<op_sibling> field has been renamed
bad0181b
DM
1930C<op_sibparent> and a new flag, C<op_moresib>, added. On the last op in a
1931sibling chain, C<op_moresib> is false and C<op_sibparent> points to the
1932parent (if any) rather than to being C<NULL>.
1933
1934To make existing code work transparently whether using C<-DPERL_OP_PARENT>
1935or not, a number of new macros and functions have been added that should
1936be used, rather than directly manipulating C<op_sibling>.
1937
1938For the case of just reading C<op_sibling> to determine the next sibling,
1939two new macros have been added. A simple scan through a sibling chain
1940like this:
1941
1942 for (; kid->op_sibling; kid = kid->op_sibling) { ... }
1943
1944should now be written as:
1945
1946 for (; OpHAS_SIBLING(kid); kid = OpSIBLING(kid)) { ... }
1947
1948For altering optrees, A general-purpose function C<op_sibling_splice()>
1949has been added, which allows for manipulation of a chain of sibling ops.
1950By analogy with the Perl function C<splice()>, it allows you to cut out
1951zero or more ops from a sibling chain and replace them with zero or more
1952new ops. It transparently handles all the updating of sibling, parent,
1953op_last pointers etc.
1954
1955If you need to manipulate ops at a lower level, then three new macros,
1956C<OpMORESIB_set>, C<OpLASTSIB_set> and C<OpMAYBESIB_set> are intended to
1957be a low-level portable way to set C<op_sibling> / C<op_sibparent> while
1958also updating C<op_moresib>. The first sets the sibling pointer to a new
1959sibling, the second makes the op the last sibling, and the third
1960conditionally does the first or second action. Note that unlike
1961C<op_sibling_splice()> these macros won't maintain consistency in the
1962parent at the same time (e.g. by updating C<op_first> and C<op_last> where
1963appropriate).
1964
1965A C-level C<Perl_op_parent()> function and a perl-level C<B::OP::parent()>
1966method have been added. The C function only exists under
1967C<-DPERL_OP_PARENT> builds (using it is build-time error on vanilla
1968perls). C<B::OP::parent()> exists always, but on a vanilla build it
1969always returns C<NULL>. Under C<-DPERL_OP_PARENT>, they return the parent
1970of the current op, if any. The variable C<$B::OP::does_parent> allows you
1971to determine whether C<B> supports retrieving an op's parent.
1972
1973C<-DPERL_OP_PARENT> was introduced in 5.21.2, but the interface was
1974changed considerably in 5.21.11. If you updated your code before the
19755.21.11 changes, it may require further revision. The main changes after
19765.21.2 were:
eabfc7bc 1977
bad0181b 1978=over 4
eabfc7bc
RS
1979
1980=item *
1981
bad0181b
DM
1982The C<OP_SIBLING> and C<OP_HAS_SIBLING> macros have been renamed
1983C<OpSIBLING> and C<OpHAS_SIBLING> for consistency with other
1984op-manipulating macros.
eabfc7bc
RS
1985
1986=item *
1987
bad0181b
DM
1988The C<op_lastsib> field has been renamed C<op_moresib>, and its meaning
1989inverted.
eabfc7bc
RS
1990
1991=item *
1992
bad0181b
DM
1993The macro C<OpSIBLING_set> has been removed, and has been superseded by
1994C<OpMORESIB_set> et al.
eabfc7bc
RS
1995
1996=item *
1997
bad0181b
DM
1998The C<op_sibling_splice()> function now accepts a null C<parent> argument
1999where the splicing doesn't affect the first or last ops in the sibling
2000chain
eabfc7bc
RS
2001
2002=back
2003
2004=item *
2005
2006Macros have been created to allow XS code to better manipulate the POSIX locale
2007category C<LC_NUMERIC>. See L<perlapi/Locale-related functions and macros>.
2008
2009=item *
2010
2011The previous C<atoi> et al replacement function, C<grok_atou>, has now been
2012superseded by C<grok_atoUV>. See L<perlclib> for details.
2013
2014=item *
2015
2016Added Perl_sv_get_backrefs() to determine if an SV is a weak-referent.
2017
2018Function either returns an SV * of type AV, which contains the set of
2019weakreferences which reference the passed in SV, or a simple RV * which
2020is the only weakref to this item.
2021
2022=item *
2023
2024C<screaminstr> has been removed. Although marked as public API, it is
2025undocumented and has no usage in modern perl versions on CPAN Grep. Calling it
2026has been fatal since 5.17.0.
2027
2028=item *
2029
2030C<newDEFSVOP>, C<block_start>, C<block_end> and C<intro_my> have been added
2031to the API.
2032
2033=item *
2034
2035The internal C<convert> function in F<op.c> has been renamed
2036C<op_convert_list> and added to the API.
2037
2038=item *
2039
2040C<sv_magic> no longer forbids "ext" magic on read-only values. After all,
2041perl can't know whether the custom magic will modify the SV or not.
2042[perl #123103]
2043
2044=item *
2045
2046Starting in 5.21.6, accessing L<perlapi/CvPADLIST> in an XSUB is forbidden.
2047CvPADLIST has be reused for a different internal purpose for XSUBs. Guard all
2048CvPADLIST expressions with C<CvISXSUB()> if your code doesn't already block
2049XSUB CV*s from going through optree CV* expecting code.
2050
2051=item *
2052
2053SVs of type SVt_NV are now bodyless when a build configure and platform allow
2054it, specifically C<sizeof(NV) <= sizeof(IV)>. The bodyless trick is the same one
2055as for IVs since 5.9.2, but for NVs, unlike IVs, is not guaranteed on all
2056platforms and build configurations.
2057
2058=item *
2059
2060The C<$DB::single>, C<$DB::signal> and C<$DB::trace> now have set and
2061get magic that stores their values as IVs and those IVs are used when
2062testing their values in C<pp_dbstate>. This prevents perl from
2063recursing infinity if an overloaded object is assigned to any of those
2064variables. [perl #122445]
2065
2066=item *
2067
2068C<Perl_tmps_grow> which is marked as public API but undocumented has been
2069removed from public API. If you use C<EXTEND_MORTAL> macro in your XS code to
2070preextend the mortal stack, you are unaffected by this change.
2071
2072=item *
2073
2074C<cv_name>, which was introduced in 5.21.4, has been changed incompatibly.
2075It now has a flags field that allows the caller to specify whether the name
2076should be fully qualified. See L<perlapi/cv_name>.
2077
2078=item *
2079
2080Internally Perl no longer uses the C<SVs_PADMY> flag. C<SvPADMY()> now
2081returns a true value for anything not marked PADTMP. C<SVs_PADMY> is now
2082defined as 0.
2083
2084=item *
2085
2086The macros SETsv and SETsvUN have been removed. They were no longer used
2087in the core since commit 6f1401dc2a, and have not been found present on
2088CPAN.
2089
2090=item *
2091
2092The C<< SvFAKE >> bit (unused on HVs) got informally reserved by
2093David Mitchell for future work on vtables.
2094
2095=item *
2096
2097The C<sv_catpvn_flags> function accepts C<SV_CATBYTES> and C<SV_CATUTF8>
2098flags, which specify whether the appended string is bytes or utf8,
2099respectively.
2100
2101=item *
2102
2103A new opcode class, C<< METHOP >> has been introduced, which holds
2104class/method related info needed at runtime to improve performance
2105of class/object method calls.
2106
2107C<< OP_METHOD >> and C<< OP_METHOD_NAMED >> are moved from being
2108C<< UNOP/SVOP >> to being C<< METHOP >>.
2109
2110=item *
2111
2112C<save_re_context> no longer does anything and has been moved to F<mathoms.c>.
2113
2114=item *
2115
2116C<cv_name> is a new API function that can be passed a CV or GV. It returns an
2117SV containing the name of the subroutine for use in diagnostics.
2118L<[perl #116735]|https://rt.perl.org/Ticket/Display.html?id=116735>
2119L<[perl #120441]|https://rt.perl.org/Ticket/Display.html?id=120441>
2120
2121=item *
2122
2123C<cv_set_call_checker_flags> is a new API function that works like
2124C<cv_set_call_checker>, except that it allows the caller to specify whether the
2125call checker requires a full GV for reporting the subroutine's name, or whether
2126it could be passed a CV instead. Whatever value is passed will be acceptable
2127to C<cv_name>. C<cv_set_call_checker> guarantees there will be a GV, but it
2128may have to create one on the fly, which is inefficient.
2129L<[perl #116735]|https://rt.perl.org/Ticket/Display.html?id=116735>
2130
2131=item *
2132
2133C<CvGV> (which is not part of the API) is now a more complex macro, which may
2134call a function and reify a GV. For those cases where is has been used as a
2135boolean, C<CvHASGV> has been added, which will return true for CVs that
2136notionally have GVs, but without reifying the GV. C<CvGV> also returns a GV
2137now for lexical subs.
2138L<[perl #120441]|https://rt.perl.org/Ticket/Display.html?id=120441>
2139
2140=item *
2141
2142Added L<perlapi/sync_locale>. Changing the program's locale should be avoided
2143by XS code. Nevertheless, certain non-Perl libraries called from XS, such as
2144C<Gtk> do so. When this happens, Perl needs to be told that the locale has
2145changed. Use this function to do so, before returning to Perl.
2146
2147=item *
2148
2149The defines and labels for the flags in the C<op_private> field of OPs are now
2150auto-generated from data in F<regen/op_private>. The noticeable effect of this
2151is that some of the flag output of C<Concise> might differ slightly, and the
2152flag output of C<perl -Dx> may differ considerably (they both use the same set
2153of labels now). Also in debugging builds, there is a new assert in
2154C<op_free()> that checks that the op doesn't have any unrecognized flags set in
2155C<op_private>.
2156
2157=item *
2158
2159Added L<perlapi/sync_locale>.
2160Changing the program's locale should be avoided by XS code. Nevertheless,
2161certain non-Perl libraries called from XS, such as C<Gtk> do so. When this
2162happens, Perl needs to be told that the locale has changed. Use this function
2163to do so, before returning to Perl.
2164
2165=item *
2166
2167The deprecated variable C<PL_sv_objcount> has been removed.
2168
2169=item *
2170
2171Perl now tries to keep the locale category C<LC_NUMERIC> set to "C"
2172except around operations that need it to be set to the program's
2173underlying locale. This protects the many XS modules that cannot cope
2174with the decimal radix character not being a dot. Prior to this
2175release, Perl initialized this category to "C", but a call to
2176C<POSIX::setlocale()> would change it. Now such a call will change the
2177underlying locale of the C<LC_NUMERIC> category for the program, but the
2178locale exposed to XS code will remain "C". There is an API under
2179development for those relatively few modules that need to use the
2180underlying locale. This API will be nailed down during the course of
2181developing v5.21. Send email to L<mailto:perl5-porters@perl.org> for
2182guidance.
2183
2184=item *
2185
2186A new macro L<C<isUTF8_CHAR>|perlapi/isUTF8_CHAR> has been written which
2187efficiently determines if the string given by its parameters begins
2188with a well-formed UTF-8 encoded character.
2189
2190=item *
2191
2192The following private API functions had their context parameter removed,
2193C<Perl_cast_ulong>, C<Perl_cast_i32>, C<Perl_cast_iv>, C<Perl_cast_uv>,
2194C<Perl_cv_const_sv>, C<Perl_mg_find>, C<Perl_mg_findext>, C<Perl_mg_magical>,
2195C<Perl_mini_mktime>, C<Perl_my_dirfd>, C<Perl_sv_backoff>, C<Perl_utf8_hop>.
2196
2197Users of the public API prefix-less calls remain unaffected.
2198
2199=item *
2200
eabfc7bc
RS
2201The PADNAME and PADNAMELIST types are now separate types, and no longer
2202simply aliases for SV and AV. [perl #123223]
2203
2204=item *
2205
2206Pad names are now always UTF8. The C<PadnameUTF8> macro always returns
2207true. Previously, this was effectively the case already, but any support
2208for two different internal representations of pad names has now been
2209removed.
2210
2211=item *
2212
eabfc7bc
RS
2213A new op class, C<UNOP_AUX>, has been added. This is a subclass of
2214C<UNOP> with an C<op_aux> field added, which points to an array of unions
2215of C<UV>, C<SV*> etc. It is intended for where an op needs to store more data
2216than a simple C<op_sv> or whatever. Currently the only op of this type is
2217C<OP_MULTIDEREF> (see below).
2218
2219=item *
2220
2221A new op has been added, C<OP_MULTIDEREF>, which performs one or more
2222nested array and hash lookups where the key is a constant or simple
2223variable. For example the expression C<$a[0]{$k}[$i]>, which previously
2224involved ten C<rv2Xv>, C<Xelem>, C<gvsv> and C<const> ops is now performed
2225by a single C<multideref> op. It can also handle C<local>, C<exists> and
2226C<delete>. A non-simple index expression, such as C<[$i+1]> is still done
77c2376a 2227using C<aelem>/C<helem>, and single-level array lookup with a small constant
eabfc7bc
RS
2228index is still done using C<aelemfast>.
2229
2230=back
2231
2232=head1 Selected Bug Fixes
2233
2234=over 4
2235
2236=item *
2237
2238C<pack("D", $x)> and C<pack("F", $x)> now zero the padding on x86 long double
2239builds. GCC 4.8 and later, under some build options, would either overwrite
2240the zero-initialized padding, or bypass the initialized buffer entirely. This
2241caused F<op/pack.t> to fail.
2242L<[perl #123971]|https://rt.perl.org/Ticket/Display.html?id=123971>
2243
2244=item *
2245
2246Extending an array cloned from a parent thread could result in "Modification of
2247a read-only value attempted" errors when attempting to modify the new elements.
2248L<[perl #124127]|https://rt.perl.org/Ticket/Display.html?id=124127>
2249
2250=item *
2251
2252An assertion failure and subsequent crash with C<< *x=<y> >> has been fixed.
2253L<[perl #123790]|https://rt.perl.org/Ticket/Display.html?id=123790>
2254
2255=item *
2256
2257An optimization for state variable initialization introduced in Perl 5.21.6 has
2258been reverted because it was found to exacerbate some other existing buggy
2259behaviour.
2260L<[perl #124160]|https://rt.perl.org/Ticket/Display.html?id=124160>
2261
2262=item *
2263
2264The extension of another optimization to cover more ops in Perl 5.21 has also
2265been reverted to its Perl 5.20 state as a temporary fix for regression issues
2266that it caused.
2267L<[perl #123790]|https://rt.perl.org/Ticket/Display.html?id=123790>
2268
2269=item *
2270
2271New bitwise ops added in Perl 5.21.9 accidentally caused C<$^H |= 0x1c020000>
2272to enable all features. This has now been fixed.
2273
2274=item *
2275
2276A possible crashing/looping bug has been fixed.
2277L<[perl #124099]|https://rt.perl.org/Ticket/Display.html?id=124099>
2278
2279=item *
2280
2281UTF-8 variable names used in array indexes, unquoted UTF-8 HERE-document
2282terminators and UTF-8 function names all now work correctly.
2283L<[perl #124113]|https://rt.perl.org/Ticket/Display.html?id=124113>
2284
2285=item *
2286
2287Repeated global pattern matches in scalar context on large tainted strings were
2288exponentially slow depending on the current match position in the string.
2289L<[perl #123202]|https://rt.perl.org/Ticket/Display.html?id=123202>
2290
2291=item *
2292
2293Various crashes due to the parser getting confused by syntax errors have been
2294fixed.
2295L<[perl #123801]|https://rt.perl.org/Ticket/Display.html?id=123801>
2296L<[perl #123802]|https://rt.perl.org/Ticket/Display.html?id=123802>
2297L<[perl #123955]|https://rt.perl.org/Ticket/Display.html?id=123955>
2298L<[perl #123995]|https://rt.perl.org/Ticket/Display.html?id=123995>
2299
2300=item *
2301
2302C<split> in the scope of lexical $_ has been fixed not to fail assertions.
2303L<[perl #123763]|https://rt.perl.org/Ticket/Display.html?id=123763>
2304
2305=item *
2306
2307C<my $x : attr> syntax inside various list operators no longer fails
2308assertions.
2309L<[perl #123817]|https://rt.perl.org/Ticket/Display.html?id=123817>
2310
2311=item *
2312
2313An @ sign in quotes followed by a non-ASCII digit (which is not a valid
2314identifier) would cause the parser to crash, instead of simply trying the @ as
2315literal. This has been fixed.
2316L<[perl #123963]|https://rt.perl.org/Ticket/Display.html?id=123963>
2317
2318=item *
2319
2320C<*bar::=*foo::=*glob_with_hash> has been crashing since Perl 5.14, but no
2321longer does.
2322L<[perl #123847]|https://rt.perl.org/Ticket/Display.html?id=123847>
2323
2324=item *
2325
2326C<foreach> in scalar context was not pushing an item on to the stack, resulting
2327in bugs. (C<print 4, scalar do { foreach(@x){} } + 1> would print 5.) It has
2328been fixed to return C<undef>.
2329L<[perl #124004]|https://rt.perl.org/Ticket/Display.html?id=124004>
2330
2331=item *
2332
2333A memory leak introduced in Perl 5.21.6 has been fixed.
2334L<[perl #123922]|https://rt.perl.org/Ticket/Display.html?id=123922>
2335
2336=item *
2337
2338A regression in the behaviour of the C<readline> built-in function, caused by
2339the introduction of the C<< <<>> >> operator, has been fixed.
2340L<[perl #123990]|https://rt.perl.org/Ticket/Display.html?id=123990>
2341
2342=item *
2343
2344Several cases of data used to store environment variable contents in core C
2345code being potentially overwritten before being used have been fixed.
2346L<[perl #123748]|https://rt.perl.org/Ticket/Display.html?id=123748>
2347
2348=item *
2349
2350Patterns starting with C</.*/> are now fast again. [rt.perl.org #123743]
2351
2352=item *
2353
2354The original visible value of C<$/> is now preserved when it is set to
2355an invalid value. Previously if you set C<$/> to a reference to an
2356array, for example, perl would produce a runtime error and not set
2357C<PL_rs>, but perl code that checked C<$/> would see the array
2358reference. [rt.perl.org #123218]
2359
2360=item *
2361
2362In a regular expression pattern, a POSIX class, like C<[:ascii:]>, must
2363be inside a bracketed character class, like C</qr[[:ascii:]]>. A
2364warning is issued when something looking like a POSIX class is not
2365inside a bracketed class. That warning wasn't getting generated when
2366the POSIX class was negated: C<[:^ascii:]>. This is now fixed.
2367
2368=item *
2369
2370Fix a couple of other size calculation overflows. [rt.perl.org #123554]
2371
2372=item *
2373
2374A bug introduced in 5.21.6, C<dump LABEL> acted the same as C<goto
2375LABEL>. This has been fixed. [rt.perl.org #123836]
2376
2377=item *
2378
2379Perl 5.14.0 introduced a bug whereby C<eval { LABEL: }> would crash. This
2380has been fixed. [rt.perl.org #123652]
2381
2382=item *
2383
2384Various crashes due to the parser getting confused by syntax errors have
2385been fixed. [rt.perl.org #123617] [rt.perl.org #123737]
2386[rt.perl.org #123753] [rt.perl.org #123677]
2387
2388=item *
2389
2390Code like C</$a[/> used to read the next line of input and treat it as
2391though it came immediately after the opening bracket. Some invalid code
2392consequently would parse and run, but some code caused crashes, so this is
2393now disallowed. [rt.perl.org #123712]
2394
2395=item *
2396
2397Fix argument underflow for C<pack>. [rt.perl.org #123874]
2398
2399=item *
2400
2401Fix handling of non-strict C<\x{}>. Now C<\x{}> is equivalent to C<\x{0}>
2402instead of faulting.
2403
2404=item *
2405
2406C<stat -t> is now no longer treated as stackable, just like C<-t stat>.
2407[rt.perl.org #123816]
2408
2409=item *
2410
2411The following no longer causes a SEGV: C<qr{x+(y(?0))*}>.
2412
2413=item *
2414
2415Fixed infinite loop in parsing backrefs in regexp patterns.
2416
2417=item *
2418
2419Several minor bug fixes in behavior of Inf and NaN, including
2420warnings when stringifying Inf-like or NaN-like strings. For example,
2421"NaNcy" doesn't numify to NaN anymore.
2422
2423=item *
2424
2425Only stringy classnames are now shared. This fixes some failures in L<autobox>. [rt.cpan.org #100819]
2426
2427=item *
2428
2429A bug in regular expression patterns that could lead to segfaults and
2430other crashes has been fixed. This occurred only in patterns compiled
2431with C<"/i">, while taking into account the current POSIX locale (this usually
2432means they have to be compiled within the scope of C<S<"use locale">>),
2433and there must be a string of at least 128 consecutive bytes to match.
2434[perl #123539]
2435
2436=item *
2437
2438C<s///> now works on very long strings instead of dying with 'Substitution
2439loop'. [perl #103260] [perl #123071]
2440
2441=item *
2442
2443C<gmtime> no longer crashes with not-a-number values. [perl #123495]
2444
2445=item *
2446
2447C<\()> (reference to an empty list) and C<y///> with lexical $_ in scope
2448could do a bad write past the end of the stack. They have been fixed
2449to extend the stack first.
2450
2451=item *
2452
2453C<prototype()> with no arguments used to read the previous item on the
2454stack, so C<print "foo", prototype()> would print foo's prototype. It has
2455been fixed to infer $_ instead. [perl #123514]
2456
2457=item *
2458
2459Some cases of lexical state subs inside predeclared subs could crash but no
2460longer do.
2461
2462=item *
2463
2464Some cases of nested lexical state subs inside anonymous subs could cause
2465'Bizarre copy' errors or possibly even crash.
2466
2467=item *
2468
2469When trying to emit warnings, perl's default debugger (F<perl5db.pl>) was
2470sometimes giving 'Undefined subroutine &DB::db_warn called' instead. This
2471bug, which started to occur in Perl 5.18, has been fixed. [perl #123553]
2472
2473=item *
2474
2475Certain syntax errors in substitutions, such as C<< s/${E<lt>E<gt>{})// >>, would
2476crash, and had done so since Perl 5.10. (In some cases the crash did not
2477start happening till 5.16.) The crash has, of course, been fixed.
2478[perl #123542]
2479
2480=item *
2481
2482A repeat expression like C<33 x ~3> could cause a large buffer
2483overflow since the new output buffer size was not correctly handled by
2484SvGROW(). An expression like this now properly produces a memory wrap
2485panic. [perl 123554]
2486
2487=item *
2488
2489C<< formline("@...", "a"); >> would crash. The C<FF_CHECKNL> case in
2490pp_formline() didn't set the pointer used to mark the chop position,
2491which led to the C<FF_MORE> case crashing with a segmentation fault.
2492This has been fixed. [perl #123538]
2493
2494=item *
2495
2496A possible buffer overrun and crash when parsing a literal pattern during
2497regular expression compilation has been fixed. [perl #123604]
2498
2499=item *
2500
2501fchmod() and futimes() now set C<$!> when they fail due to being
2502passed a closed file handle. [perl #122703]
2503
2504=item *
2505
2506Perl now comes with a corrected Unicode 7.0 for the erratum issued on
2507October 21, 2014 (see L<http://www.unicode.org/errata/#current_errata>),
2508dealing with glyph shaping in Arabic.
2509
2510=item *
2511
2512op_free() no longer crashes due to a stack overflow when freeing a
2513deeply recursive op tree. [perl #108276]
2514
2515=item *
2516
2517scalarvoid() would crash due to a stack overflow when processing a
2518deeply recursive op tree. [perl #108276]
2519
2520=item *
2521
2522In Perl 5.20.0, C<$^N> accidentally had the internal UTF8 flag turned off
2523if accessed from a code block within a regular expression, effectively
2524UTF8-encoding the value. This has been fixed. [perl #123135]
2525
2526=item *
2527
2528A failed C<semctl> call no longer overwrites existing items on the stack,
2529causing C<(semctl(-1,0,0,0))[0]> to give an "uninitialized" warning.
2530
2531=item *
2532
2533C<else{foo()}> with no space before C<foo> is now better at assigning the
2534right line number to that statement. [perl #122695]
2535
2536=item *
2537
2538Sometimes the assignment in C<@array = split> gets optimised and C<split>
2539itself writes directly to the array. This caused a bug, preventing this
2540assignment from being used in lvalue context. So
2541C<(@a=split//,"foo")=bar()> was an error. (This bug probably goes back to
2542Perl 3, when the optimisation was added.) This optimisation, and the bug,
2543started to happen in more cases in 5.21.5. It has now been fixed.
2544[perl #123057]
2545
2546=item *
2547
2548When argument lists that fail the checks installed by subroutine
2549signatures, the resulting error messages now give the file and line number
2550of the caller, not of the called subroutine. [perl #121374]
2551
2552=item *
2553
2554Flip-flop operators (C<..> and C<...> in scalar context) used to maintain
2555a separate state for each recursion level (the number of times the
2556enclosing sub was called recursively), contrary to the documentation. Now
2557each closure has one internal state for each flip-flop. [perl #122829]
2558
2559=item *
2560
2561C<use>, C<no>, statement labels, special blocks (C<BEGIN>) and pod are now
2562permitted as the first thing in a C<map> or C<grep> block, the block after
2563C<print> or C<say> (or other functions) returning a handle, and within
2564C<${...}>, C<@{...}>, etc. [perl #122782]
2565
2566=item *
2567
2568The repetition operator C<x> now propagates lvalue context to its left-hand
2569argument when used in contexts like C<foreach>. That allows
2570C<for(($#that_array)x2) { ... }> to work as expected if the loop modifies
2571$_.
2572
2573=item *
2574
2575C<(...) x ...> in scalar context used to corrupt the stack if one operand
2576were an object with "x" overloading, causing erratic behaviour.
2577[perl #121827]
2578
2579=item *
2580
2581Assignment to a lexical scalar is often optimised away (as mentioned under
2582L</Performance Enhancements>). Various bugs related to this optimisation
2583have been fixed. Certain operators on the right-hand side would sometimes
2584fail to assign the value at all or assign the wrong value, or would call
2585STORE twice or not at all on tied variables. The operators affected were
2586C<$foo++>, C<$foo-->, and C<-$foo> under C<use integer>, C<chomp>, C<chr>
2587and C<setpgrp>.
2588
2589=item *
2590
2591List assignments were sometimes buggy if the same scalar ended up on both
2592sides of the assignment due to used of C<tied>, C<values> or C<each>. The
2593result would be the wrong value getting assigned.
2594
2595=item *
2596
2597C<setpgrp($nonzero)> (with one argument) was accidentally changed in 5.16
2598to mean C<setpgrp(0)>. This has been fixed.
2599
2600=item *
2601
2602C<__SUB__> could return the wrong value or even corrupt memory under the
2603debugger (the B<-d> switch) and in subs containing C<eval $string>.
2604
2605=item *
2606
2607When C<sub () { $var }> becomes inlinable, it now returns a different
2608scalar each time, just as a non-inlinable sub would, though Perl still
2609optimises the copy away in cases where it would make no observable
2610difference.
2611
2612=item *
2613
2614C<my sub f () { $var }> and C<sub () : attr { $var }> are no longer
2615eligible for inlining. The former would crash; the latter would just
2616throw the attributes away. An exception is made for the little-known
2617":method" attribute, which does nothing much.
2618
2619=item *
2620
2621Inlining of subs with an empty prototype is now more consistent than
2622before. Previously, a sub with multiple statements, all but the last
2623optimised away, would be inlinable only if it were an anonymous sub
2624containing a string C<eval> or C<state> declaration or closing over an
2625outer lexical variable (or any anonymous sub under the debugger). Now any
2626sub that gets folded to a single constant after statements have been
2627optimised away is eligible for inlining. This applies to things like C<sub
2628() { jabber() if DEBUG; 42 }>.
2629
2630Some subroutines with an explicit C<return> were being made inlinable,
2631contrary to the documentation, Now C<return> always prevents inlining.
2632
2633=item *
2634
2635On some systems, such as VMS, C<crypt> can return a non-ASCII string. If a
2636scalar assigned to had contained a UTF8 string previously, then C<crypt>
2637would not turn off the UTF8 flag, thus corrupting the return value. This
2638would happen with C<$lexical = crypt ...>.
2639
2640=item *
2641
2642C<crypt> no longer calls C<FETCH> twice on a tied first argument.
2643
2644=item *
2645
2646An unterminated here-doc on the last line of a quote-like operator
2647(C<qq[${ <<END }]>, C</(?{ <<END })/>) no longer causes a double free. It
2648started doing so in 5.18.
2649
2650=item *
2651
2652Fixed two assertion failures introduced into C<-DPERL_OP_PARENT>
2653builds. [perl #108276]
2654
2655=item *
2656
2657index() and rindex() no longer crash when used on strings over 2GB in
2658size.
2659L<[perl #121562]|https://rt.perl.org/Ticket/Display.html?id=121562>.
2660
2661=item *
2662
2663A small previously intentional memory leak in PERL_SYS_INIT/PERL_SYS_INIT3 on
2664Win32 builds was fixed. This might affect embedders who repeatedly create and
2665destroy perl engines within the same process.
2666
2667=item *
2668
2669C<POSIX::localeconv()> now returns the data for the program's underlying
2670locale even when called from outside the scope of S<C<use locale>>.
2671
2672=item *
2673
2674C<POSIX::localeconv()> now works properly on platforms which don't have
2675C<LC_NUMERIC> and/or C<LC_MONETARY>, or for which Perl has been compiled
2676to disregard either or both of these locale categories. In such
2677circumstances, there are now no entries for the corresponding values in
2678the hash returned by C<localeconv()>.
2679
2680=item *
2681
2682C<POSIX::localeconv()> now marks appropriately the values it returns as
2683UTF-8 or not. Previously they were always returned as a bytes, even if
2684they were supposed to be encoded as UTF-8.
2685
2686=item *
2687
2688On Microsoft Windows, within the scope of C<S<use locale>>, the following
2689POSIX character classes gave results for many locales that did not
2690conform to the POSIX standard:
2691C<[[:alnum:]]>,
2692C<[[:alpha:]]>,
2693C<[[:blank:]]>,
2694C<[[:digit:]]>,
2695C<[[:graph:]]>,
2696C<[[:lower:]]>,
2697C<[[:print:]]>,
2698C<[[:punct:]]>,
2699C<[[:upper:]]>,
2700C<[[:word:]]>,
2701and
2702C<[[:xdigit:]]>.
2703These are because the underlying Microsoft implementation does not
2704follow the standard. Perl now takes special precautions to correct for
2705this.
2706
2707=item *
2708
2709Many issues have been detected by L<Coverity|http://www.coverity.com/> and
2710fixed.
2711
2712=item *
2713
2714system() and friends should now work properly on more Android builds.
2715
2716Due to an oversight, the value specified through -Dtargetsh to Configure
2717would end up being ignored by some of the build process. This caused perls
2718cross-compiled for Android to end up with defective versions of system(),
2719exec() and backticks: the commands would end up looking for C</bin/sh>
2720instead of C</system/bin/sh>, and so would fail for the vast majority
2721of devices, leaving C<$!> as C<ENOENT>.
2722
2723=item *
2724
2725C<qr(...\(...\)...)>,
2726C<qr[...\[...\]...]>,
2727and
2728C<qr{...\{...\}...}>
2729now work. Previously it was impossible to escape these three
2730left-characters with a backslash within a regular expression pattern
2731where otherwise they would be considered metacharacters, and the pattern
2732opening delimiter was the character, and the closing delimiter was its
2733mirror character.
2734
2735=item *
2736
2737C<< s///e >> on tainted utf8 strings got C<< pos() >> messed up. This bug,
2738introduced in 5.20, is now fixed. [RT #122148]
2739
2740=item *
2741
2742A non-word boundary in a regular expression (C<< \B >>) did not always
2743match the end of the string; in particular C<< q{} =~ /\B/ >> did not
2744match. This bug, introduced in perl 5.14, is now fixed. [RT #122090]
2745
2746=item *
2747
2748C<< " P" =~ /(?=.*P)P/ >> should match, but did not. This is now fixed.
2749[RT #122171].
2750
2751=item *
2752
2753Failing to compile C<use Foo> in an eval could leave a spurious
2754C<BEGIN> subroutine definition, which would produce a "Subroutine
2755BEGIN redefined" warning on the next use of C<use>, or other C<BEGIN>
2756block. [perl #122107]
2757
2758=item *
2759
2760C<method { BLOCK } ARGS> syntax now correctly parses the arguments if they
2761begin with an opening brace. [perl #46947]
2762
2763=item *
2764
2765External libraries and Perl may have different ideas of what the locale is.
2766This is problematic when parsing version strings if the locale's numeric
2767separator has been changed. Version parsing has been patched to ensure
2768it handles the locales correctly. [perl #121930]
2769
2770=item *
2771
2772A bug has been fixed where zero-length assertions and code blocks inside of a
2773regex could cause C<pos> to see an incorrect value. [perl #122460]
2774
2775=item *
2776
2777Constant dereferencing now works correctly for typeglob constants. Previously
2778the glob was stringified and its name looked up. Now the glob itself is used.
2779L<[perl #69456]|https://rt.perl.org/Ticket/Display.html?id=69456>
2780
2781=item *
2782
2783When parsing a funny character ($ @ % &) followed by braces, the parser no
2784longer tries to guess whether it is a block or a hash constructor (causing a
2785syntax error when it guesses the latter), since it can only be a block.
2786
2787=item *
2788
2789C<undef $reference> now frees the referent immediately, instead of hanging on
2790to it until the next statement.
2791L<[perl #122556]|https://rt.perl.org/Ticket/Display.html?id=122556>
2792
2793=item *
2794
2795Various cases where the name of a sub is used (autoload, overloading, error
2796messages) used to crash for lexical subs, but have been fixed.
2797
2798=item *
2799
2800Bareword lookup now tries to avoid vivifying packages if it turns out the
2801bareword is not going to be a subroutine name.
2802
2803=item *
2804
2805Compilation of anonymous constants (e.g., C<sub () { 3 }>) no longer deletes
2806any subroutine named C<__ANON__> in the current package. Not only was
2807C<*__ANON__{CODE}> cleared, but there was a memory leak, too. This bug goes
2808back to Perl 5.8.0.
2809
2810=item *
2811
2812Stub declarations like C<sub f;> and C<sub f ();> no longer wipe out constants
2813of the same name declared by C<use constant>. This bug was introduced in Perl
28145.10.0.
2815
2816=item *
2817
2818Under some conditions a warning raised in compilation of regular expression
2819patterns could be displayed multiple times. This is now fixed.
2820
2821=item *
2822
2823C<qr/[\N{named sequence}]/> now works properly in many instances. Some names
2824known to C<\N{...}> refer to a sequence of multiple characters, instead of the
2825usual single character. Bracketed character classes generally only match
2826single characters, but now special handling has been added so that they can
2827match named sequences, but not if the class is inverted or the sequence is
2828specified as the beginning or end of a range. In these cases, the only
2829behavior change from before is a slight rewording of the fatal error message
2830given when this class is part of a C<?[...])> construct. When the C<[...]>
2831stands alone, the same non-fatal warning as before is raised, and only the
2832first character in the sequence is used, again just as before.
2833
2834=item *
2835
2836Tainted constants evaluated at compile time no longer cause unrelated
2837statements to become tainted.
2838L<[perl #122669]|https://rt.perl.org/Ticket/Display.html?id=122669>
2839
2840=item *
2841
2842C<open $$fh, ...>, which vivifies a handle with a name like "main::_GEN_0", was
2843not giving the handle the right reference count, so a double free could happen.
2844
2845=item *
2846
2847When deciding that a bareword was a method name, the parser would get confused
2848if an "our" sub with the same name existed, and look up the method in the
2849package of the "our" sub, instead of the package of the invocant.
2850
2851=item *
2852
2853The parser no longer gets confused by C<\U=> within a double-quoted string. It
2854used to produce a syntax error, but now compiles it correctly.
2855L<[perl #80368]|https://rt.perl.org/Ticket/Display.html?id=80368>
2856
2857=item *
2858
2859It has always been the intention for the C<-B> and C<-T> file test operators to
2860treat UTF-8 encoded files as text. (L<perlfunc|perlfunc/-X FILEHANDLE> has
2861been updated to say this.) Previously, it was possible for some files to be
2862considered UTF-8 that actually weren't valid UTF-8. This is now fixed. The
2863operators now work on EBCDIC platforms as well.
2864
2865=item *
2866
2867Under some conditions warning messages raised during regular expression pattern
2868compilation were being output more than once. This has now been fixed.
2869
2870=item *
2871
2872A regression has been fixed that was introduced in Perl 5.20.0 (fixed in Perl
28735.20.1 as well as here) in which a UTF-8 encoded regular expression pattern
2874that contains a single ASCII lowercase letter does not match its uppercase
2875counterpart.
2876L<[perl #122655]|https://rt.perl.org/Ticket/Display.html?id=122655>
2877
2878=item *
2879
2880Constant folding could incorrectly suppress warnings if lexical warnings (C<use
2881warnings> or C<no warnings>) were not in effect and C<$^W> were false at
2882compile time and true at run time.
2883
2884=item *
2885
2886Loading UTF8 tables during a regular expression match could cause assertion
2887failures under debugging builds if the previous match used the very same
2888regular expression.
2889L<[perl #122747]|https://rt.perl.org/Ticket/Display.html?id=122747>
2890
2891=item *
2892
2893Thread cloning used to work incorrectly for lexical subs, possibly causing
2894crashes or double frees on exit.
2895
2896=item *
2897
2898Since Perl 5.14.0, deleting C<$SomePackage::{__ANON__}> and then undefining an
2899anonymous subroutine could corrupt things internally, resulting in
2900L<Devel::Peek> crashing or L<B.pm|B> giving nonsensical data. This has been
2901fixed.
2902
2903=item *
2904
2905C<(caller $n)[3]> now reports names of lexical subs, instead of treating them
2906as "(unknown)".
2907
2908=item *
2909
2910C<sort subname LIST> now supports lexical subs for the comparison routine.
2911
2912=item *
2913
2914Aliasing (e.g., via C<*x = *y>) could confuse list assignments that mention the
2915two names for the same variable on either side, causing wrong values to be
2916assigned.
2917L<[perl #15667]|https://rt.perl.org/Ticket/Display.html?id=15667>
2918
2919=item *
2920
2921Long here-doc terminators could cause a bad read on short lines of input. This
2922has been fixed. It is doubtful that any crash could have occurred. This bug
2923goes back to when here-docs were introduced in Perl 3.000 twenty-five years
2924ago.
2925
2926=item *
2927
2928An optimization in C<split> to treat C<split/^/> like C<split/^/m> had the
2929unfortunate side-effect of also treating C<split/\A/> like C<split/^/m>, which
2930it should not. This has been fixed. (Note, however, that C<split/^x/> does
2931not behave like C<split/^x/m>, which is also considered to be a bug and will be
2932fixed in a future version.)
2933L<[perl #122761]|https://rt.perl.org/Ticket/Display.html?id=122761>
2934
2935=item *
2936
2937The little-known C<my Class $var> syntax (see L<fields> and L<attributes>)
2938could get confused in the scope of C<use utf8> if C<Class> were a constant
2939whose value contained Latin-1 characters.
2940
2941=item *
2942
2943Locking and unlocking values via L<Hash::Util> or C<Internals::SvREADONLY>
2944no longer has any effect on values that are read-only to begin.
2945Previously, unlocking such values could result in crashes, hangs or
2946other erratic behaviour.
2947
2948=item *
2949
2950The internal C<looks_like_number> function (which L<Scalar::Util> provides
2951access to) began erroneously to return true for "-e1" in 5.21.4, affecting
2952also C<-'-e1'>. This has been fixed.
2953
2954=item *
2955
2956The flip-flop operator (C<..> in scalar context) would return the same
2957scalar each time, unless the containing subroutine was called recursively.
2958Now it always returns a new scalar. [perl #122829]
2959
2960=item *
2961
2962Some unterminated C<(?(...)...)> constructs in regular expressions would
2963either crash or give erroneous error messages. C</(?(1)/> is one such
2964example.
2965
2966=item *
2967
2968C<pack "w", $tied> no longer calls FETCH twice.
2969
2970=item *
2971
2972List assignments like C<($x, $z) = (1, $y)> now work correctly if $x and $y
2973have been aliased by C<foreach>.
2974
2975=item *
2976
2977Some patterns including code blocks with syntax errors, such as
2978C</ (?{(^{})/>, would hang or fail assertions on debugging builds. Now
2979they produce errors.
2980
2981=item *
2982
2983An assertion failure when parsing C<sort> with debugging enabled has been
2984fixed. [perl #122771]
2985
2986=item *
2987
2988C<*a = *b; @a = split //, $b[1]> could do a bad read and produce junk
2989results.
2990
2991=item *
2992
2993In C<() = @array = split>, the C<() => at the beginning no longer confuses
2994the optimizer, making it assume a limit of 1.
2995
2996=item *
2997
2998Fatal warnings no longer prevent the output of syntax errors.
2999[perl #122966]
3000
3001=item *
3002
3003Fixed a NaN double to long double conversion error on VMS. For quiet NaNs
3004(and only on Itanium, not Alpha) negative infinity instead of NaN was
3005produced.
3006
3007=item *
3008
3009Fixed the issue that caused C<< make distclean >> to leave files behind
3010that shouldn't. [perl #122820]
3011
3012=item *
3013
3014AIX now sets the length in C<< getsockopt >> correctly. [perl #120835],
3015[rt #91183], [rt #85570].
3016
3017=item *
3018
3019During the pattern optimization phase, we no longer recurse into
3020GOSUB/GOSTART when not SCF_DO_SUBSTR. This prevents the optimizer
3021to run "forever" and exhaust all memory. [perl #122283]
3022
3023=item *
3024
3025F<< t/op/crypt.t >> now performs SHA-256 algorithm if the default one
3026is disabled. [perl #121591]
3027
3028=item *
3029
3030Fixed an off-by-one error when setting the size of shared array.
3031[perl #122950]
3032
3033=item *
3034
3035Fixed a bug that could cause perl to execute an infinite loop during
3036compilation. [perl #122995]
3037
3038=item *
3039
3040On Win32, restoring in a child pseudo-process a variable that was
3041C<local()>ed in a parent pseudo-process before the C<fork> happened caused
3042memory corruption and a crash in the child pseudo-process (and therefore OS
3043process). [perl #40565]
3044
3045=item *
3046
3047Calling C<write> on a format with a C<^**> field could produce a panic
3048in sv_chop() if there were insufficient arguments or if the variable
3049used to fill the field was empty. [perl #123245]
3050
3051=item *
3052
3053Non-ASCII lexical sub names (use in error messages) on longer have extra
3054junk on the end.
3055
3056=item *
3057
3058The C<\@> subroutine prototype no longer flattens parenthesized arrays
3059(taking a reference to each element), but takes a reference to the array
3060itself. [perl #47363]
3061
3062=item *
3063
3064A block containing nothing except a C-style C<for> loop could corrupt the
3065stack, causing lists outside the block to lose elements or have elements
3066overwritten. This could happen with C<map { for(...){...} } ...> and with
3067lists containing C<do { for(...){...} }>. [perl #123286]
3068
3069=item *
3070
3071C<scalar()> now propagates lvalue context, so that
3072C<for(scalar($#foo)) { ... }> can modify C<$#foo> through C<$_>.
3073
3074=item *
3075
3076C<qr/@array(?{block})/> no longer dies with "Bizarre copy of ARRAY".
3077[#123344]
3078
3079=item *
3080
3081C<eval '$variable'> in nested named subroutines would sometimes look up a
3082global variable even with a lexical variable in scope.
3083
3084=item *
3085
3086In perl 5.20.0, C<sort CORE::fake> where 'fake' is anything other than a
3087keyword started chopping of the last 6 characters and treating the result
3088as a sort sub name. The previous behaviour of treating "CORE::fake" as a
3089sort sub name has been restored. [perl #123410]
3090
3091=item *
3092
3093Outside of C<use utf8>, a single-character Latin-1 lexical variable is
3094disallowed. The error message for it, "Can't use global $foo...", was
3095giving garbage instead of the variable name.
3096
3097=item *
3098
3099C<readline> on a nonexistent handle was causing C<${^LAST_FH}> to produce a
3100reference to an undefined scalar (or fail an assertion). Now
3101C<${^LAST_FH}> ends up undefined.
3102
3103=item *
3104
3105C<(...)x...> in void context now applies scalar context to the left-hand
3106argument, instead of the context the current sub was called in.
3107[perl #123020]
3108
3109=back
3110
3111=head1 Known Problems
3112
3113=over 4
3114
3115=item *
3116
3117A goal is for Perl to be able to be recompiled to work reasonably well on any
3118Unicode version. In Perl 5.22, though, the earliest such version is Unicode
31195.1 (current is 7.0).
3120
3121=item *
3122
3123EBCDIC platforms
3124
3125=over 4
3126
3127=item *
3128
3129Encode and encoding are mostly broken.
3130
3131=item *
3132
0590bd99 3133Many CPAN modules that are shipped with core show failing tests.
eabfc7bc
RS
3134
3135=item *
3136
3137C<pack>/C<unpack> with C<"U0"> format may not work properly.
3138
3139=back
3140
3141=item *
3142
3143The following modules are known to have test failures with this version of
3144Perl. Patches have been submitted, so there will hopefully be new releases
3145soon:
3146
3147=over
3148
3149=item *
3150
3151L<B::Generate> version 1.50
3152
3153=item *
3154
3155L<B::Utils> version 0.25
3156
3157=item *
3158
3159L<Dancer> version 1.3130
3160
3161=item *
3162
3163L<Data::Alias> version 1.18
3164
3165=item *
3166
3167L<Data::Util> version 0.63
3168
3169=item *
3170
ba520a57
RS
3171L<Devel::Spy> version 0.07
3172
3173=item *
3174
eabfc7bc
RS
3175L<Lexical::Var> version 0.009
3176
3177=item *
3178
3179L<Mason> version 2.22
3180
3181=item *
3182
3183L<Padre> version 1.00
3184
3185=item *
3186
3187L<Parse::Keyword> 0.08
3188
3189=back
3190
3191=back
2a7a05b4 3192
7f9fef93 3193=head1 Acknowledgements
2a7a05b4 3194
7f9fef93 3195XXX Generate this with:
2a7a05b4 3196
eabfc7bc 3197 perl Porting/acknowledgements.pl v5.20.0..HEAD
f5b73711 3198
44691e6f
AB
3199=head1 Reporting Bugs
3200
e08634c5
SH
3201If you find what you think is a bug, you might check the articles recently
3202posted to the comp.lang.perl.misc newsgroup and the perl bug database at
e5998677
SH
3203https://rt.perl.org/ . There may also be information at
3204http://www.perl.org/ , the Perl Home Page.
44691e6f 3205
e08634c5
SH
3206If you believe you have an unreported bug, please run the L<perlbug> program
3207included with your release. Be sure to trim your bug down to a tiny but
3208sufficient test case. Your bug report, along with the output of C<perl -V>,
3209will be sent off to perlbug@perl.org to be analysed by the Perl porting team.
44691e6f
AB
3210
3211If the bug you are reporting has security implications, which make it
e08634c5
SH
3212inappropriate to send to a publicly archived mailing list, then please send it
3213to perl5-security-report@perl.org. This points to a closed subscription
3214unarchived mailing list, which includes all the core committers, who will be
3215able to help assess the impact of issues, figure out a resolution, and help
f9001595 3216co-ordinate the release of patches to mitigate or fix the problem across all
e08634c5
SH
3217platforms on which Perl is supported. Please only use this address for
3218security issues in the Perl core, not for modules independently distributed on
3219CPAN.
44691e6f
AB
3220
3221=head1 SEE ALSO
3222
e08634c5
SH
3223The F<Changes> file for an explanation of how to view exhaustive details on
3224what changed.
44691e6f
AB
3225
3226The F<INSTALL> file for how to build Perl.
3227
3228The F<README> file for general stuff.
3229
3230The F<Artistic> and F<Copying> files for copyright information.
3231
3232=cut