This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldelta: generate acknowledgements for 5.20.0
[perl5.git] / pod / perldelta.pod
CommitLineData
44691e6f
AB
1=encoding utf8
2
3=head1 NAME
4
c68523cb 5perldelta - what is new for perl v5.20.0
e128ab2c 6
4eabcf70 7=head1 DESCRIPTION
6db9054f 8
c68523cb
RS
9This document describes differences between the 5.18.0 release and the
105.20.0 release.
11
12If you are upgrading from an earlier release such as 5.16.0, first read
13L<perl5180delta>, which describes differences between 5.16.0 and 5.18.0.
6db9054f 14
c68523cb 15=head1 Core Enhancements
22730142 16
c68523cb 17=head2 Experimental Subroutine signatures
0d0bc230 18
c68523cb
RS
19Declarative syntax to unwrap argument list into lexical variables.
20C<sub foo ($a,$b) {...}> checks the number of arguments and puts the
21arguments into lexical variables. Signatures are not equivalent to
22the existing idiom of C<sub foo { my($a,$b) = @_; ... }>. Signatures
23are only available by enabling a non-default feature, and generate
24warnings about being experimental. The syntactic clash with
25prototypes is managed by disabling the short prototype syntax when
26signatures are enabled.
87776862 27
c68523cb
RS
28See L<perlsub/Signatures> for details.
29
30=head2 C<sub>s now take a C<prototype> attribute
31
32When declaring or defining a C<sub>, the prototype can now be specified inside
33of a C<prototype> attribute instead of in parens following the name.
34
35For example, C<sub foo($$){}> could be rewritten as
36C<sub foo : prototype($$){}>.
37
38=head2 More consistent prototype parsing
39
40Multiple semicolons in subroutine prototypes have long been tolerated and
41treated as a single semicolon. There was one case where this did not
42happen. A subroutine whose prototype begins with "*" or ";*" can affect
43whether a bareword is considered a method name or sub call. This now
44applies also to ";;;*".
45
46Whitespace has long been allowed inside subroutine prototypes, so
47C<sub( $ $ )> is equivalent to C<sub($$)>, but until now it was stripped
48when the subroutine was parsed. Hence, whitespace was I<not> allowed in
49prototypes set by C<Scalar::Util::set_prototype>. Now it is permitted,
50and the parser no longer strips whitespace. This means
51C<prototype &mysub> returns the original prototype, whitespace and all.
52
53=head2 C<rand> now uses a consistent random number generator
54
55Previously perl would use a platform specific random number generator, varying
56between the libc rand(), random() or drand48().
57
58This meant that the quality of perl's random numbers would vary from platform
59to platform, from the 15 bits of rand() on Windows to 48-bits on POSIX
60platforms such as Linux with drand48().
61
62Perl now uses its own internal drand48() implementation on all platforms. This
63does not make perl's C<rand> cryptographically secure. [perl #115928]
64
65=head2 New slice syntax
66
67The new C<%hash{...}> and C<%array[...]> syntax returns a list of key/value (or
68index/value) pairs. See L<perldata/"Key/Value Hash Slices">.
69
70=head2 Experimental Postfix Dereferencing
71
72When the C<postderef> feature is in effect, the following syntactical
73equivalencies are set up:
74
75 $sref->$*; # same as ${ $sref } # interpolates
76 $aref->@*; # same as @{ $aref } # interpolates
77 $href->%*; # same as %{ $href }
78 $cref->&*; # same as &{ $cref }
79 $gref->**; # same as *{ $gref }
80
81 $aref->$#*; # same as $#{ $aref }
82
83 $gref->*{ $slot }; # same as *{ $gref }{ $slot }
84
85 $aref->@[ ... ]; # same as @$aref[ ... ] # interpolates
86 $href->@{ ... }; # same as @$href{ ... } # interpolates
87 $aref->%[ ... ]; # same as %$aref[ ... ]
88 $href->%{ ... }; # same as %$href{ ... }
89
90Those marked as interpolating only interpolate if the associated
91C<postderef_qq> feature is also enabled. This feature is B<experimental> and
92will trigger C<experimental::postderef>-category warnings when used, unless
93they are suppressed.
94
95For more information, consult L<the Postfix Dereference Syntax section of
96perlref|perlref/Postfix Dereference Syntax>.
97
98=head2 Unicode 6.3 now supported
99
100Perl now supports and is shipped with Unicode 6.3 (though Perl may be
101recompiled with any previous Unicode release as well). A detailed list of
102Unicode 6.3 changes is at L<http://www.unicode.org/versions/Unicode6.3.0/>.
103
104=head2 New C<\p{Unicode}> regular expression pattern property
105
106This is a synonym for C<\p{Any}> and matches the set of Unicode-defined
107code points 0 - 0x10FFFF.
108
109=head2 Better 64-bit support
110
111On 64-bit platforms, the internal array functions now use 64-bit offsets,
112allowing Perl arrays to hold more than 2**31 elements, if you have the memory
113available.
114
115The regular expression engine now supports strings longer than 2**31
116characters. [perl #112790, #116907]
117
118The functions PerlIO_get_bufsiz, PerlIO_get_cnt, PerlIO_set_cnt and
119PerlIO_set_ptrcnt now have SSize_t, rather than int, return values and
120parameters.
769e4861 121
c68523cb 122=head2 C<S<use locale>> now works on UTF-8 locales
7ef8b31d 123
c68523cb
RS
124Until this release, only single-byte locales, such as the ISO 8859
125series were supported. Now, the increasingly common multi-byte UTF-8
126locales are also supported. A UTF-8 locale is one in which the
127character set is Unicode and the encoding is UTF-8. The POSIX
128C<LC_CTYPE> category operations (case changing (like C<lc()>, C<"\U">),
129and character classification (C<\w>, C<\D>, C<qr/[[:punct:]]/>)) under
130such a locale work just as if not under locale, but instead as if under
131C<S<use feature 'unicode_strings'>>, except taint rules are followed.
132Sorting remains by code point order in this release. [perl #56820].
133
134=head2 C<S<use locale>> now compiles on systems without locale ability
135
136Previously doing this caused the program to not compile. Within its
137scope the program behaves as if in the "C" locale. Thus programs
138written for platforms that support locales can run on locale-less
139platforms without change. Attempts to change the locale away from the
140"C" locale will, of course, fail.
141
142=head2 More locale initialization fallback options
143
144If there was an error with locales during Perl start-up, it immediately
145gave up and tried to use the C<"C"> locale. Now it first tries using
146other locales given by the environment variables, as detailed in
147L<perllocale/ENVIRONMENT>. For example, if C<LC_ALL> and C<LANG> are
148both set, and using the C<LC_ALL> locale fails, Perl will now try the
149C<LANG> locale, and only if that fails, will it fall back to C<"C">. On
150Windows machines, Perl will try, ahead of using C<"C">, the system
151default locale if all the locales given by environment variables fail.
152
153=head2 C<-DL> runtime option now added for tracing locale setting
154
155This is designed for Perl core developers to aid in field debugging bugs
156regarding locales.
157
158=head2 B<-F> now implies B<-a> and B<-a> implies B<-n>
159
160Previously B<-F> without B<-a> was a no-op, and B<-a> without B<-n> or B<-p>
161was a no-op, with this change, if you supply B<-F> then both B<-a> and B<-n>
162are implied and if you supply B<-a> then B<-n> is implied.
163
164You can still use B<-p> for its extra behaviour. [perl #116190]
165
166=head2 $a and $b warnings exemption
167
168The special variables $a and $b, used in C<sort>, are now exempt from "used
169once" warnings, even where C<sort> is not used. This makes it easier for
170CPAN modules to provide functions using $a and $b for similar purposes.
171[perl #120462]
7ef8b31d
SH
172
173=head1 Security
174
c68523cb 175=head2 Avoid possible read of free()d memory during parsing
7ef8b31d 176
c68523cb
RS
177It was possible that free()d memory could be read during parsing in the unusual
178circumstance of the Perl program ending with a heredoc and the last line of the
179file on disk having no terminating newline character. This has now been fixed.
7ef8b31d
SH
180
181=head1 Incompatible Changes
182
c68523cb
RS
183=head2 C<do> can no longer be used to call subroutines
184
185The C<do SUBROUTINE(LIST)> form has resulted in a deprecation warning
186since Perl v5.0.0, and is now a syntax error.
187
188=head2 Quote-like escape changes
189
190The character after C<\c> in a double-quoted string ("..." or qq(...))
191or regular expression must now be a printable character and may not be
192C<{>.
193
194A literal C<{> after C<\B> or C<\b> is now fatal.
195
196These were deprecated in perl v5.14.0.
197
198=head2 Tainting happens under more circumstances; now conforms to documentation
199
200This affects regular expression matching and changing the case of a
201string (C<lc>, C<"\U">, I<etc>.) within the scope of C<use locale>.
202The result is now tainted based on the operation, no matter what the
203contents of the string were, as the documentation (L<perlsec>,
204L<perllocale/SECURITY>) indicates it should. Previously, for the case
205change operation, if the string contained no characters whose case
206change could be affected by the locale, the result would not be tainted.
207For example, the result of C<uc()> on an empty string or one containing
208only above-Latin1 code points is now tainted, and wasn't before. This
209leads to more consistent tainting results. Regular expression patterns
210taint their non-binary results (like C<$&>, C<$2>) if and only if the
211pattern contains elements whose matching depends on the current
212(potentially tainted) locale. Like the case changing functions, the
213actual contents of the string being matched now do not matter, whereas
214formerly it did. For example, if the pattern contains a C<\w>, the
215results will be tainted even if the match did not have to use that
216portion of the pattern to succeed or fail, because what a C<\w> matches
217depends on locale. However, for example, a C<.> in a pattern will not
218enable tainting, because the dot matches any single character, and what
219the current locale is doesn't change in any way what matches and what
220doesn't.
221
222=head2 C<\p{}>, C<\P{}> matching has changed for non-Unicode code
223points.
224
225C<\p{}> and C<\P{}> are defined by Unicode only on Unicode-defined code
226points (C<U+0000> through C<U+10FFFF>). Their behavior on matching
227these legal Unicode code points is unchanged, but there are changes for
228code points C<0x110000> and above. Previously, Perl treated the result
229of matching C<\p{}> and C<\P{}> against these as C<undef>, which
230translates into "false". For C<\P{}>, this was then complemented into
231"true". A warning was supposed to be raised when this happened.
232However, various optimizations could prevent the warning, and the
233results were often counter-intuitive, with both a match and its seeming
234complement being false. Now all non-Unicode code points are treated as
235typical unassigned Unicode code points. This generally is more
236Do-What-I-Mean. A warning is raised only if the results are arguably
237different from a strict Unicode approach, and from what Perl used to do.
238Code that needs to be strictly Unicode compliant can make this warning
239fatal, and then Perl always raises the warning.
240
241Details are in L<perlunicode/Beyond Unicode code points>.
242
243=head2 C<\p{All}> has been expanded to match all possible code points
244
245The Perl-defined regular expression pattern element C<\p{All}>, unused
246on CPAN, used to match just the Unicode code points; now it matches all
247possible code points; that is, it is equivalent to C<qr/./s>. Thus
248C<\p{All}> is no longer synonymous with C<\p{Any}>, which continues to
249match just the Unicode code points, as Unicode says it should.
250
251=head2 Data::Dumper's output may change
252
253Depending on the data structures dumped and the settings set for
254Data::Dumper, the dumped output may have changed from previous
255versions.
256
257If you have tests that depend on the exact output of Data::Dumper,
258they may fail.
259
260To avoid this problem in your code, test against the data structure
261from evaluating the dumped structure, instead of the dump itself.
262
263=head2 Locale decimal point character no longer leaks outside of S<C<use locale>> scope
264
265This is actually a bug fix, but some code has come to rely on the bug
266being present, so this change is listed here. The current locale that
267the program is running under is not supposed to be visible to Perl code
268except within the scope of a S<C<use locale>>. However, until now under
269certain circumstances, the character used for a decimal point (often a
270comma) leaked outside the scope. If your code is affected by this
271change, simply add a S<C<use locale>>.
272
273=head2 Assignments of Windows sockets error codes to $! now prefer F<errno.h> values over WSAGetLastError() values
274
275In previous versions of Perl, Windows sockets error codes as returned by
276WSAGetLastError() were assigned to $!, and some constants such as ECONNABORTED,
277not in F<errno.h> in VC++ (or the various Windows ports of gcc) were defined to
278corresponding WSAE* values to allow $! to be tested against the E* constants
279exported by L<Errno> and L<POSIX>.
280
281This worked well until VC++ 2010 and later, which introduced new E* constants
282with values E<gt> 100 into F<errno.h>, including some being (re)defined by perl
283to WSAE* values. That caused problems when linking XS code against other
284libraries which used the original definitions of F<errno.h> constants.
285
286To avoid this incompatibility, perl now maps WSAE* error codes to E* values
287where possible, and assigns those values to $!. The E* constants exported by
288L<Errno> and L<POSIX> are updated to match so that testing $! against them,
289wherever previously possible, will continue to work as expected, and all E*
290constants found in F<errno.h> are now exported from those modules with their
291original F<errno.h> values.
292
293In order to avoid breakage in existing Perl code which assigns WSAE* values to
294$!, perl now intercepts the assignment and performs the same mapping to E*
295values as it uses internally when assigning to $! itself.
296
297However, one backwards-incompatibility remains: existing Perl code which
298compares $! against the numeric values of the WSAE* error codes that were
299previously assigned to $! will now be broken in those cases where a
300corresponding E* value has been assigned instead. This is only an issue for
301those E* values E<lt> 100, which were always exported from L<Errno> and
302L<POSIX> with their original F<errno.h> values, and therefore could not be used
303for WSAE* error code tests (e.g. WSAEINVAL is 10022, but the corresponding
304EINVAL is 22). (E* values E<gt> 100, if present, were redefined to WSAE*
305values anyway, so compatibility can be achieved by using the E* constants,
306which will work both before and after this change, albeit using different
307numeric values under the hood.)
308
309=head2 Functions C<PerlIO_vsprintf> and C<PerlIO_sprintf> have been removed
310
311These two functions, undocumented, unused in CPAN, and problematic, have been
312removed.
313
314=head1 Deprecations
7ef8b31d 315
c68523cb 316=head2 The C</\C/> character class
7ef8b31d 317
c68523cb
RS
318The C</\C/> regular expression character class is deprecated. From perl
3195.22 onwards it will generate a warning, and from perl 5.24 onwards it
320will be a regular expression compiler error. If you need to examine the
321individual bytes that make up a UTF8-encoded character, then use
322C<utf8::encode()> on the string (or a copy) first.
7ef8b31d 323
c68523cb 324=head2 Literal control characters in variable names
769e4861 325
c68523cb
RS
326This deprecation affects things like $\cT, where \cT is a literal control (such
327as a C<NAK> or C<NEGATIVE ACKNOWLEDGE> character) in
328the source code. Surprisingly, it appears that originally this was intended as
329the canonical way of accessing variables like $^T, with the caret form only
330being added as an alternative.
ca3178e0 331
c68523cb
RS
332The literal control form is being deprecated for two main reasons. It has what
333are likely unfixable bugs, such as $\cI not working as an alias for $^I, and
334their usage not being portable to non-ASCII platforms: While $^T will work
335everywhere, \cT is whitespace in EBCDIC. [perl #119123]
336
337=head2 References to non-integers and non-positive integers in C<$/>
7ef8b31d 338
c68523cb
RS
339Setting C<$/> to a reference to zero or a reference to a negative integer is
340now deprecated, and will behave B<exactly> as though it was set to C<undef>.
341If you want slurp behavior set C<$/> to C<undef> explicitly.
342
343Setting C<$/> to a reference to a non integer is now forbidden and will
344throw an error. Perl has never documented what would happen in this
345context and while it used to behave the same as setting C<$/> to
346the address of the references in future it may behave differently, so we
347have forbidden this usage.
348
349=head2 Character matching routines in POSIX
350
351Use of any of these functions in the C<POSIX> module is now deprecated:
352C<isalnum>, C<isalpha>, C<iscntrl>, C<isdigit>, C<isgraph>, C<islower>,
353C<isprint>, C<ispunct>, C<isspace>, C<isupper>, and C<isxdigit>. The
354functions are buggy and don't work on UTF-8 encoded strings. See their
355entries in L<POSIX> for more information.
356
357A warning is raised on the first call to any of them from each place in
358the code that they are called. (Hence a repeated statement in a loop
359will raise just the one warning.)
360
361=head2 Interpreter-based threads are now I<discouraged>
362
363The "interpreter-based threads" provided by Perl are not the fast, lightweight
364system for multitasking that one might expect or hope for. Threads are
365implemented in a way that make them easy to misuse. Few people know how to
366use them correctly or will be able to provide help.
367
368The use of interpreter-based threads in perl is officially
369L<discouraged|perlpolicy/discouraged>.
370
371=head2 Module removals
7ef8b31d
SH
372
373The following modules will be removed from the core distribution in a
374future release, and will at that time need to be installed from CPAN.
375Distributions on CPAN which require these modules will need to list them as
376prerequisites.
377
378The core versions of these modules will now issue C<"deprecated">-category
379warnings to alert you to this fact. To silence these deprecation warnings,
380install the modules in question from CPAN.
381
c68523cb
RS
382Note that the planned removal of these modules from core does not reflect a
383judgement about the quality of the code and should not be taken as a suggestion
384that their use be halted. Their disinclusion from core primarily hinges on
385their necessity to bootstrapping a fully functional, CPAN-capable Perl
386installation, not on concerns over their design.
7ef8b31d
SH
387
388=over
389
c68523cb 390=item L<CGI> and its associated CGI:: packages
7ef8b31d 391
c68523cb 392=item L<inc::latest>
769e4861 393
c68523cb 394=item L<Package::Constants>
474475f6 395
c68523cb
RS
396=item L<Module::Build> and its associated Module::Build:: packages
397
398=back
7ef8b31d
SH
399
400=head1 Performance Enhancements
401
c68523cb
RS
402=over 4
403
404=item *
7ef8b31d 405
c68523cb
RS
406Perl has a new copy-on-write mechanism that avoids the need to copy the
407internal string buffer when assigning from one scalar to another. This
408makes copying large strings appear much faster. Modifying one of the two
409(or more) strings after an assignment will force a copy internally. This
410makes it unnecessary to pass strings by reference for efficiency.
b314f574 411
c68523cb
RS
412This feature was already available in 5.18.0, but wasn't enabled by
413default. It is the default now, and so you no longer need build perl with
414the F<Configure> argument:
415
416 -Accflags=-DPERL_NEW_COPY_ON_WRITE
417
418It can be disabled (for now) in a perl build with:
419
420 -Accflags=-DPERL_NO_COW
421
422On some operating systems Perl can be compiled in such a way that any
423attempt to modify string buffers shared by multiple SVs will crash. This
424way XS authors can test that their modules handle copy-on-write scalars
425correctly. See L<perlguts/"Copy on Write"> for detail.
426
427=item *
428
429Perl has an optimizer for regular expression patterns. It analyzes the pattern
430to find things such as the minimum length a string has to be to match, etc. It
431now better handles code points that are above the Latin1 range.
432
433=item *
434
435Executing a regex that contains the C<^> anchor (or its variant under the
436C</m> flag) has been made much faster in several situations.
437
438=item *
439
440Precomputed hash values are now used in more places during method lookup.
441
442=item *
443
444Constant hash key lookups (C<$hash{key}> as opposed to C<$hash{$key}>) have
445long had the internal hash value computed at compile time, to speed up
446lookup. This optimisation has only now been applied to hash slices as
447well.
448
449=item *
450
451Combined C<and> and C<or> operators in void context, like those
452generated for C<< unless ($a && $b) >> and C<< if ($a || b) >> now
453short circuit directly to the end of the statement. [perl #120128]
454
455=item *
456
457In certain situations, when C<return> is the last statement in a subroutine's
458main scope, it will be optimized out. This means code like:
459
460 sub baz { return $cat; }
461
462will now behave like:
463
464 sub baz { $cat; }
465
466which is notably faster.
467
468[perl #120765]
469
470=item *
471
472Code like:
473
474 my $x; # or @x, %x
475 my $y;
476
477is now optimized to:
478
479 my ($x, $y);
480
481In combination with the L<padrange optimization introduced in
482v5.18.0|perl5180delta/Internal Changes>, this means longer uninitialized my
483variable statements are also optimized, so:
484
485 my $x; my @y; my %z;
486
487becomes:
488
489 my ($x, @y, %z);
490
491[perl #121077]
492
493=item *
494
495The creation of certain sorts of lists, including array and hash slices, is now
496faster.
497
498=item *
499
500The optimisation for arrays indexed with a small constant integer is now
501applied for integers in the range -128..127, rather than 0..255. This should
502speed up Perl code using expressions like C<$x[-1]>, at the expense of
503(presumably much rarer) code using expressions like C<$x[200]>.
504
505=item *
506
507The first iteration over a large hash (using C<keys> or C<each>) is now
508faster. This is achieved by preallocating the hash's internal iterator
509state, rather than lazily creating it when the hash is first iterated. (For
510small hashes, the iterator is still created only when first needed. The
511assumption is that small hashes are more likely to be used as objects, and
512therefore never allocated. For large hashes, that's less likely to be true,
513and the cost of allocating the iterator is swamped by the cost of allocating
514space for the hash itself.)
1175bfe1
TH
515
516=item *
517
c68523cb
RS
518When doing a global regex match on a string that came from the C<readline>
519or C<E<lt>E<gt>> operator, the data is no longer copied unnecessarily.
520[perl #121259]
521
522=item *
523
524Dereferencing (as in C<$obj-E<gt>[0]> or C<$obj-E<gt>{k}>) is now faster
525when C<$obj> is an instance of a class that has overloaded methods, but
526doesn't overload any of the dereferencing methods C<@{}>, C<%{}>, and so on.
527
528=item *
529
530Perl's optimiser no longer skips optimising code that follows certain
531C<eval {}> expressions (including those with an apparent infinite loop).
532
533=item *
534
535The implementation now does a better job of avoiding meaningless work at
536runtime. Internal effect-free "null" operations (created as a side-effect of
537parsing Perl programs) are normally deleted during compilation. That
538deletion is now applied in some situations that weren't previously handled.
539
540=item *
541
542Perl now does less disk I/O when dealing with Unicode properties that cover
543up to three ranges of consecutive code points.
f6f3144e 544
7ef8b31d 545=back
f6f3144e 546
7ef8b31d 547=head1 Modules and Pragmata
f6f3144e 548
c68523cb
RS
549 XXX TO BE AUTOGENERATED
550
551=head1 Documentation
552
553=head2 New Documentation
554
555=head3 L<perlrepository>
556
557This document was removed (actually, renamed L<perlgit> and given a major
558overhaul) in Perl v5.14, causing Perl documentation websites to show the now
559out of date version in Perl v5.12 as the latest version. It has now been
560restored in stub form, directing readers to current information.
45a13884 561
c68523cb 562=head2 Changes to Existing Documentation
7ef8b31d 563
c68523cb 564=head3 L<perldata>
7ef8b31d
SH
565
566=over 4
45a13884
SH
567
568=item *
569
c68523cb
RS
570New sections have been added to document the new index/value array slice and
571key/value hash slice syntax.
f6f3144e 572
7ef8b31d
SH
573=back
574
c68523cb 575=head3 L<perldebguts>
7ef8b31d
SH
576
577=over 4
f6f3144e
SH
578
579=item *
580
c68523cb
RS
581The C<DB::goto> and C<DB::lsub> debugger subroutines are now documented. [perl
582#77680]
7ef8b31d
SH
583
584=back
fc671210 585
c68523cb 586=head3 L<perlexperiment>
ec71b45f 587
c68523cb
RS
588=over
589
590=item *
591
592C<\s> matching C<\cK> is marked experimental.
593
594=item *
595
596ithreads were accepted in v5.8.0 (but are discouraged as of v5.20.0).
fc671210
SH
597
598=item *
599
c68523cb
RS
600Long doubles are not considered experimental.
601
602=item *
603
604Code in regular expressions, regular expression backtracking verbs,
605and lvalue subroutines are no longer listed as experimental. (This
606also affects L<perlre> and L<perlsub>.)
fc671210 607
7ef8b31d 608=back
fc671210 609
c68523cb 610=head3 L<perlfunc>
fc671210 611
c68523cb 612=over
33642846 613
c68523cb 614=item *
e486a115 615
c68523cb 616C<chop> and C<chomp> now note that they can reset the hash iterator.
f6f3144e 617
c68523cb 618=item *
ec71b45f 619
c68523cb 620C<exec>'s handling of arguments is now more clearly documented.
ec71b45f 621
c68523cb 622=item *
ec71b45f 623
c68523cb
RS
624C<eval EXPR> now has caveats about expanding floating point numbers in some
625locales.
f6f3144e 626
c68523cb 627=item *
f6f3144e 628
c68523cb
RS
629C<goto EXPR> is now documented to handle an expression that evalutes to a
630code reference as if it was C<goto &$coderef>. This behavior is at least ten
631years old.
7432779b 632
7ef8b31d 633=item *
7432779b 634
c68523cb
RS
635Since Perl v5.10, it has been possible for subroutines in C<@INC> to return
636a reference to a scalar holding initial source code to prepend to the file.
637This is now documented.
638
639=item *
640
641The documentation of C<ref> has been updated to recommend the use of
642C<blessed>, C<isa> and C<reftype> when dealing with references to blessed
643objects.
7432779b 644
474475f6 645=back
e486a115 646
c68523cb 647=head3 L<perlguts>
d07feb8f 648
c68523cb 649=over 4
d07feb8f 650
c68523cb 651=item *
7ef8b31d 652
c68523cb
RS
653Numerous minor changes have been made to reflect changes made to the perl
654internals in this release.
7ef8b31d 655
c68523cb 656=item *
7ef8b31d 657
c68523cb
RS
658New sections on L<Read-Only Values|perlguts/"Read-Only Values"> and
659L<Copy on Write|perlguts/"Copy on Write"> have been added.
660
661=back
662
663=head3 L<perlhack>
7ef8b31d
SH
664
665=over 4
666
667=item *
668
c68523cb
RS
669The L<Super Quick Patch Guide|perlhack/SUPER QUICK PATCH GUIDE> section has
670been updated.
7ef8b31d
SH
671
672=back
673
c68523cb 674=head3 L<perlhacktips>
7ef8b31d
SH
675
676=over 4
677
678=item *
679
c68523cb
RS
680The documentation has been updated to include some more examples of C<gdb>
681usage.
7ef8b31d
SH
682
683=back
684
c68523cb 685=head2 L<perllexwarn>
7ef8b31d 686
474475f6 687=over 4
acc18285 688
b314f574 689=item *
acc18285 690
c68523cb
RS
691The L<perllexwarn> documentation used to describe the hierarchy of warning
692categories understood by the L<warnings> pragma. That description has now
693been moved to the L<warnings> documentation itself, leaving L<perllexwarn>
694as a stub that points to it. This change consolidates all documentation for
695lexical warnings in a single place.
acc18285 696
474475f6 697=back
87776862 698
c68523cb
RS
699=head3 L<perllocale>
700
701=over
702
703=item *
87776862 704
c68523cb
RS
705The documentation now mentions F<fc()> and C<\F>, and includes many
706clarifications and corrections in general.
7ef8b31d 707
c68523cb 708=back
7ef8b31d 709
c68523cb 710=head3 L<perlop>
769e4861 711
474475f6 712=over 4
769e4861 713
b314f574 714=item *
acc18285 715
c68523cb
RS
716The language design of Perl has always called for monomorphic operators.
717This is now mentioned explicitly.
7ef8b31d
SH
718
719=back
720
c68523cb
RS
721=head3 L<perlopentut>
722
723=over 4
724
725=item *
726
727The C<open> tutorial has been completely rewritten by Tom Christiansen, and now
728focuses on covering only the basics, rather than providing a comprehensive
729reference to all things openable. This rewrite came as the result of a
730vigorous discussion on perl5-porters kicked off by a set of improvements
731written by Alexander Hartmaier to the existing L<perlopentut>. A "more than
732you ever wanted to know about C<open>" document may follow in subsequent
733versions of perl.
7ef8b31d 734
c68523cb 735=back
7ef8b31d 736
c68523cb 737=head3 L<perlre>
7ef8b31d
SH
738
739=over 4
b314f574
AC
740
741=item *
742
c68523cb
RS
743The fact that the regexp engine makes no effort to call (?{}) and (??{})
744constructs any specified number of times (although it will basically DWIM
745in case of a successful match) has been documented.
769e4861 746
c68523cb 747=item *
769e4861 748
c68523cb
RS
749The C</r> modifier (for non-destructive substitution) is now documented. [perl
750#119151]
751
752=item *
7ef8b31d 753
c68523cb 754The documentation for C</x> and C<(?# comment)> has been expanded and clarified.
7ef8b31d 755
c68523cb
RS
756=back
757
758=head3 L<perlreguts>
68f96b51
SH
759
760=over 4
761
762=item *
763
c68523cb
RS
764The documentation has been updated in the light of recent changes to
765F<regcomp.c>.
68f96b51
SH
766
767=back
768
c68523cb
RS
769=head3 L<perlsub>
770
771=over 4
acc18285 772
c68523cb 773=item *
7ef8b31d 774
c68523cb
RS
775The need to predeclare recursive functions with prototypes in order for the
776prototype to be honoured in the recursive call is now documented. [perl #2726]
7ef8b31d 777
c68523cb 778=item *
7ef8b31d 779
c68523cb
RS
780A list of subroutine names used by the perl implementation is now included.
781[perl #77680]
782
783=back
784
785=head3 L<perltrap>
87776862 786
10819dab 787=over 4
87776862 788
c68523cb 789=item *
7ef8b31d 790
c68523cb 791There is now a L<JavaScript|perltrap/JavaScript Traps> section.
f6f3144e 792
ce5b6630 793=back
025c2e17 794
c68523cb 795=head3 L<perlunicode>
025c2e17 796
474475f6 797=over 4
6fa4f5e3 798
c68523cb 799=item *
6fa4f5e3 800
c68523cb
RS
801The documentation has been updated to reflect C<Bidi_Class> changes in
802Unicode 6.3.
b3a2acfa 803
ce5b6630 804=back
025c2e17 805
c68523cb 806=head3 L<perlvar>
6fa4f5e3 807
474475f6 808=over 4
6fa4f5e3 809
c68523cb 810=item *
7ef8b31d 811
c68523cb
RS
812A new section explaining the performance issues of $`, $& and $', including
813workarounds and changes in different versions of Perl, has been added.
727d17a2 814
c68523cb 815=item *
ea6b701a 816
c68523cb
RS
817Three L<English> variable names which have long been documented but do not
818actually exist have been removed from the documentation. These were
819C<$OLD_PERL_VERSION>, C<$OFMT>, and C<$ARRAY_BASE>.
b17e32ea 820
c68523cb 821=back
c378dac0 822
c68523cb 823=head3 L<perlxs>
7ef8b31d
SH
824
825=over 4
c378dac0 826
5c45d39a
MH
827=item *
828
c68523cb 829Several problems in the C<MY_CXT> example have been fixed.
5c45d39a 830
7ef8b31d 831=back
e1abb2bc 832
c68523cb
RS
833=head1 Diagnostics
834
835The following additions or changes have been made to diagnostic output,
836including warnings and fatal error messages. For the complete list of
837diagnostic messages, see L<perldiag>.
7ef8b31d 838
c68523cb 839=head2 New Diagnostics
7ef8b31d 840
c68523cb 841=head3 New Errors
7ef8b31d
SH
842
843=over 4
25fdf527
TC
844
845=item *
846
c68523cb 847L<delete argument is indexE<sol>value array slice, use array slice|perldiag/"delete argument is index/value array slice, use array slice">
e1abb2bc 848
c68523cb
RS
849(F) You used index/value array slice syntax (C<%array[...]>) as the argument to
850C<delete>. You probably meant C<@array[...]> with an @ symbol instead.
346295c2 851
c68523cb 852=item *
346295c2 853
c68523cb 854L<delete argument is keyE<sol>value hash slice, use hash slice|perldiag/"delete argument is key/value hash slice, use hash slice">
7ef8b31d 855
c68523cb
RS
856(F) You used key/value hash slice syntax (C<%hash{...}>) as the argument to
857C<delete>. You probably meant C<@hash{...}> with an @ symbol instead.
7ef8b31d 858
c68523cb
RS
859=item *
860
861L<Magical list constants are not supported|perldiag/"Magical list constants are
862not supported">
863
864(F) You assigned a magical array to a stash element, and then tried to use the
865subroutine from the same slot. You are asking Perl to do something it cannot
866do, details subject to change between Perl versions.
e9251c1a
AC
867
868=item *
869
c68523cb 870Added L<Setting $E<sol> to a %s reference is forbidden|perldiag/"Setting $E<sol> to %s reference is forbidden">
acc18285
TC
871
872=back
873
c68523cb 874=head3 New Warnings
f1a26846 875
7ef8b31d 876=over 4
f1a26846 877
7ef8b31d 878=item *
52e02e68 879
0439a1e8 880L<%s on reference is experimental|perldiag/"push on reference is experimental">:
52e02e68 881
c68523cb
RS
882The "auto-deref" feature is experimental.
883
884Starting in v5.14.0, it was possible to use push, pop, keys, and other
885built-in functions not only on aggregate types, but on references to
886them. The feature was not deployed to its original intended
887specification, and now may become redundant to postfix dereferencing.
888It has always been categorized as an experimental feature, and in
889v5.20.0 is carries a warning as such.
890
891Warnings will now be issued at compile time when these operations are
892detected.
893
894 no if $] >= 5.01908, warnings => "experimental::autoderef";
895
896Consider, though, replacing the use of these features, as they may
897change behavior again before becoming stable.
898
899=item *
900
901L<A sequence of multiple spaces in a charnames alias definition is deprecated|perldiag/"A sequence of multiple spaces in a charnames alias definition is deprecated">
902
903L<Trailing white-space in a charnames alias definition is deprecated|perldiag/"Trailing white-space in a charnames alias definition is deprecated">
904
905These two deprecation warnings involving C<\N{...}> were incorrectly
906implemented. They did not warn by default (now they do) and could not be
907made fatal via C<< use warnings FATAL => 'deprecated' >> (now they can).
908
909=item *
910
911L<Attribute prototype(%s) discards earlier prototype attribute in same sub|perldiag/"Attribute prototype(%s) discards earlier prototype attribute in same sub">
912
913(W misc) A sub was declared as C<sub foo : prototype(A) : prototype(B) {}>, for
914example. Since each sub can only have one prototype, the earlier
915declaration(s) are discarded while the last one is applied.
916
917=item *
918
919L<Invalid \0 character in %s for %s: %s\0%s|perldiag/"Invalid \0 character in %s for %s: %s\0%s">
920
921(W syscalls) Embedded \0 characters in pathnames or other system call arguments
922produce a warning as of 5.20. The parts after the \0 were formerly ignored by
923system calls.
924
925=item *
926
927L<Matched non-Unicode code point 0x%X against Unicode property; may not be portable|perldiag/"Matched non-Unicode code point 0x%X against Unicode property; may not be portable">.
928
929This replaces the message "Code point 0x%X is not Unicode, all \p{} matches
930fail; all \P{} matches succeed".
931
932=item *
933
934L<Missing ']' in prototype for %s : %s|perldiag/"Missing ']' in prototype for %s : %s">
935
936(W illegalproto) A grouping was started with C<[> but never closed with C<]>.
937
938=item *
939
940L<Possible precedence issue with control flow operator|perldiag/"Possible precedence issue with control flow operator">
52e02e68 941
c68523cb
RS
942(W syntax) There is a possible problem with the mixing of a control flow
943operator (e.g. C<return>) and a low-precedence operator like C<or>. Consider:
7ef8b31d 944
c68523cb
RS
945 sub { return $a or $b; }
946
947This is parsed as:
948
949 sub { (return $a) or $b; }
950
951Which is effectively just:
952
953 sub { return $a; }
954
955Either use parentheses or the high-precedence variant of the operator.
956
957Note this may be also triggered for constructs like:
958
959 sub { 1 if die; }
960
961=item *
962
963L<Postfix dereference is experimental|perldiag/"Postfix dereference is experimental">
964
965(S experimental::postderef) This warning is emitted if you use the experimental
966postfix dereference syntax. Simply suppress the warning if you want to use the
967feature, but know that in doing so you are taking the risk of using an
968experimental feature which may change or be removed in a future Perl version:
969
970 no warnings "experimental::postderef";
971 use feature "postderef", "postderef_qq";
972 $ref->$*;
973 $aref->@*;
974 $aref->@[@indices];
975 ... etc ...
976
977=item *
978
979L<Prototype '%s' overridden by attribute 'prototype(%s)' in %s|perldiag/"Prototype '%s' overridden by attribute 'prototype(%s)' in %s">
980
981(W prototype) A prototype was declared in both the parentheses after the sub
982name and via the prototype attribute. The prototype in parentheses is useless,
983since it will be replaced by the prototype from the attribute before it's ever
984used.
985
986=item *
987
0439a1e8 988L<Scalar value @%s[%s] better written as $%s[%s]|perldiag/"Scalar value @%s[%s] better written as $%s[%s]">
c68523cb
RS
989
990(W syntax) In scalar context, you've used an array index/value slice (indicated
991by %) to select a single element of an array. Generally it's better to ask for
992a scalar value (indicated by $). The difference is that C<$foo[&bar]> always
993behaves like a scalar, both in the value it returns and when evaluating its
994argument, while C<%foo[&bar]> provides a list context to its subscript, which
995can do weird things if you're expecting only one subscript. When called in
996list context, it also returns the index (what C<&bar> returns) in addition to
997the value.
998
999=item *
1000
0439a1e8 1001L<Scalar value @%s{%s} better written as $%s{%s}|perldiag/"Scalar value @%s{%s} better written as $%s{%s}">
c68523cb
RS
1002
1003(W syntax) In scalar context, you've used a hash key/value slice (indicated by
1004%) to select a single element of a hash. Generally it's better to ask for a
1005scalar value (indicated by $). The difference is that C<$foo{&bar}> always
1006behaves like a scalar, both in the value it returns and when evaluating its
1007argument, while C<@foo{&bar}> and provides a list context to its subscript,
1008which can do weird things if you're expecting only one subscript. When called
1009in list context, it also returns the key in addition to the value.
1010
1011=item *
1012
1013L<Setting $E<sol> to a reference to %s as a form of slurp is deprecated, treating as undef|perldiag/"Setting $E<sol> to a reference to %s as a form of slurp is deprecated, treating as undef">
1014
1015=item *
1016
1017L<Unexpected exit %u|perldiag/"Unexpected exit %u">
1018
1019(S) exit() was called or the script otherwise finished gracefully when
1020C<PERL_EXIT_WARN> was set in C<PL_exit_flags>.
1021
1022=item *
1023
0439a1e8 1024L<Unexpected exit failure %d|perldiag/"Unexpected exit failure %d">
c68523cb
RS
1025
1026(S) An uncaught die() was called when C<PERL_EXIT_WARN> was set in
1027C<PL_exit_flags>.
1028
1029=item *
1030
1031L<Use of literal control characters in variable names is deprecated|perldiag/"Use of literal control characters in variable names is deprecated">
1032
1033(D deprecated) Using literal control characters in the source to refer to the
1034^FOO variables, like $^X and ${^GLOBAL_PHASE} is now deprecated. This only
1035affects code like $\cT, where \cT is a control (like a C<SOH>) in the
1036source code: ${"\cT"} and $^T remain valid.
1037
1038=item *
1039
1040L<Useless use of greediness modifier|perldiag/"Useless use of greediness modifier '%c' in regex; marked by <-- HERE in m/%s/">
1041
1042This fixes [Perl #42957].
1043
1044=back
1045
1046=head2 Changes to Existing Diagnostics
1047
1048=over 4
1049
1050=item *
1051
1052Warnings and errors from the regexp engine are now UTF-8 clean.
1053
1054=item *
1055
1056The "Unknown switch condition" error message has some slight changes. This
1057error triggers when there is an unknown condition in a C<(?(foo))> conditional.
1058The error message used to read:
1059
1060 Unknown switch condition (?(%s in regex;
1061
1062But what %s could be was mostly up to luck. For C<(?(foobar))>, you might have
1063seen "fo" or "f". For Unicode characters, you would generally get a corrupted
1064string. The message has been changed to read:
1065
1066 Unknown switch condition (?(...)) in regex;
1067
1068Additionally, the C<'E<lt>-- HERE'> marker in the error will now point to the
1069correct spot in the regex.
1070
1071=item *
1072
1073The "%s "\x%X" does not map to Unicode" warning is now correctly listed as a
1074severe warning rather than as a fatal error.
1075
1076=item *
1077
1078Under rare circumstances, one could get a "Can't coerce readonly REF to
1079string" instead of the customary "Modification of a read-only value". This
1080alternate error message has been removed.
1081
1082=item *
1083
1084"Ambiguous use of * resolved as operator *": This and similar warnings
1085about "%" and "&" used to occur in some circumstances where there was no
1086operator of the type cited, so the warning was completely wrong. This has
1087been fixed [perl #117535, #76910].
1088
1089=item *
1090
1091Warnings about malformed subroutine prototypes are now more consistent in
1092how the prototypes are rendered. Some of these warnings would truncate
1093prototypes containing nulls. In other cases one warning would suppress
1094another. The warning about illegal characters in prototypes no longer says
1095"after '_'" if the bad character came before the underscore.
1096
1097=item *
1098
1099L<Perl folding rules are not up-to-date for 0x%X; please use the perlbug
1100utility to report; in regex; marked by <-- HERE in
1101mE<sol>%sE<sol>|perldiag/"Perl folding rules are not up-to-date for 0x%X;
1102please use the perlbug utility to report; in regex; marked by <-- HERE in
1103m/%s/">
1104
1105This message is now only in the regexp category, and not in the deprecated
1106category. It is still a default (i.e., severe) warning [perl #89648].
1107
1108=item *
1109
1110L<%%s[%s] in scalar context better written as $%s[%s]|perldiag/"%%s[%s] in scalar context better written as $%s[%s]">
1111
1112This warning now occurs for any C<%array[$index]> or C<%hash{key}> known to
1113be in scalar context at compile time. Previously it was worded "Scalar
1114value %%s[%s] better written as $%s[%s]".
1115
1116=item *
1117
1118L<Switch condition not recognized in regex; marked by <-- HERE in mE<sol>%sE<sol>|perldiag/"Switch condition not recognized in regex; marked by <-- HERE in m/%s/">:
1119
1120The description for this diagnostic has been extended to cover all cases where the warning may occur.
1121Issues with the positioning of the arrow indicator have also been resolved.
1122
1123=item *
1124
1125The error messages for C<my($a?$b$c)> and C<my(do{})> now mention "conditional
1126expression" and "do block", respectively, instead of reading 'Can't declare
1127null operation in "my"'.
1128
1129=item *
1130
1131When C<use re "debug"> executes a regex containing a backreference, the
1132debugging output now shows what string is being matched.
1133
1134=item *
1135
1136The now fatal error message C<Character following "\c" must be ASCII> has been
1137reworded as C<Character following "\c" must be printable ASCII> to emphasize
1138that in C<\cI<X>>, I<X> must be a I<printable (non-control)> ASCII character.
1139
1140=back
1141
1142=head1 Utility Changes
1143
1144=head3 L<a2p>
1145
1146=over 4
1147
1148=item *
1149
1150A possible crash from an off-by-one error when trying to access before the
1151beginning of a buffer has been fixed. [perl #120244]
1152
1153=back
1154
1155=head3 F<bisect.pl>
1156
1157The git bisection tool F<Porting/bisect.pl> has had many enhancements.
1158
1159It is provided as part of the source distribution but not installed because
1160it is not self-contained as it relies on being run from within a git
1161checkout. Note also that it makes no attempt to fix tests, correct runtime
1162bugs or make something useful to install - its purpose is to make minimal
1163changes to get any historical revision of interest to build and run as close
1164as possible to "as-was", and thereby make C<git bisect> easy to use.
1165
1166=over 4
1167
1168=item *
1169
1170Can optionally run the test case with a timeout.
1171
1172=item *
1173
1174Can now run in-place in a clean git checkout.
1175
1176=item *
1177
1178Can run the test case under C<valgrind>.
1179
1180=item *
1181
1182Can apply user supplied patches and fixes to the source checkout before
1183building.
1184
1185=item *
1186
1187Now has fixups to enable building several more historical ranges of bleadperl,
1188which can be useful for pinpointing the origins of bugs or behaviour changes.
1189
1190=back
1191
1192=head3 L<find2perl>
1193
1194=over 4
1195
1196=item *
1197
1198L<find2perl> now handles C<?> wildcards correctly. [perl #113054]
1199
1200=back
1201
1202=head3 L<perlbug>
1203
1204=over 4
1205
1206=item *
1207
1208F<perlbug> now has a C<-p> option for attaching patches with a bug report.
1209
1210=item *
1211
1212L<perlbug> has been modified to supply the report template with CRLF line
1213endings on Windows.
1214[L<perl #121277|https://rt.perl.org/Public/Bug/Display.html?id=121277>]
1215
1216=item *
1217
1218L<perlbug> now makes as few assumptions as possible about the encoding of the
1219report. This will likely change in the future to assume UTF-8 by default but
1220allow a user override.
1221
1222=back
1223
1224=head1 Configuration and Compilation
1225
1226=over 4
1227
1228=item *
1229
1230The F<Makefile.PL> for L<SDBM_File> now generates a better F<Makefile>, which
1231avoids a race condition during parallel makes, which could cause the build to
1232fail. This is the last known parallel make problem (on *nix platforms), and
1233therefore we believe that a parallel make should now always be error free.
1234
1235=item *
1236
1237F<installperl> and F<installman>'s option handling has been refactored to use
1238L<Getopt::Long>. Both are used by the F<Makefile> C<install> targets, and
1239are not installed, so these changes are only likely to affect custom
1240installation scripts.
1241
1242=over 4
1243
1244=item *
1245
1246Single letter options now also have long names.
1247
1248=item *
1249
1250Invalid options are now rejected.
1251
1252=item *
1253
1254Command line arguments that are not options are now rejected.
1255
1256=item *
1257
1258Each now has a C<--help> option to display the usage message.
1259
1260=back
1261
1262The behaviour for all valid documented invocations is unchanged.
1263
1264=item *
1265
1266Where possible, the build now avoids recursive invocations of F<make> when
1267building pure-Perl extensions, without removing any parallelism from the
1268build. Currently around 80 extensions can be processed directly by the
1269F<make_ext.pl> tool, meaning that 80 invocations of F<make> and 160
1270invocations of F<miniperl> are no longer made.
1271
1272=item *
1273
1274The build system now works correctly when compiling under GCC or Clang with
1275link-time optimization enabled (the C<-flto> option). [perl #113022]
1276
1277=item *
1278
1279Distinct library basenames with C<d_libname_unique>.
1280
1281When compiling perl with this option, the library files for XS modules are
1282named something "unique" -- for example, Hash/Util/Util.so becomes
1283Hash/Util/PL_Hash__Util.so. This behavior is similar to what currently
1284happens on VMS, and serves as groundwork for the Android port.
1285
1286=item *
1287
1288C<sysroot> option to indicate the logical root directory under gcc and clang.
1289
1290When building with this option set, both Configure and the compilers search
1291for all headers and libraries under this new sysroot, instead of /.
1292
1293This is a huge time saver if cross-compiling, but can also help
1294on native builds if your toolchain's files have non-standard locations.
1295
1296=item *
1297
1298The cross-compilation model has been renovated.
1299There's several new options, and some backwards-incompatible changes:
1300
1301We now build binaries for miniperl and generate_uudmap to be used on the host,
1302rather than running every miniperl call on the target; this means that, short
1303of 'make test', we no longer need access to the target system once Configure is
1304done. You can provide already-built binaries through the C<hostperl> and
1305C<hostgenerate> options to Configure.
1306
1307Additionally, if targeting an EBCDIC platform from an ASCII host,
1308or viceversa, you'll need to run Configure with C<-Uhostgenerate>, to
1309indicate that generate_uudmap should be run on the target.
1310
1311Finally, there's also a way of having Configure end early, right after
1312building the host binaries, by cross-compiling without specifying a
1313C<targethost>.
1314
1315The incompatible changes include no longer using xconfig.h, xlib, or
1316Cross.pm, so canned config files and Makefiles will have to be updated.
1317
1318=item *
1319
1320Related to the above, there is now a way of specifying the location of sh
1321(or equivalent) on the target system: C<targetsh>.
1322
1323For example, Android has its sh in /system/bin/sh, so if cross-compiling
1324from a more normal Unixy system with sh in /bin/sh, "targetsh" would end
1325up as /system/bin/sh, and "sh" as /bin/sh.
1326
1327=item *
1328
1329By default, B<gcc> 4.9 does some optimizations that break perl. The B<-fwrapv>
1330option disables those optimizations (and probably others), so for B<gcc> 4.3
1331and later (since the there might be similar problems lurking on older versions
1332too, but B<-fwrapv> was broken before 4.3, and the optimizations probably won't
1333go away), F<Configure> now adds B<-fwrapv> unless the user requests
1334B<-fno-wrapv>, which disables B<-fwrapv>, or B<-fsanitize=undefined>, which
1335turns the overflows B<-fwrapv> ignores into runtime errors.
1336[L<perl #121505|https://rt.perl.org/Public/Bug/Display.html?id=121505>]
1337
1338=back
1339
1340=head1 Testing
1341
1342=over 4
1343
1344=item *
1345
1346The C<test.valgrind> make target now allows tests to be run in parallel.
1347This target allows Perl's test suite to be run under Valgrind, which detects
1348certain sorts of C programming errors, though at significant cost in running
1349time. On suitable hardware, allowing parallel execution claws back a lot of
1350that additional cost. [perl #121431]
1351
1352=item *
1353
1354Various tests in F<t/porting/> are no longer skipped when the perl
1355F<.git> directory is outside the perl tree and pointed to by
1356C<$GIT_DIR>. [perl #120505]
1357
1358=item *
1359
1360The test suite no longer fails when the user's interactive shell maintains a
1361C<$PWD> environment variable, but the F</bin/sh> used for running tests
1362doesn't.
1363
1364=back
1365
1366=head1 Platform Support
1367
1368=head2 New Platforms
1369
1370=over 4
1371
1372=item Android
1373
1374Perl can now be built for Android, either natively or through
1375cross-compilation, for all three currently available architectures (ARM,
1376MIPS, and x86), on a wide range of versions.
1377
1378=item Bitrig
1379
1380Compile support has been added for Bitrig, a fork of OpenBSD.
1381
1382=item FreeMiNT
1383
1384Support has been added for FreeMiNT, a free open-source OS for the Atari ST
1385system and its successors, based on the original MiNT that was officially
1386adopted by Atari.
1387
1388=item Synology
1389
1390Synology ships its NAS boxes with a lean Linux distribution (DSM) on relative
1391cheap CPU's (like the Marvell Kirkwood mv6282 - ARMv5tel or Freescale QorIQ
1392P1022 ppc - e500v2) not meant for workstations or development. These boxes
1393should build now. The basic problems are the non-standard location for tools.
1394
1395=back
1396
1397=head2 Discontinued Platforms
1398
1399=over 4
1400
1401=item C<sfio>
1402
1403Code related to supporting the C<sfio> I/O system has been removed.
1404
1405Perl 5.004 added support to use the native API of C<sfio>, AT&T's Safe/Fast
1406I/O library. This code still built with v5.8.0, albeit with many regression
1407tests failing, but was inadvertently broken before the v5.8.1 release,
1408meaning that it has not worked on any version of Perl released since then.
1409In over a decade we have received no bug reports about this, hence it is clear
1410that no-one is using this functionality on any version of Perl that is still
1411supported to any degree.
1412
1413=item AT&T 3b1
1414
1415Configure support for the 3b1, also known as the AT&T Unix PC (and the similar
1416AT&T 7300), has been removed.
1417
1418=item DG/UX
1419
1420DG/UX was a Unix sold by Data General. The last release was in April 2001.
1421It only runs on Data General's own hardware.
1422
1423=item EBCDIC
1424
1425In the absence of a regular source of smoke reports, code intended to support
1426native EBCDIC platforms will be removed from perl before 5.22.0.
1427
1428=back
1429
1430=head2 Platform-Specific Notes
1431
1432=over 4
1433
1434=item Cygwin
1435
1436=over 4
1437
1438=item *
1439
1440recv() on a connected handle would populate the returned sender
1441address with whatever happened to be in the working buffer. recv()
1442now uses a workaround similar to the Win32 recv() wrapper and returns
1443an empty string when recvfrom(2) doesn't modify the supplied address
1444length. [perl #118843]
1445
1446=item *
1447
1448Fixed a build error in cygwin.c on Cygwin 1.7.28.
1449
1450Tests now handle the errors that occur when C<cygserver> isn't
1451running.
1452
1453=back
1454
1455=item GNU/Hurd
1456
1457The BSD compatibility library C<libbsd> is no longer required for builds.
1458
1459=item Linux
1460
1461The hints file now looks for C<libgdbm_compat> only if C<libgdbm> itself is
1462also wanted. The former is never useful without the latter, and in some
1463circumstances, including it could actually prevent building.
1464
1465=item Mac OS
1466
1467The build system now honors an C<ld> setting supplied by the user running
1468F<Configure>.
1469
1470=item MidnightBSD
1471
1472C<objformat> was removed from version 0.4-RELEASE of MidnightBSD and had been
1473deprecated on earlier versions. This caused the build environment to be
1474erroneously configured for C<a.out> rather than C<elf>. This has been now
1475been corrected.
1476
1477=item Mixed-endian platforms
1478
1479The code supporting C<pack> and C<unpack> operations on mixed endian
1480platforms has been removed. We believe that Perl has long been unable to
1481build on mixed endian architectures (such as PDP-11s), so we don't think
1482that this change will affect any platforms which were able to build v5.18.0.
1483
1484=item VMS
1485
1486=over 4
1487
1488=item *
1489
1490The C<PERL_ENV_TABLES> feature to control the population of %ENV at perl
1491start-up was broken in Perl 5.16.0 but has now been fixed.
1492
1493=item *
1494
1495Skip access checks on remotes in opendir(). [perl #121002]
1496
1497=item *
1498
1499A check for glob metacharacters in a path returned by the
1500L<C<glob()>|perlfunc/glob> operator has been replaced with a check for VMS
1501wildcard characters. This saves a significant number of unnecessary
1502L<C<lstat()>|perlfunc/lstat> calls such that some simple glob operations become
150360-80% faster.
1504
1505=back
1506
1507=item Win32
1508
1509=over 4
1510
1511=item *
1512
1513C<rename> and C<link> on Win32 now set $! to ENOSPC and EDQUOT when
1514appropriate. [perl #119857]
1515
1516=item *
1517
1518The BUILD_STATIC and ALL_STATIC makefile options for linking some or (nearly)
1519all extensions statically (into perl520.dll, and into a separate
1520perl-static.exe too) were broken for MinGW builds. This has now been fixed.
1521
1522The ALL_STATIC option has also been improved to include the Encode and Win32
1523extensions (for both VC++ and MinGW builds).
1524
1525=item *
1526
1527Support for building with Visual C++ 2013 has been added. There are currently
1528two possible test failures (see L<perlwin32/"Testing Perl on Windows">) which
1529will hopefully be resolved soon.
1530
1531=item *
1532
1533Experimental support for building with Intel C++ Compiler has been added. The
1534nmake makefile (win32/Makefile) and the dmake makefile (win32/makefile.mk) can
1535be used. A "nmake test" will not pass at this time due to F<cpan/CGI/t/url.t>.
1536
1537=item *
1538
1539Killing a process tree with L<perlfunc/kill> and a negative signal, was broken
1540starting in 5.18.0. In this bug, C<kill> always returned 0 for a negative
1541signal even for valid PIDs, and no processes were terminated. This has been
1542fixed [perl #121230].
1543
1544=item *
1545
1546The time taken to build perl on Windows has been reduced quite significantly
1547(time savings in the region of 30-40% are typically seen) by reducing the
1548number of, usually failing, I/O calls for each L<C<require()>|perlfunc/require>
1549(for B<miniperl.exe> only).
1550[L<perl #121119|https://rt.perl.org/Public/Bug/Display.html?id=121119>]
1551
1552=item *
1553
1554About 15 minutes of idle sleeping was removed from running C<make test> due to
1555a bug in which the timeout monitor used for tests could not be cancelled once
1556the test completes, and the full timeout period elapsed before running the next
1557test file.
1558[L<perl #121395|https://rt.perl.org/Public/Bug/Display.html?id=121395>]
1559
1560=item *
1561
1562On a perl built without pseudo-fork (pseudo-fork builds were not affected by
1563this bug), killing a process tree with L<C<kill()>|perlfunc/kill> and a negative
1564signal resulted in C<kill()> inverting the returned value. For example, if
1565C<kill()> killed 1 process tree PID then it returned 0 instead of 1, and if
1566C<kill()> was passed 2 invalid PIDs then it returned 2 instead of 0. This has
1567probably been the case since the process tree kill feature was implemented on
1568Win32. It has now been corrected to follow the documented behaviour.
1569[L<perl #121230|https://rt.perl.org/Public/Bug/Display.html?id=121230>]
1570
1571=item *
1572
1573When building a 64-bit perl, an uninitialized memory read in B<miniperl.exe>,
1574used during the build process, could lead to a 4GB B<wperl.exe> being created.
1575This has now been fixed. (Note that B<perl.exe> itself was unaffected, but
1576obviously B<wperl.exe> would have been completely broken.)
1577[L<perl #121471|https://rt.perl.org/Public/Bug/Display.html?id=121471>]
1578
1579=item *
1580
1581Perl can now be built with B<gcc> version 4.8.1 from L<http://www.mingw.org>.
1582This was previously broken due to an incorrect definition of DllMain() in one
1583of perl's source files. Earlier B<gcc> versions were also affected when using
1584version 4 of the w32api package. Versions of B<gcc> available from
1585L<http://mingw-w64.sourceforge.net/> were not affected.
1586[L<perl #121643|https://rt.perl.org/Public/Bug/Display.html?id=121643>]
1587
1588=item *
1589
1590The test harness now has no failures when perl is built on a FAT drive with the
1591Windows OS on an NTFS drive.
1592[L<perl #21442|https://rt.perl.org/Public/Bug/Display.html?id=21442>]
1593
1594=item *
1595
1596When cloning the context stack in fork() emulation, Perl_cx_dup()
1597would crash accessing parameter information for context stack entries
1598that included no parameters, as with C<&foo;>.
1599[L<perl #121721|https://rt.perl.org/Public/Bug/Display.html?id=121721>]
1600
58627cdf
DD
1601=item *
1602
47e6d4db
SH
1603Introduced by
1604L<perl #113536|https://rt.perl.org/Public/Bug/Display.html?id=113536>, a memory
1605leak on every call to C<system> and backticks (C< `` >), on most Win32 Perls
1606starting from 5.18.0 has been fixed. The memory leak only occurred if you
1607enabled psuedo-fork in your build of Win32 Perl, and were running that build on
1608Server 2003 R2 or newer OS. The leak does not appear on WinXP SP3.
1609[L<perl #121676|https://rt.perl.org/Public/Bug/Display.html?id=121676>]
58627cdf 1610
c68523cb
RS
1611=back
1612
1613=item WinCE
1614
1615=over 4
1616
1617=item *
1618
1619The building of XS modules has largely been restored. Several still cannot
1620(yet) be built but it is now possible to build Perl on WinCE with only a couple
1621of further patches (to L<Socket> and L<ExtUtils::MakeMaker>), hopefully to be
1622incorporated soon.
1623
1624=item *
1625
1626Perl can now be built in one shot with no user intervention on WinCE by running
1627C<nmake -f Makefile.ce all>.
1628
1629Support for building with EVC (Embedded Visual C++) 4 has been restored. Perl
1630can also be built using Smart Devices for Visual C++ 2005 or 2008.
1631
1632=back
1633
1634=back
1635
1636=head1 Internal Changes
1637
1638=over 4
1639
1640=item *
1641
1642The internal representation has changed for the match variables $1, $2 etc.,
1643$`, $&, $', ${^PREMATCH}, ${^MATCH} and ${^POSTMATCH}. It uses slightly less
1644memory, avoids string comparisons and numeric conversions during lookup, and
1645uses 23 fewer lines of C. This change should not affect any external code.
1646
1647=item *
1648
1649Arrays now use NULL internally to represent unused slots, instead of
1650&PL_sv_undef. &PL_sv_undef is no longer treated as a special value, so
1651av_store(av, 0, &PL_sv_undef) will cause element 0 of that array to hold a
1652read-only undefined scalar. C<$array[0] = anything> will croak and
1653C<\$array[0]> will compare equal to C<\undef>.
1654
1655=item *
1656
1657The SV returned by HeSVKEY_force() now correctly reflects the UTF8ness of the
1658underlying hash key when that key is not stored as a SV. [perl #79074]
1659
1660=item *
1661
1662Certain rarely used functions and macros available to XS code are now
1663deprecated. These are:
1664C<utf8_to_uvuni_buf> (use C<utf8_to_uvchr_buf> instead),
1665C<valid_utf8_to_uvuni> (use C<utf8_to_uvchr_buf> instead),
1666C<NATIVE_TO_NEED> (this did not work properly anyway),
1667and C<ASCII_TO_NEED> (this did not work properly anyway).
1668
1669Starting in this release, almost never does application code need to
1670distinguish between the platform's character set and Latin1, on which the
1671lowest 256 characters of Unicode are based. New code should not use
1672C<utf8n_to_uvuni> (use C<utf8_to_uvchr_buf> instead),
1673nor
1674C<uvuni_to_utf8> (use C<uvchr_to_utf8> instead),
1675
1676=item *
1677
1678The Makefile shortcut targets for many rarely (or never) used testing and
1679profiling targets have been removed, or merged into the only other Makefile
1680target that uses them. Specifically, these targets are gone, along with
1681documentation that referenced them or explained how to use them:
1682
1683 check.third check.utf16 check.utf8 coretest minitest.prep
1684 minitest.utf16 perl.config.dashg perl.config.dashpg
1685 perl.config.gcov perl.gcov perl.gprof perl.gprof.config
1686 perl.pixie perl.pixie.atom perl.pixie.config perl.pixie.irix
1687 perl.third perl.third.config perl.valgrind.config purecovperl
1688 pureperl quantperl test.deparse test.taintwarn test.third
1689 test.torture test.utf16 test.utf8 test_notty.deparse
1690 test_notty.third test_notty.valgrind test_prep.third
1691 test_prep.valgrind torturetest ucheck ucheck.third ucheck.utf16
1692 ucheck.valgrind utest utest.third utest.utf16 utest.valgrind
1693
1694It's still possible to run the relevant commands by "hand" - no underlying
1695functionality has been removed.
1696
1697=item *
1698
1699It is now possible to keep Perl from initializing locale handling.
1700For the most part, Perl doesn't pay attention to locale. (See
1701L<perllocale>.) Nonetheless, until now, on startup, it has always
1702initialized locale handling to the system default, just in case the
1703program being executed ends up using locales. (This is one of the first
1704things a locale-aware program should do, long before Perl knows if it
1705will actually be needed or not.) This works well except when Perl is
1706embedded in another application which wants a locale that isn't the
1707system default. Now, if the environment variable
1708C<PERL_SKIP_LOCALE_INIT> is set at the time Perl is started, this
1709initialization step is skipped. Prior to this, on Windows platforms,
1710the only workaround for this deficiency was to use a hacked-up copy of
1711internal Perl code. Applications that need to use older Perls can
1712discover if the embedded Perl they are using needs the workaround by
1713testing that the C preprocessor symbol C<HAS_SKIP_LOCALE_INIT> is not
1714defined. [RT #38193]
1715
1716=item *
1717
1718C<BmRARE> and C<BmPREVIOUS> have been removed. They were not used anywhere
1719and are not part of the API. For XS modules, they are now #defined as 0.
1720
1721=item *
1722
1723C<sv_force_normal>, which usually croaks on read-only values, used to allow
1724read-only values to be modified at compile time. This has been changed to
1725croak on read-only values regardless. This change uncovered several core
1726bugs.
1727
1728=item *
1729
1730Perl's new copy-on-write mechanism (which is now enabled by default),
1731allows any C<SvPOK> scalar to be automatically upgraded to a copy-on-write
1732scalar when copied. A reference count on the string buffer is stored in
1733the string buffer itself.
1734
1735For example:
1736
1737 $ perl -MDevel::Peek -e'$a="abc"; $b = $a; Dump $a; Dump $b'
1738 SV = PV(0x260cd80) at 0x2620ad8
1739 REFCNT = 1
1740 FLAGS = (POK,IsCOW,pPOK)
1741 PV = 0x2619bc0 "abc"\0
1742 CUR = 3
1743 LEN = 16
1744 COW_REFCNT = 1
1745 SV = PV(0x260ce30) at 0x2620b20
1746 REFCNT = 1
1747 FLAGS = (POK,IsCOW,pPOK)
1748 PV = 0x2619bc0 "abc"\0
1749 CUR = 3
1750 LEN = 16
1751 COW_REFCNT = 1
1752
1753Note that both scalars share the same PV buffer and have a COW_REFCNT
1754greater than zero.
1755
1756This means that XS code which wishes to modify the C<SvPVX()> buffer of an
1757SV should call C<SvPV_force()> or similar first, to ensure a valid (and
1758unshared) buffer, and to call C<SvSETMAGIC()> afterwards. This in fact has
1759always been the case (for example hash keys were already copy-on-write);
1760this change just spreads the COW behaviour to a wider variety of SVs.
1761
1762One important difference is that before 5.18.0, shared hash-key scalars
1763used to have the C<SvREADONLY> flag set; this is no longer the case.
1764
1765This new behaviour can still be disabled by running F<Configure> with
1766B<-Accflags=-DPERL_NO_COW>. This option will probably be removed in Perl
17675.22.
1768
1769=item *
1770
1771C<PL_sawampersand> is now a constant. The switch this variable provided
1772(to enable/disable the pre-match copy depending on whether C<$&> had been
1773seen) has been removed and replaced with copy-on-write, eliminating a few
1774bugs.
1775
1776The previous behaviour can still be enabled by running F<Configure> with
1777B<-Accflags=-DPERL_SAWAMPERSAND>.
1778
1779=item *
1780
1781The functions C<my_swap>, C<my_htonl> and C<my_ntohl> have been removed.
1782It is unclear why these functions were ever marked as I<A>, part of the
1783API. XS code can't call them directly, as it can't rely on them being
1784compiled. Unsurprisingly, no code on CPAN references them.
1785
1786=item *
1787
1788The signature of the C<Perl_re_intuit_start()> regex function has changed;
1789the function pointer C<intuit> in the regex engine plugin structure
1790has also changed accordingly. A new parameter, C<strbeg> has been added;
1791this has the same meaning as the same-named parameter in
1792C<Perl_regexec_flags>. Previously intuit would try to guess the start of
1793the string from the passed SV (if any), and would sometimes get it wrong
1794(e.g. with an overloaded SV).
1795
1796=item *
1797
36c4d3a0
TC
1798The signature of the C<Perl_regexec_flags()> regex function has
1799changed; the function pointer C<exec> in the regex engine plugin
1800structure has also changed to match. The C<minend> parameter now has
1801type C<SSize_t> to better support 64-bit systems.
1802
1803=item *
1804
c68523cb
RS
1805XS code may use various macros to change the case of a character or code
1806point (for example C<toLOWER_utf8()>). Only a couple of these were
1807documented until now;
1808and now they should be used in preference to calling the underlying
1809functions. See L<perlapi/Character case changing>.
1810
1811=item *
1812
1813The code dealt rather inconsistently with uids and gids. Some
1814places assumed that they could be safely stored in UVs, others
1815in IVs, others in ints. Four new macros are introduced:
1816SvUID(), sv_setuid(), SvGID(), and sv_setgid()
1817
1818=item *
1819
1820C<sv_pos_b2u_flags> has been added to the API. It is similar to C<sv_pos_b2u>,
1821but supports long strings on 64-bit platforms.
1822
1823=item *
1824
1825C<PL_exit_flags> can now be used by perl embedders or other XS code to have
1826perl C<warn> or C<abort> on an attempted exit. [perl #52000]
1827
1828=item *
1829
1830Compiling with C<-Accflags=-PERL_BOOL_AS_CHAR> now allows C99 and C++
1831compilers to emulate the aliasing of C<bool> to C<char> that perl does for
1832C89 compilers. [perl #120314]
1833
1834=item *
1835
1836The C<sv> argument in L<perlapi/sv_2pv_flags>, L<perlapi/sv_2iv_flags>,
1837L<perlapi/sv_2uv_flags>, and L<perlapi/sv_2nv_flags> and their older wrappers
1838sv_2pv, sv_2iv, sv_2uv, sv_2nv, is now non-NULL. Passing NULL now will crash.
1839When the non-NULL marker was introduced en masse in 5.9.3 the functions
1840were marked non-NULL, but since the creation of the SV API in 5.0 alpha 2, if
1841NULL was passed, the functions returned 0 or false-type values. The code that
1842supports C<sv> argument being non-NULL dates to 5.0 alpha 2 directly, and
1843indirectly to Perl 1.0 (pre 5.0 api). The lack of documentation that the
1844functions accepted a NULL C<sv> was corrected in 5.11.0 and between 5.11.0
1845and 5.19.5 the functions were marked NULLOK. As an optimization the NULLOK code
1846has now been removed, and the functions became non-NULL marked again, because
1847core getter-type macros never pass NULL to these functions and would crash
1848before ever passing NULL.
1849
1850The only way a NULL C<sv> can be passed to sv_2*v* functions is if XS code
1851directly calls sv_2*v*. This is unlikely as XS code uses Sv*V* macros to get
1852the underlying value out of the SV. One possible situation which leads to
1853a NULL C<sv> being passed to sv_2*v* functions, is if XS code defines its own
1854getter type Sv*V* macros, which check for NULL B<before> dereferencing and
1855checking the SV's flags through public API Sv*OK* macros or directly using
1856private API C<SvFLAGS>, and if C<sv> is NULL, then calling the sv_2*v functions
1857with a NULL litteral or passing the C<sv> containing a NULL value.
1858
1859=item *
1860
1861newATTRSUB is now a macro
1862
1863The public API newATTRSUB was previously a macro to the private
1864function Perl_newATTRSUB. Function Perl_newATTRSUB has been removed. newATTRSUB
1865is now macro to a different internal function.
1866
1867=item *
1868
1869Changes in warnings raised by C<utf8n_to_uvchr()>
1870
1871This bottom level function decodes the first character of a UTF-8 string
1872into a code point. It is accessible to C<XS> level code, but it's
1873discouraged from using it directly. There are higher level functions
1874that call this that should be used instead, such as
1875L<perlapi/utf8_to_uvchr_buf>. For completeness though, this documents
1876some changes to it. Now, tests for malformations are done before any
1877tests for other potential issues. One of those issues involves code
1878points so large that they have never appeared in any official standard
1879(the current standard has scaled back the highest acceptable code point
1880from earlier versions). It is possible (though not done in CPAN) to
1881warn and/or forbid these code points, while accepting smaller code
1882points that are still above the legal Unicode maximum. The warning
1883message for this now includes the code point if representable on the
1884machine. Previously it always displayed raw bytes, which is what it
1885still does for non-representable code points.
1886
1887=item *
1888
1889Regexp engine changes that affect the pluggable regex engine interface
1890
1891Many flags that used to be exposed via regexp.h and used to populate the
1892extflags member of struct regexp have been removed. These fields were
1893technically private to Perl's own regexp engine and should not have been
1894exposed there in the first place.
1895
1896The affected flags are:
1897
1898 RXf_NOSCAN
1899 RXf_CANY_SEEN
1900 RXf_GPOS_SEEN
1901 RXf_GPOS_FLOAT
1902 RXf_ANCH_BOL
1903 RXf_ANCH_MBOL
1904 RXf_ANCH_SBOL
1905 RXf_ANCH_GPOS
1906
1907As well as the follow flag masks:
1908
1909 RXf_ANCH_SINGLE
1910 RXf_ANCH
1911
1912All have been renamed to PREGf_ equivalents and moved to regcomp.h.
1913
1914The behavior previously achieved by setting one or more of the RXf_ANCH_
1915flags (via the RXf_ANCH mask) have now been replaced by a *single* flag bit
1916in extflags:
1917
1918 RXf_IS_ANCHORED
1919
1920pluggable regex engines which previously used to set these flags should
1921now set this flag ALONE.
1922
1923=item *
1924
1925The Perl core now consistently uses C<av_tindex()> ("the top index of an
1926array") as a more clearly-named synonym for C<av_len()>.
1927
1928=item *
1929
1930The obscure interpreter variable C<PL_timesbuf> is expected to be removed
1931early in the 5.21.x development series, so that Perl 5.22.0 will not provide
1932it to XS authors. While the variable still exists in 5.20.0, we hope that
1933this advance warning of the deprecation will help anyone who is using that
1934variable.
1935
1936=back
1937
1938=head1 Selected Bug Fixes
1939
1940=head2 Regular Expressions
1941
1942=over 4
1943
1944=item *
1945
1946Fixed a small number of regexp constructions that could either fail to
1947match or crash perl when the string being matched against was
1948allocated above the 2GB line on 32-bit systems. [RT #118175]
1949
1950=item *
1951
1952Various memory leaks involving the parsing of the C<(?[...])> regular
1953expression construct have been fixed.
1954
1955=item *
1956
1957C<(?[...])> now allows interpolation of precompiled patterns consisting of
1958C<(?[...])> with bracketed character classes inside (C<$pat =
1959S<qr/(?[ [a] ])/;> S</(?[ $pat ])/>>). Formerly, the brackets would
1960confuse the regular expression parser.
1961
1962=item *
1963
1964The "Quantifier unexpected on zero-length expression" warning message could
1965appear twice starting in Perl v5.10 for a regular expression also
1966containing alternations (e.g., "a|b") triggering the trie optimisation.
1967
1968=item *
1969
1970Perl v5.18 inadvertently introduced a bug whereby interpolating mixed up-
1971and down-graded UTF-8 strings in a regex could result in malformed UTF-8
1972in the pattern: specifically if a downgraded character in the range
1973C<\x80..\xff> followed a UTF-8 string, e.g.
1974
1975 utf8::upgrade( my $u = "\x{e5}");
1976 utf8::downgrade(my $d = "\x{e5}");
1977 /$u$d/
1978
1979[RT #118297]
1980
1981=item *
1982
1983In regular expressions containing multiple code blocks, the values of
1984C<$1>, C<$2>, etc., set by nested regular expression calls would leak from
1985one block to the next. Now these variables always refer to the outer
1986regular expression at the start of an embedded block [perl #117917].
1987
1988=item *
1989
1990C</$qr/p> was broken in Perl 5.18.0; the C</p> flag was ignored. This has been
1991fixed. [perl #118213]
1992
1993=item *
1994
1995Starting in Perl 5.18.0, a construct like C</[#](?{})/x> would have its C<#>
1996incorrectly interpreted as a comment. The code block would be skipped,
1997unparsed. This has been corrected.
1998
1999=item *
2000
2001Starting in Perl 5.001, a regular expression like C</[#$a]/x> or C</[#]$a/x>
2002would have its C<#> incorrectly interpreted as a comment, so the variable would
2003not interpolate. This has been corrected. [perl #45667]
2004
2005=item *
2006
2007Perl 5.18.0 inadvertently made dereferenced regular expressions
2008S<(C<${ qr// }>)> false as booleans. This has been fixed.
2009
2010=item *
2011
2012The use of C<\G> in regular expressions, where it's not at the start of the
2013pattern, is now slightly less buggy (although it is still somewhat
2014problematic).
2015
2016=item *
2017
2018Where a regular expression included code blocks (C</(?{...})/>), and where the
2019use of constant overloading triggered a re-compilation of the code block, the
2020second compilation didn't see its outer lexical scope. This was a regression
2021in Perl 5.18.0.
2022
2023=item *
2024
2025The string position set by C<pos> could shift if the string changed
2026representation internally to or from utf8. This could happen, e.g., with
2027references to objects with string overloading.
2028
2029=item *
2030
2031Taking references to the return values of two C<pos> calls with the same
2032argument, and then assigning a reference to one and C<undef> to the other,
2033could result in assertion failures or memory leaks.
2034
2035=item *
2036
2037Elements of @- and @+ now update correctly when they refer to non-existent
2038captures. Previously, a referenced element (C<$ref = \$-[1]>) could refer to
2039the wrong match after subsequent matches.
2040
2041=item *
2042
2043The code that parses regex backrefs (or ambiguous backref/octals) such as \123
2044did a simple atoi(), which could wrap round to negative values on long digit
2045strings and cause segmentation faults. This has now been fixed. [perl
2046#119505]
2047
2048=item *
2049
2050Assigning another typeglob to C<*^R> no longer makes the regular expression
2051engine crash.
2052
2053=item *
2054
2055The C<\N> regular expression escape, when used without the curly braces (to
2056mean C<[^\n]>), was ignoring a following C<*> if followed by whitespace
2057under /x. It had been this way since C<\N> to mean C<[^\n]> was introduced
2058in 5.12.0.
2059
2060=item *
2061
2062C<s///>, C<tr///> and C<y///> now work when a wide character is used as the
2063delimiter. [perl #120463]
2064
2065=item *
2066
2067Some cases of unterminated (?...) sequences in regular expressions (e.g.,
2068C</(?</>) have been fixed to produce the proper error message instead of
2069"panic: memory wrap". Other cases (e.g., C</(?(/>) have yet to be fixed.
2070
2071=item *
2072
2073When a reference to a reference to an overloaded object was returned from
2074a regular expression C<(??{...})> code block, an incorrect implicit
2075dereference could take place if the inner reference had been returned by
2076a code block previously.
2077
2078=item *
2079
2080A tied variable returned from C<(??{...})> sees the inner values of match
2081variables (i.e., the $1 etc. from any matches inside the block) in its
2082FETCH method. This was not the case if a reference to an overloaded object
2083was the last thing assigned to the tied variable. Instead, the match
2084variables referred to the outer pattern during the FETCH call.
2085
2086=item *
2087
2088Fix unexpected tainting via regexp using locale. Previously, under certain
2089conditions, the use of character classes could cause tainting when it
2090shouldn't. Some character classes are locale-dependent, but before this
2091patch, sometimes tainting was happening even for character classes that
2092don't depend on the locale. [perl #120675]
2093
2094=item *
2095
2096Under certain conditions, Perl would throw an error if in an lookbehind
2097assertion in a regexp, the assertion referred to a named subpattern,
2098complaining the lookbehind was variable when it wasn't. This has been
2099fixed. [perl #120600], [perl #120618]. The current fix may be improved
2100on in the future.
2101
2102=item *
2103
2104C<$^R> wasn't available outside of the regular expression that
2105initialized it. [perl #121070]
2106
2107=item *
2108
2109A large set of fixes and refactoring for re_intuit_start() was merged,
2110the highlights are:
2111
2112=over
2113
2114=item *
2115
2116Fixed a panic when compiling the regular expression
2117C</\x{100}[xy]\x{100}{2}/>.
2118
2119=item *
2120
2121Fixed a performance regression when performing a global pattern match
2122against a UTF-8 string. [perl #120692]
2123
2124=item *
2125
2126Fixed another performance issue where matching a regular expression
2127like C</ab.{1,2}x/> against a long UTF-8 string would unnecessarily
2128calculate byte offsets for a large portion of the string. [perl
2129#120692]
2130
2131=back
2132
2133=item *
2134
2135Fixed an alignment error when compiling regular expressions when built
2136with GCC on HP-UX 64-bit.
2137
2138=item *
2139
2140On 64-bit platforms C<pos> can now be set to a value higher than 2**31-1.
2141[perl #72766]
2142
2143=back
2144
2145=head2 Perl 5 Debugger and -d
2146
2147=over 4
2148
2149=item *
2150
2151The debugger's C<man> command been fixed. It was broken in the v5.18.0
2152release. The C<man> command is aliased to the names C<doc> and C<perldoc> -
2153all now work again.
2154
2155=item *
2156
2157C<@_> is now correctly visible in the debugger, fixing a regression
2158introduced in v5.18.0's debugger. [RT #118169]
2159
2160=item *
2161
2162Under copy-on-write builds (the default as of 5.20.0) C<< ${'_<-e'}[0] >>
2163no longer gets mangled. This is the first line of input saved for the
2164debugger's use for one-liners [perl #118627].
2165
2166=item *
2167
2168On non-threaded builds, setting C<${"_E<lt>filename"}> to a reference or
2169typeglob no longer causes C<__FILE__> and some error messages to produce a
2170corrupt string, and no longer prevents C<#line> directives in string evals from
2171providing the source lines to the debugger. Threaded builds were unaffected.
2172
2173=item *
2174
2175Starting with Perl 5.12, line numbers were off by one if the B<-d> switch was
2176used on the #! line. Now they are correct.
2177
2178=item *
2179
2180C<*DB::DB = sub {} if 0> no longer stops Perl's debugging mode from finding
2181C<DB::DB> subs declared thereafter.
2182
2183=item *
2184
2185C<%{'_<...'}> hashes now set breakpoints on the corresponding C<@{'_<...'}>
2186rather than whichever array C<@DB::dbline> is aliased to. [perl #119799]
2187
2188=item *
2189
2190Call set-magic when setting $DB::sub. [perl #121255]
2191
2192=item *
2193
2194The debugger's "n" command now respects lvalue subroutines and steps over
2195them [perl #118839].
2196
2197=back
2198
2199=head2 Lexical Subroutines
2200
2201=over 4
2202
2203=item *
2204
2205Lexical constants (C<my sub a() { 42 }>) no longer crash when inlined.
2206
2207=item *
2208
2209Parameter prototypes attached to lexical subroutines are now respected when
2210compiling sub calls without parentheses. Previously, the prototypes were
2211honoured only for calls I<with> parentheses. [RT #116735]
2212
2213=item *
2214
2215Syntax errors in lexical subroutines in combination with calls to the same
2216subroutines no longer cause crashes at compile time.
2217
2218=item *
2219
2220Deep recursion warnings no longer crash lexical subroutines. [RT #118521]
2221
2222=item *
2223
2224The dtrace sub-entry probe now works with lexical subs, instead of
2225crashing [perl #118305].
2226
2227=item *
2228
2229Undefining an inlinable lexical subroutine (C<my sub foo() { 42 } undef
2230&foo>) would result in a crash if warnings were turned on.
2231
2232=item *
2233
2234An undefined lexical sub used as an inherited method no longer crashes.
2235
2236=item *
2237
2238The presence of a lexical sub named "CORE" no longer stops the CORE::
2239prefix from working.
2240
2241=back
2242
2243=head2 Everything Else
2244
2245=over 4
2246
2247=item *
2248
2249The OP allocation code now returns correctly aligned memory in all cases
2250for C<struct pmop>. Previously it could return memory only aligned to a
22514-byte boundary, which is not correct for an ithreads build with 64 bit IVs
2252on some 32 bit platforms. Notably, this caused the build to fail completely
2253on sparc GNU/Linux. [RT #118055]
2254
2255=item *
2256
2257Evaluating large hashes in scalar context is now much faster, as the number
2258of used chains in the hash is now cached for larger hashes. Smaller hashes
2259continue not to store it and calculate it when needed, as this saves one IV.
2260That would be 1 IV overhead for every object built from a hash. [RT #114576]
2261
2262=item *
2263
2264Perl v5.16 inadvertently introduced a bug whereby calls to XSUBs that were
2265not visible at compile time were treated as lvalues and could be assigned
2266to, even when the subroutine was not an lvalue sub. This has been fixed.
2267[RT #117947]
2268
2269=item *
2270
2271In Perl v5.18.0 dualvars that had an empty string for the string part but a
2272non-zero number for the number part starting being treated as true. In
2273previous versions they were treated as false, the string representation
2274taking precedeence. The old behaviour has been restored. [RT #118159]
2275
2276=item *
2277
2278Since Perl v5.12, inlining of constants that override built-in keywords of
2279the same name had countermanded C<use subs>, causing subsequent mentions of
2280the constant to use the built-in keyword instead. This has been fixed.
2281
2282=item *
2283
2284The warning produced by C<-l $handle> now applies to IO refs and globs, not
2285just to glob refs. That warning is also now UTF8-clean. [RT #117595]
2286
2287=item *
2288
2289C<delete local $ENV{nonexistent_env_var}> no longer leaks memory.
2290
2291=item *
2292
2293C<sort> and C<require> followed by a keyword prefixed with C<CORE::> now
2294treat it as a keyword, and not as a subroutine or module name. [RT #24482]
2295
2296=item *
2297
2298Through certain conundrums, it is possible to cause the current package to
2299be freed. Certain operators (C<bless>, C<reset>, C<open>, C<eval>) could
2300not cope and would crash. They have been made more resilient. [RT #117941]
2301
2302=item *
2303
2304Aliasing filehandles through glob-to-glob assignment would not update
2305internal method caches properly if a package of the same name as the
2306filehandle existed, resulting in filehandle method calls going to the
2307package instead. This has been fixed.
2308
2309=item *
2310
2311C<./Configure -de -Dusevendorprefix> didn't default. [RT #64126]
2312
2313=item *
2314
2315The C<Statement unlikely to be reached> warning was listed in
2316L<perldiag> as an C<exec>-category warning, but was enabled and disabled
2317by the C<syntax> category. On the other hand, the C<exec> category
2318controlled its fatal-ness. It is now entirely handled by the C<exec>
2319category.
2320
2321=item *
2322
2323The "Replacement list is longer that search list" warning for C<tr///> and
2324C<y///> no longer occurs in the presence of the C</c> flag. [RT #118047]
2325
2326=item *
2327
2328Stringification of NVs are not cached so that the lexical locale controls
2329stringification of the decimal point. [perl #108378] [perl #115800]
2330
2331=item *
2332
2333There have been several fixes related to Perl's handling of locales. perl
2334#38193 was described above in L</Internal Changes>.
2335Also fixed is
2336#118197, where the radix (decimal point) character had to be an ASCII
2337character (which doesn't work for some non-Western languages);
2338and #115808, in which C<POSIX::setlocale()> on failure returned an
2339C<undef> which didn't warn about not being defined even if those
2340warnings were enabled.
2341
2342=item *
2343
2344Compiling a C<split> operator whose third argument is a named constant
2345evaulating to 0 no longer causes the constant's value to change.
2346
2347=item *
2348
2349A named constant used as the second argument to C<index> no longer gets
2350coerced to a string if it is a reference, regular expression, dualvar, etc.
2351
2352=item *
2353
2354A named constant evaluating to the undefined value used as the second
2355argument to C<index> no longer produces "uninitialized" warnings at compile
2356time. It will still produce them at run time.
2357
2358=item *
2359
2360When a scalar was returned from a subroutine in @INC, the referenced scalar
2361was magically converted into an IO thingy, possibly resulting in "Bizarre
2362copy" errors if that scalar continued to be used elsewhere. Now Perl uses
2363an internal copy of the scalar instead.
2364
2365=item *
2366
2367Certain uses of the C<sort> operator are optimised to modify an array in
2368place, such as C<@a = sort @a>. During the sorting, the array is made
2369read-only. If a sort block should happen to die, then the array remained
2370read-only even outside the C<sort>. This has been fixed.
2371
2372=item *
2373
2374C<$a> and C<$b> inside a sort block are aliased to the actual arguments to
2375C<sort>, so they can be modified through those two variables. This did not
2376always work, e.g., for lvalue subs and C<$#ary>, and probably many other
2377operators. It works now.
2378
2379=item *
2380
2381The arguments to C<sort> are now all in list context. If the C<sort>
2382itself were called in void or scalar context, then I<some>, but not all, of
2383the arguments used to be in void or scalar context.
2384
2385=item *
2386
2387Subroutine prototypes with Unicode characters above U+00FF were getting
2388mangled during closure cloning. This would happen with subroutines closing
2389over lexical variables declared outside, and with lexical subs.
2390
2391=item *
2392
2393C<UNIVERSAL::can> now treats its first argument the same way that method
2394calls do: Typeglobs and glob references with non-empty IO slots are treated
2395as handles, and strings are treated as filehandles, rather than packages,
2396if a handle with that name exists [perl #113932].
2397
2398=item *
2399
2400Method calls on typeglobs (e.g., C<< *ARGV->getline >>) used to stringify
2401the typeglob and then look it up again. Combined with changes in Perl
24025.18.0, this allowed C<< *foo->bar >> to call methods on the "foo" package
2403(like C<< foo->bar >>). In some cases it could cause the method to be
2404called on the wrong handle. Now a typeglob argument is treated as a
2405handle (just like C<< (\*foo)->bar >>), or, if its IO slot is empty, an
2406error is raised.
2407
2408=item *
2409
2410Assigning a vstring to a tied variable or to a subroutine argument aliased
2411to a nonexistent hash or array element now works, without flattening the
2412vstring into a regular string.
2413
2414=item *
2415
2416C<pos>, C<tie>, C<tied> and C<untie> did not work
2417properly on subroutine arguments aliased to nonexistent
2418hash and array elements [perl #77814, #27010].
2419
2420=item *
2421
2422The C<< => >> fat arrow operator can now quote built-in keywords even if it
2423occurs on the next line, making it consistent with how it treats other
2424barewords.
2425
2426=item *
2427
2428Autovivifying a subroutine stub via C<\&$glob> started causing crashes in Perl
24295.18.0 if the $glob was merely a copy of a real glob, i.e., a scalar that had
2430had a glob assigned to it. This has been fixed. [perl #119051]
2431
2432=item *
2433
2434Perl used to leak an implementation detail when it came to referencing the
2435return values of certain operators. C<for ($a+$b) { warn \$_; warn \$_ }> used
2436to display two different memory addresses, because the C<\> operator was
2437copying the variable. Under threaded builds, it would also happen for
2438constants (C<for(1) { ... }>). This has been fixed. [perl #21979, #78194,
2439#89188, #109746, #114838, #115388]
2440
2441=item *
2442
2443The range operator C<..> was returning the same modifiable scalars with each
2444call, unless it was the only thing in a C<foreach> loop header. This meant
2445that changes to values within the list returned would be visible the next time
2446the operator was executed. [perl #3105]
2447
2448=item *
2449
2450Constant folding and subroutine inlining no longer cause operations that would
2451normally return new modifiable scalars to return read-only values instead.
2452
2453=item *
2454
2455Closures of the form C<sub () { $some_variable }> are no longer inlined,
2456causing changes to the variable to be ignored by callers of the subroutine.
2457[perl #79908]
2458
2459=item *
2460
2461Return values of certain operators such as C<ref> would sometimes be shared
2462between recursive calls to the same subroutine, causing the inner call to
2463modify the value returned by C<ref> in the outer call. This has been fixed.
2464
2465=item *
2466
2467C<__PACKAGE__> and constants returning a package name or hash key are now
2468consistently read-only. In various previous Perl releases, they have become
2469mutable under certain circumstances.
2470
2471=item *
2472
2473Enabling "used once" warnings no longer causes crashes on stash circularities
2474created at compile time (C<*Foo::Bar::Foo:: = *Foo::>).
2475
2476=item *
2477
2478Undef constants used in hash keys (C<use constant u =E<gt> undef; $h{+u}>) no
2479longer produce "uninitialized" warnings at compile time.
2480
2481=item *
2482
2483Modifying a substitution target inside the substitution replacement no longer
2484causes crashes.
2485
2486=item *
2487
2488The first statement inside a string eval used to use the wrong pragma setting
2489sometimes during constant folding. C<eval 'uc chr 0xe0'> would randomly choose
2490between Unicode, byte, and locale semantics. This has been fixed.
2491
2492=item *
2493
2494The handling of return values of @INC filters (subroutines returned by
2495subroutines in @INC) has been fixed in various ways. Previously tied variables
2496were mishandled, and setting $_ to a reference or typeglob could result in
2497crashes.
2498
2499=item *
2500
2501The C<SvPVbyte> XS function has been fixed to work with tied scalars returning
2502something other than a string. It used to return utf8 in those cases where
2503C<SvPV> would.
2504
2505=item *
2506
2507Perl 5.18.0 inadvertently made C<--> and C<++> crash on dereferenced regular
2508expressions, and stopped C<++> from flattening vstrings.
2509
2510=item *
2511
2512C<bless> no longer dies with "Can't bless non-reference value" if its first
2513argument is a tied reference.
2514
2515=item *
2516
2517C<reset> with an argument no longer skips copy-on-write scalars, regular
2518expressions, typeglob copies, and vstrings. Also, when encountering those or
2519read-only values, it no longer skips any array or hash with the same name.
2520
2521=item *
2522
2523C<reset> with an argument now skips scalars aliased to typeglobs
2524(C<for $z (*foo) { reset "z" }>). Previously it would corrupt memory or crash.
2525
2526=item *
2527
2528C<ucfirst> and C<lcfirst> were not respecting the bytes pragma. This was a
2529regression from Perl 5.12. [perl #117355]
2530
2531=item *
2532
2533Changes to C<UNIVERSAL::DESTROY> now update DESTROY caches in all classes,
2534instead of causing classes that have already had objects destroyed to continue
2535using the old sub. This was a regression in Perl 5.18. [perl #114864]
2536
2537=item *
2538
2539All known false-positive occurrences of the deprecation warning "Useless use of
2540'\'; doesn't escape metacharacter '%c'", added in Perl 5.18.0, have been
2541removed. [perl #119101]
2542
2543=item *
2544
2545The value of $^E is now saved across signal handlers on Windows. [perl #85104]
2546
2547=item *
2548
2549A lexical filehandle (as in C<open my $fh...>) is usually given a name based on
2550the current package and the name of the variable, e.g. "main::$fh". Under
2551recursion, the filehandle was losing the "$fh" part of the name. This has been
2552fixed.
2553
2554=item *
2555
2556Uninitialized values returned by XSUBs are no longer exempt from uninitialized
2557warnings. [perl #118693]
2558
2559=item *
2560
2561C<elsif ("")> no longer erroneously produces a warning about void context.
2562[perl #118753]
2563
2564=item *
2565
2566Passing C<undef> to a subroutine now causes @_ to contain the same read-only
2567undefined scalar that C<undef> returns. Furthermore, C<exists $_[0]> will now
2568return true if C<undef> was the first argument. [perl #7508, #109726]
2569
2570=item *
2571
2572Passing a non-existent array element to a subroutine does not usually
2573autovivify it unless the subroutine modifies its argument. This did not work
2574correctly with negative indices and with non-existent elements within the
2575array. The element would be vivified immediately. The delayed vivification
2576has been extended to work with those. [perl #118691]
2577
2578=item *
2579
2580Assigning references or globs to the scalar returned by $#foo after the @foo
2581array has been freed no longer causes assertion failures on debugging builds
2582and memory leaks on regular builds.
2583
2584=item *
2585
2586On 64-bit platforms, large ranges like 1..1000000000000 no longer crash, but
2587eat up all your memory instead. [perl #119161]
2588
2589=item *
2590
2591C<__DATA__> now puts the C<DATA> handle in the right package, even if the
2592current package has been renamed through glob assignment.
2593
2594=item *
2595
2596When C<die>, C<last>, C<next>, C<redo>, C<goto> and C<exit> unwind the scope,
2597it is possible for C<DESTROY> recursively to call a subroutine or format that
2598is currently being exited. It that case, sometimes the lexical variables
2599inside the sub would start out having values from the outer call, instead of
2600being undefined as they should. This has been fixed. [perl #119311]
2601
2602=item *
2603
2604${^MPEN} is no longer treated as a synonym for ${^MATCH}.
2605
2606=item *
2607
2608Perl now tries a little harder to return the correct line number in
2609C<(caller)[2]>. [perl #115768]
2610
2611=item *
2612
2613Line numbers inside multiline quote-like operators are now reported correctly.
2614[perl #3643]
2615
2616=item *
2617
2618C<#line> directives inside code embedded in quote-like operators are now
2619respected.
2620
2621=item *
2622
2623Line numbers are now correct inside the second here-doc when two here-doc
2624markers occur on the same line.
2625
2626=item *
2627
2628An optimization in Perl 5.18 made incorrect assumptions causing a bad
2629interaction with the L<Devel::CallParser> CPAN module. If the module was
2630loaded then lexical variables declared in separate statements following a
2631C<my(...)> list might fail to be cleared on scope exit.
2632
2633=item *
2634
2635C<&xsub> and C<goto &xsub> calls now allow the called subroutine to autovivify
2636elements of @_.
2637
2638=item *
2639
2640C<&xsub> and C<goto &xsub> no longer crash if *_ has been undefined and has no
2641ARRAY entry (i.e. @_ does not exist).
2642
2643=item *
2644
2645C<&xsub> and C<goto &xsub> now work with tied @_.
2646
2647=item *
2648
2649Overlong identifiers no longer cause a buffer overflow (and a crash). They
2650started doing so in Perl 5.18.
2651
2652=item *
2653
2654The warning "Scalar value @hash{foo} better written as $hash{foo}" now produces
2655far fewer false positives. In particular, C<@hash{+function_returning_a_list}>
2656and C<@hash{ qw "foo bar baz" }> no longer warn. The same applies to array
2657slices. [perl #28380, #114024]
2658
2659=item *
2660
2661C<$! = EINVAL; waitpid(0, WNOHANG);> no longer goes into an internal infinite
2662loop. [perl #85228]
2663
2664=item *
2665
2666A possible segmentation fault in filehandle duplication has been fixed.
2667
2668=item *
2669
2670A subroutine in @INC can return a reference to a scalar containing the initial
2671contents of the file. However, that scalar was freed prematurely if not
2672referenced elsewhere, giving random results.
2673
2674=item *
2675
2676C<last> no longer returns values that the same statement has accumulated so
2677far, fixing amongst other things the long-standing bug that C<push @a, last>
2678would try to return the @a, copying it like a scalar in the process and
2679resulting in the error, "Bizarre copy of ARRAY in last." [perl #3112]
2680
2681=item *
2682
2683In some cases, closing file handles opened to pipe to or from a process, which
2684had been duplicated into a standard handle, would call perl's internal waitpid
2685wrapper with a pid of zero. With the fix for [perl #85228] this zero pid was
2686passed to C<waitpid>, possibly blocking the process. This wait for process
2687zero no longer occurs. [perl #119893]
2688
2689=item *
2690
2691C<select> used to ignore magic on the fourth (timeout) argument, leading to
2692effects such as C<select> blocking indefinitely rather than the expected sleep
2693time. This has now been fixed. [perl #120102]
2694
2695=item *
2696
2697The class name in C<for my class $foo> is now parsed correctly. In the case of
2698the second character of the class name being followed by a digit (e.g. 'a1b')
2699this used to give the error "Missing $ on loop variable". [perl #120112]
2700
2701=item *
2702
2703Perl 5.18.0 accidentally disallowed C<-bareword> under C<use strict> and
2704C<use integer>. This has been fixed. [perl #120288]
2705
2706=item *
2707
2708C<-a> at the start of a line (or a hyphen with any single letter that is
2709not a filetest operator) no longer produces an erroneous 'Use of "-a"
2710without parentheses is ambiguous' warning. [perl #120288]
2711
2712=item *
2713
2714Lvalue context is now properly propagated into bare blocks and C<if> and
2715C<else> blocks in lvalue subroutines. Previously, arrays and hashes would
2716sometimes incorrectly be flattened when returned in lvalue list context, or
2717"Bizarre copy" errors could occur. [perl #119797]
2718
2719=item *
2720
2721Lvalue context is now propagated to the branches of C<||> and C<&&> (and
2722their alphabetic equivalents, C<or> and C<and>). This means
2723C<foreach (pos $x || pos $y) {...}> now allows C<pos> to be modified
2724through $_.
2725
2726=item *
2727
2728C<stat> and C<readline> remember the last handle used; the former
2729for the special C<_> filehandle, the latter for C<${^LAST_FH}>.
2730C<eval "*foo if 0"> where *foo was the last handle passed to C<stat>
2731or C<readline> could cause that handle to be forgotten if the
2732handle were not opened yet. This has been fixed.
2733
2734=item *
2735
2736Various cases of C<delete $::{a}>, C<delete $::{ENV}> etc. causing a crash
2737have been fixed. [perl #54044]
2738
2739=item *
2740
2741Setting C<$!> to EACCESS before calling C<require> could affect
2742C<require>'s behaviour. This has been fixed.
2743
2744=item *
2745
2746The "Can't use \1 to mean $1 in expression" warning message now only occurs
2747on the right-hand (replacement) part of a substitution. Formerly it could
2748happen in code embedded in the left-hand side, or in any other quote-like
2749operator.
2750
2751=item *
2752
2753Blessing into a reference (C<bless $thisref, $thatref>) has long been
2754disallowed, but magical scalars for the second like C<$/> and those tied
2755were exempt. They no longer are. [perl #119809]
2756
2757=item *
2758
2759Blessing into a reference was accidentally allowed in 5.18 if the class
2760argument were a blessed reference with stale method caches (i.e., whose
2761class had had subs defined since the last method call). They are
2762disallowed once more, as in 5.16.
2763
2764=item *
2765
2766C<< $x->{key} >> where $x was declared as C<my Class $x> no longer crashes
2767if a Class::FIELDS subroutine stub has been declared.
2768
2769=item *
2770
2771C<@$obj{'key'}> and C<${$obj}{key}> used to be exempt from compile-time
2772field checking ("No such class field"; see L<fields>) but no longer are.
2773
2774=item *
2775
2776A nonexistent array element with a large index passed to a subroutine that
2777ties the array and then tries to access the element no longer results in a
2778crash.
2779
2780=item *
2781
2782Declaring a subroutine stub named NEGATIVE_INDICES no longer makes negative
2783array indices crash when the current package is a tied array class.
2784
2785=item *
2786
2787Declaring a C<require>, C<glob>, or C<do> subroutine stub in the
2788CORE::GLOBAL:: package no longer makes compilation of calls to the
2789corresponding functions crash.
2790
2791=item *
2792
2793Aliasing CORE::GLOBAL:: functions to constants stopped working in Perl 5.10
2794but has now been fixed.
2795
2796=item *
2797
2798When C<`...`> or C<qx/.../> calls a C<readpipe> override, double-quotish
2799interpolation now happens, as is the case when there is no override.
2800Previously, the presence of an override would make these quote-like
2801operators act like C<q{}>, suppressing interpolation. [perl #115330]
2802
2803=item *
2804
2805C<<<<`...`> here-docs (with backticks as the delimiters) now call
2806C<readpipe> overrides. [perl #119827]
2807
2808=item *
2809
2810C<&CORE::exit()> and C<&CORE::die()> now respect L<vmsish> hints.
2811
2812=item *
2813
2814Undefining a glob that triggers a DESTROY method that undefines the same
2815glob is now safe. It used to produce "Attempt to free unreferenced glob
2816pointer" warnings and leak memory.
2817
2818=item *
2819
2820If subroutine redefinition (C<eval 'sub foo{}'> or C<newXS> for XS code)
2821triggers a DESTROY method on the sub that is being redefined, and that
2822method assigns a subroutine to the same slot (C<*foo = sub {}>), C<$_[0]>
2823is no longer left pointing to a freed scalar. Now DESTROY is delayed until
2824the new subroutine has been installed.
2825
2826=item *
2827
2828On Windows, perl no longer calls CloseHandle() on a socket handle. This makes
2829debugging easier on Windows by removing certain irrelevant bad handle
2830exceptions. It also fixes a race condition that made socket functions randomly
2831fail in a Perl process with multiple OS threads, and possible test failures in
2832F<dist/IO/t/cachepropagate-tcp.t>. [perl #120091/118059]
2833
2834=item *
2835
2836Strange vars like ties, overloads, or stringified refs (and in recent
2837perls, pure NOK vars) would generally do the wrong thing in formats
2838when the var is treated as a string and repeatedly chopped, as in
2839C<< ^<<<~~ >> and similar. This has now been resolved.
2840
2841=item *
2842
2843C<< semctl(..., SETVAL, ...) >> would set the semaphore to the top
284432-bits of the supplied integer instead of the bottom 32-bits on
284564-bit big-endian systems. [perl #120635]
2846
2847=item *
2848
2849C<< readdir() >> now only sets C<$!> on error. C<$!> is no longer set
2850to C<EBADF> when then terminating C<undef> is read from the directory
2851unless the system call sets C<$!>. [perl #118651]
2852
2853=item *
2854
2855C<&CORE::glob> no longer causes an intermittent crash due to perl's stack
2856getting corrupted. [perl #119993]
2857
2858=item *
2859
2860C<open> with layers that load modules (e.g., "<:encoding(utf8)") no longer
2861runs the risk of crashing due to stack corruption.
2862
2863=item *
2864
2865Perl 5.18 broke autoloading via C<< ->SUPER::foo >> method calls by looking
2866up AUTOLOAD from the current package rather than the current package's
2867superclass. This has been fixed. [perl #120694]
2868
2869=item *
2870
2871A longstanding bug causing C<do {} until CONSTANT>, where the constant
2872holds a true value, to read unallocated memory has been resolved. This
2873would usually happen after a syntax error. In past versions of Perl it has
2874crashed intermittently. [perl #72406]
2875
2876=item *
2877
2878Fix HP-UX C<$!> failure. HP-UX strerror() returns an empty string for an
2879unknown error code. This caused an assertion to fail under DEBUGGING
2880builds. Now instead, the returned string for C<"$!"> contains text
2881indicating the code is for an unknown error.
2882
2883=item *
2884
2885Individually-tied elements of @INC (as in C<tie $INC[0]...>) are now
2886handled correctly. Formerly, whether a sub returned by such a tied element
2887would be treated as a sub depended on whether a FETCH had occurred
2888previously.
2889
2890=item *
2891
2892C<getc> on a byte-sized handle after the same C<getc> operator had been
2893used on a utf8 handle used to treat the bytes as utf8, resulting in erratic
2894behavior (e.g., malformed UTF-8 warnings).
2895
2896=item *
2897
2898An initial C<{> at the beginning of a format argument line was always
2899interpreted as the beginning of a block prior to v5.18. In Perl v5.18, it
2900started being treated as an ambiguous token. The parser would guess
2901whether it was supposed to be an anonymous hash constructor or a block
2902based on the contents. Now the previous behavious has been restored.
2903[perl #119973]
2904
2905=item *
2906
2907In Perl v5.18 C<undef *_; goto &sub> and C<local *_; goto &sub> started
2908crashing. This has been fixed. [perl #119949]
2909
2910=item *
2911
2912Backticks (C< `` > or C< qx// >) combined with multiple threads on
2913Win32 could result in output sent to stdout on one thread being
2914captured by backticks of an external command in another thread.
2915
2916This could occur for pseudo-forked processes too, as Win32's
2917pseudo-fork is implemented in terms of threads. [perl #77672]
2918
2919=item *
2920
2921C<< open $fh, ">+", undef >> no longer leaks memory when TMPDIR is set
2922but points to a directory a temporary file cannot be created in. [perl
2923#120951]
2924
2925=item *
2926
2927C< for ( $h{k} || '' ) > no longer auto-vivifies C<$h{k}>. [perl
2928#120374]
2929
2930=item *
2931
2932On Windows machines, Perl now emulates the POSIX use of the environment
2933for locale initialization. Previously, the environment was ignored.
2934See L<perllocale/ENVIRONMENT>.
2935
2936=item *
2937
2938Fixed a crash when destroying a self-referencing GLOB. [perl #121242]
2939
2940=back
2941
2942=head1 Known Problems
2943
2944=over 4
2945
2946=item *
2947
2948The following modules are known to have test failures with this version of
2949Perl. Patches have been submitted, so there will hopefully be new releases
2950soon:
2951
2952XXX Go through this list just before the release of 5.20 and remove any
2953modules that have been fixed.
2954
2955=over
2956
2957=item *
2958
2959L<Data::Structure::Util> version 0.15
2960
2961=item *
2962
2963L<Data::Util> version 0.62
2964
2965=item *
2966
2967L<HTML::StripScripts> version 1.05
2968
2969=item *
2970
2971L<LaTeX::Encode> version 0.08
2972
2973=item *
2974
2975L<List::Gather> version 0.08.
2976
2977=item *
2978
2979L<Mail::SpamAssassin> version 3.3.2
2980
2981=item *
2982
2983L<RDF::Trine>. The test failures are actually due to a bug in
2984L<XML::LibXML> version 2.0108. A patch to XML::LibXML has been submitted.
2985
2986=back
2987
2988=back
7ef8b31d 2989
58121923 2990=head1 Obituary
33eca75a
RS
2991
2992Diana Rosa, 27, of Rio de Janeiro, went to her long rest on May 10,
29932014, along with the plush camel she kept hanging on her computer screen
2994all the time. She was a passionate Perl hacker who loved the language and its
2995community, and who never missed a Rio.pm event. She was a true artist, an
2996enthusiast about writing code, singing arias and graffiting walls. We'll never
2997forget you.
2998
7ef8b31d 2999=head1 Acknowledgements
52e02e68 3000
7f7f2dcc
RS
3001Perl 5.20.0 represents approximately 12 months of development since Perl 5.18.0
3002and contains approximately 470,000 lines of changes across 2,900 files from 124
3003authors.
3004
3005Excluding auto-generated files, documentation and release tools, there were
3006approximately 280,000 lines of changes to 1,800 .pm, .t, .c and .h files.
3007
3008Perl continues to flourish into its third decade thanks to a vibrant community
3009of users and developers. The following people are known to have contributed the
3010improvements that became Perl 5.20.0:
3011
3012Aaron Crane, Abhijit Menon-Sen, Abigail, Abir Viqar, Alan Haggai Alavi, Alan
3013Hourihane, Alexander Voronov, Alexandr Ciornii, Andy Dougherty, Anno Siegel,
3014Aristotle Pagaltzis, Arthur Axel 'fREW' Schmidt, Brad Gilbert, Brendan Byrd,
3015Brian Childs, Brian Fraser, Brian Gottreu, Chris 'BinGOs' Williams, Christian
3016Millour, Colin Kuskie, Craig A. Berry, Dabrien 'Dabe' Murphy, Dagfinn Ilmari
3017Mannsåker, Daniel Dragan, Darin McBride, David Golden, David Leadbeater, David
3018Mitchell, David Nicol, David Steinbrunner, Dennis Kaarsemaker, Dominic
3019Hargreaves, Ed Avis, Eric Brine, Evan Zacks, Father Chrysostomos, Florian
3020Ragwitz, François Perrad, Gavin Shelley, Gideon Israel Dsouza, Gisle Aas,
3021Graham Knop, H.Merijn Brand, Hauke D, Heiko Eissfeldt, Hiroo Hayashi, Hojung
3022Youn, James E Keenan, Jarkko Hietaniemi, Jerry D. Hedden, Jess Robinson, Jesse
3023Luehrs, Johan Vromans, John Gardiner Myers, John Goodyear, John P. Linderman,
3024John Peacock, kafka, Kang-min Liu, Karen Etheridge, Karl Williamson, Keedi Kim,
3025Kent Fredric, kevin dawson, Kevin Falcone, Kevin Ryde, Leon Timmermans, Lukas
3026Mai, Marc Simpson, Marcel Grünauer, Marco Peereboom, Marcus Holland-Moritz,
3027Mark Jason Dominus, Martin McGrath, Matthew Horsfall, Max Maischein, Mike
3028Doherty, Moritz Lenz, Nathan Glenn, Nathan Trapuzzano, Neil Bowers, Neil
3029Williams, Nicholas Clark, Niels Thykier, Niko Tyni, Olivier Mengué, Owain G.
3030Ainsworth, Paul Green, Paul Johnson, Peter John Acklam, Peter Martini, Peter
3031Rabbitson, Petr Písař, Philip Boulain, Philip Guenther, Piotr Roszatycki,
3032Rafael Garcia-Suarez, Reini Urban, Reuben Thomas, Ricardo Signes, Ruslan
3033Zakirov, Sergey Alekseev, Shirakata Kentaro, Shlomi Fish, Slaven Rezic,
3034Smylers, Steffen Müller, Steve Hay, Sullivan Beck, Thomas Sibley, Tobias
3035Leich, Toby Inkster, Tokuhiro Matsuno, Tom Christiansen, Tom Hukins, Tony Cook,
3036Victor Efimov, Viktor Turskyi, Vladimir Timofeev, YAMASHINA Hio, Yves Orton,
3037Zefram, Zsbán Ambrus, Ævar Arnfjörð Bjarmason.
3038
3039The list above is almost certainly incomplete as it is automatically generated
3040from version control history. In particular, it does not include the names of
3041the (very much appreciated) contributors who reported issues to the Perl bug
3042tracker.
3043
3044Many of the changes included in this version originated in the CPAN modules
3045included in Perl's core. We're grateful to the entire CPAN community for
3046helping Perl to flourish.
3047
3048For a more complete list of all of Perl's historical contributors, please see
3049the F<AUTHORS> file in the Perl source distribution.
f5b73711 3050
44691e6f
AB
3051=head1 Reporting Bugs
3052
e08634c5
SH
3053If you find what you think is a bug, you might check the articles recently
3054posted to the comp.lang.perl.misc newsgroup and the perl bug database at
c68523cb 3055http://rt.perl.org/perlbug/ . There may also be information at
7ef8b31d 3056http://www.perl.org/ , the Perl Home Page.
44691e6f 3057
e08634c5
SH
3058If you believe you have an unreported bug, please run the L<perlbug> program
3059included with your release. Be sure to trim your bug down to a tiny but
3060sufficient test case. Your bug report, along with the output of C<perl -V>,
3061will be sent off to perlbug@perl.org to be analysed by the Perl porting team.
44691e6f
AB
3062
3063If the bug you are reporting has security implications, which make it
e08634c5
SH
3064inappropriate to send to a publicly archived mailing list, then please send it
3065to perl5-security-report@perl.org. This points to a closed subscription
3066unarchived mailing list, which includes all the core committers, who will be
3067able to help assess the impact of issues, figure out a resolution, and help
f9001595 3068co-ordinate the release of patches to mitigate or fix the problem across all
e08634c5
SH
3069platforms on which Perl is supported. Please only use this address for
3070security issues in the Perl core, not for modules independently distributed on
3071CPAN.
44691e6f
AB
3072
3073=head1 SEE ALSO
3074
e08634c5
SH
3075The F<Changes> file for an explanation of how to view exhaustive details on
3076what changed.
44691e6f
AB
3077
3078The F<INSTALL> file for how to build Perl.
3079
3080The F<README> file for general stuff.
3081
3082The F<Artistic> and F<Copying> files for copyright information.
3083
3084=cut