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