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