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