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