Commit | Line | Data |
---|---|---|
e5ba1bf1 FC |
1 | =encoding utf8 |
2 | ||
3 | =head1 NAME | |
4 | ||
0bba4573 | 5 | perl5180delta - what is new for perl v5.18.0 |
e5ba1bf1 FC |
6 | |
7 | =head1 DESCRIPTION | |
8 | ||
0bba4573 | 9 | This document describes differences between the 5.16.0 release and the 5.18.0 |
e5ba1bf1 FC |
10 | release. |
11 | ||
0bba4573 RS |
12 | If you are upgrading from an earlier release such as 5.14.0, first read |
13 | L<perl5140delta>, which describes differences between 5.12.0 and 5.14.0. | |
e5ba1bf1 FC |
14 | |
15 | =head1 Notice | |
16 | ||
17 | XXX Any important notices here | |
18 | ||
19 | =head1 Core Enhancements | |
20 | ||
f7b06e7f | 21 | =head2 Upgrade to Unicode 6.2 |
00785cb7 | 22 | |
f7b06e7f RS |
23 | Perl now supports the final version of Unicode 6.2. Earlier releases in |
24 | the 5.17 series supported Unicode 6.2 beta versions. There were no | |
25 | substantive changes in the final Unicode 6.2 version from the most | |
26 | recent beta, included in Perl 5.17.4. A list of changes from Unicode | |
27 | 6.1 is at L<http://www.unicode.org/versions/Unicode6.2.0>. | |
00785cb7 RS |
28 | |
29 | =head2 New DTrace probes | |
30 | ||
31 | The following new DTrace probes have been added: | |
32 | ||
33 | =over 4 | |
34 | ||
35 | =item C<op-entry> | |
36 | ||
37 | =item C<loading-file> | |
38 | ||
39 | =item C<loaded-file> | |
40 | ||
41 | =back | |
42 | ||
43 | =head2 C<${^LAST_FH}> | |
44 | ||
45 | This new variable provides access to the filehandle that was last read. | |
46 | This is the handle used by C<$.> and by C<tell> and C<eof> without | |
47 | arguments. | |
48 | ||
49 | =head2 Looser here-doc parsing | |
50 | ||
51 | Here-doc terminators no longer require a terminating newline character when | |
52 | they occur at the end of a file. This was already the case at the end of a | |
53 | string eval [perl #65838]. | |
54 | ||
55 | =head2 New mechanism for experimental features | |
56 | ||
57 | Newly-added experimental features will now require this incantation: | |
58 | ||
59 | no warnings "experimental:feature_name"; | |
60 | use feature "feature_name"; # would warn without the prev line | |
61 | ||
62 | There is a new warnings category, called "experimental", containing | |
63 | warnings that the L<feature> pragma emits when enabling experimental | |
64 | features. | |
65 | ||
66 | Newly-added experimental features will also be given special warning IDs, | |
67 | which consist of "experimental:" followed by the name of the feature. (The | |
68 | plan is to extend this mechanism eventually to all warnings, to allow them | |
69 | to be enabled or disabled individually, and not just by category.) | |
70 | ||
71 | By saying | |
72 | ||
73 | no warnings "experimental:feature_name"; | |
74 | ||
75 | you are taking responsibility for any breakage that future changes to, or | |
76 | removal of, the feature may cause. | |
77 | ||
78 | =head2 Lexical subroutines | |
79 | ||
80 | This new feature is still considered experimental. To enable it, use the | |
81 | mechanism described above: | |
82 | ||
83 | use 5.018; | |
84 | no warnings "experimental:lexical_subs"; | |
85 | use feature "lexical_subs"; | |
86 | ||
87 | You can now declare subroutines with C<state sub foo>, C<my sub foo>, and | |
88 | C<our sub foo>. (C<state sub> requires that the "state" feature be | |
89 | enabled, unless you write it as C<CORE::state sub foo>.) | |
90 | ||
91 | C<state sub> creates a subroutine visible within the lexical scope in which | |
92 | it is declared. The subroutine is shared between calls to the outer sub. | |
93 | ||
94 | C<my sub> declares a lexical subroutine that is created each time the | |
95 | enclosing block is entered. C<state sub> is generally slightly faster than | |
96 | C<my sub>. | |
97 | ||
98 | C<our sub> declares a lexical alias to the package subroutine of the same | |
99 | name. | |
100 | ||
101 | See L<perlsub/Lexical Subroutines>. | |
102 | ||
94b31d3f RS |
103 | =head2 Computed Labels |
104 | ||
105 | The loop controls C<next>, C<last> and C<redo>, and the special C<dump> | |
106 | operator, now allow arbitrary expressions to be used to compute labels at run | |
107 | time. Previously, any argument that was not a constant was treated as the | |
108 | empty string. | |
109 | ||
0fef449b RS |
110 | =head2 More CORE:: subs |
111 | ||
112 | Several more built-in functions have been added as subroutines to the | |
113 | CORE:: namespace, namely, those non-overridable keywords that can be | |
114 | implemented without custom parsers: C<defined>, C<delete>, C<exists>, | |
115 | C<glob>, C<pos>, C<protoytpe>, C<scalar>, C<split>, C<study>, and C<undef>. | |
116 | ||
117 | As some of these have prototypes, C<prototype('CORE::...')> has been | |
118 | changed to not make a distinction between overridable and non-overridable | |
119 | keywords. This is to make C<prototype('CORE::pos')> consistent with | |
120 | C<prototype(&CORE::pos)>. | |
e5ba1bf1 | 121 | |
37133b20 RS |
122 | =head2 C<kill> with negative signal names |
123 | ||
124 | C<kill> has always allowed a negative signal number, which kills the | |
125 | process group instead of a single process. It has also allowed signal | |
126 | names. But it did not behave consistently, because negative signal names | |
127 | were treated as 0. Now negative signals names like C<-INT> are supported | |
128 | and treated the same way as -2 [perl #112990]. | |
129 | ||
130 | =head2 C<pack> is now constant folded. | |
131 | ||
132 | C<pack> with constant arguments is now constant folded in most cases | |
133 | [perl #113470]. | |
e5ba1bf1 FC |
134 | |
135 | =head1 Security | |
136 | ||
f7b06e7f RS |
137 | =head2 Avoid calling memset with a negative count |
138 | ||
139 | Poorly written perl code that allows an attacker to specify the count to perl's | |
140 | C<x> string repeat operator can already cause a memory exhaustion | |
141 | denial-of-service attack. A flaw in versions of perl before 5.15.5 can escalate | |
142 | that into a heap buffer overrun; coupled with versions of glibc before 2.16, it | |
143 | possibly allows the execution of arbitrary code. | |
e5ba1bf1 | 144 | |
f7b06e7f | 145 | The flaw addressed to this commit has been assigned identifier CVE-2012-5195. |
e5ba1bf1 FC |
146 | |
147 | =head1 Incompatible Changes | |
148 | ||
f7b06e7f RS |
149 | =head2 New Restrictions in Multi-Character Case-Insensitive Matching in Regular Expression Bracketed Character Classes |
150 | ||
151 | Unicode has now withdrawn their previous recommendation for regular | |
152 | expressions to automatically handle cases where a single character can | |
153 | match multiple characters case-insensitively; for example, the letter | |
154 | LATIN SMALL LETTER SHARP S and the sequence C<ss>. This is because | |
155 | it turns out to be impracticable to do this correctly in all | |
156 | circumstances. Because Perl has tried to do this as best it can, it | |
157 | will continue to do so. (We are considering an option to turn it off.) | |
158 | However, a new restriction is being added on such matches when they | |
159 | occur in [bracketed] character classes. People were specifying | |
160 | things such as C</[\0-\xff]/i>, and being surprised that it matches the | |
161 | two character sequence C<ss> (since LATIN SMALL LETTER SHARP S occurs in | |
162 | this range). This behavior is also inconsistent with the using a | |
163 | property instead of a range: C<\p{Block=Latin1}> also includes LATIN | |
164 | SMALL LETTER SHARP S, but C</[\p{Block=Latin1}]/i> does not match C<ss>. | |
165 | The new rule is that for there to be a multi-character case-insensitive | |
166 | match within a bracketed character class, the character must be | |
167 | explicitly listed, and not as an end point of a range. This more | |
168 | closely obeys the Principle of Least Astonishment. See | |
169 | L<perlrecharclass/Bracketed Character Classes>. Note that a bug [perl | |
170 | #89774], now fixed as part of this change, prevented the previous | |
171 | behavior from working fully. | |
172 | ||
00785cb7 RS |
173 | =head2 Here-doc parsing |
174 | ||
175 | The body of a here-document inside a quote-like operator now always begins | |
176 | on the line after the "<<foo" marker. Previously, it was documented to | |
177 | begin on the line following the containing quote-like operator, but that | |
178 | was only sometimes the case [perl #114040]. | |
179 | ||
180 | =head2 Stricter parsing of substitution replacement | |
181 | ||
182 | It is no longer possible to abuse the way the parser parses C<s///e> like | |
183 | this: | |
184 | ||
185 | %_=(_,"Just another "); | |
186 | $_="Perl hacker,\n"; | |
187 | s//_}->{_/e;print | |
188 | ||
189 | =head2 Interaction of lexical and default warnings | |
190 | ||
191 | Turning on any lexical warnings used first to disable all default warnings | |
192 | if lexical warnings were not already enabled: | |
193 | ||
194 | $*; # deprecation warning | |
195 | use warnings "void"; | |
196 | $#; # void warning; no deprecation warning | |
197 | ||
198 | Now, the debugging, deprecated, glob, inplace and malloc warnings | |
199 | categories are left on when turning on lexical warnings (unless they are | |
200 | turned off by C<no warnings>, of course). | |
201 | ||
202 | This may cause deprecation warnings to occur in code that used to be free | |
203 | of warnings. | |
204 | ||
205 | Those are the only categories consisting only of default warnings. Default | |
206 | warnings in other categories are still disabled by C<use warnings | |
207 | "category">, as we do not yet have the infrastructure for controlling | |
208 | individual warnings. | |
209 | ||
210 | =head2 C<state sub> and C<our sub> | |
211 | ||
212 | Due to an accident of history, C<state sub> and C<our sub> were equivalent | |
213 | to a plain C<sub>, so one could even create an anonymous sub with | |
214 | C<our sub { ... }>. These are now disallowed outside of the "lexical_subs" | |
215 | feature. Under the "lexical_subs" feature they have new meanings described | |
216 | in L<perlsub/Lexical Subroutines>. | |
217 | ||
218 | =head2 C<gv_fetchmeth_*> and SUPER | |
219 | ||
220 | The various C<gv_fetchmeth_*> XS functions used to treat a package whose | |
221 | named ended with ::SUPER specially. A method lookup on the Foo::SUPER | |
222 | package would be treated as a SUPER method lookup on the Foo package. This | |
223 | is no longer the case. To do a SUPER lookup, pass the Foo stash and the | |
224 | GV_SUPER flag. | |
225 | ||
94b31d3f RS |
226 | =head2 Defined values stored in environment are forced to byte strings |
227 | ||
228 | A value stored in an environment variable has always been stringified. In this | |
229 | release, it is converted to be only a byte string. First, it is forced to be a | |
230 | only a string. Then if the string is utf8 and the equivalent of | |
231 | C<utf8::downgrade()> works, that result is used; otherwise, the equivalent of | |
232 | C<utf8::encode()> is used, and a warning is issued about wide characters | |
233 | (L</Diagnostics>). | |
234 | ||
235 | =head2 C<given> now aliases the global C<$_> | |
236 | ||
237 | Instead of assigning to an implicit lexical C<$_>, C<given> now makes the | |
238 | global C<$_> an alias for its argument, just like C<foreach>. However, it | |
239 | still uses lexical C<$_> if there is lexical C<$_> in scope (again, just like | |
240 | C<foreach>) [perl #114020]. | |
241 | ||
0bba4573 RS |
242 | =head2 qw(...) can no longer be used as parentheses |
243 | ||
244 | C<qw> lists used to fool the parser into thinking they were always | |
245 | surrounded by parentheses. This permitted some surprising constructions | |
246 | such as C<foreach $x qw(a b c) {...}>, which should really be written | |
247 | C<foreach $x (qw(a b c)) {...}>. These would sometimes get the lexer into | |
248 | the wrong state, so they didn't fully work, and the similar C<foreach qw(a | |
249 | b c) {...}> that one might expect to be permitted never worked at all. | |
250 | ||
251 | This side effect of C<qw> has now been abolished. It has been deprecated | |
252 | since Perl 5.13.11. It is now necessary to use real parentheses | |
253 | everywhere that the grammar calls for them. | |
e5ba1bf1 | 254 | |
0bba4573 | 255 | =head2 C<\s> in regular expressions now matches a Vertical Tab |
e5ba1bf1 | 256 | |
0bba4573 | 257 | [ XXX ] |
e5ba1bf1 | 258 | |
0fef449b RS |
259 | =head2 C</(?{})/> and C</(??{})/> have been heavily reworked |
260 | ||
261 | The implementation of this feature has been almost completely rewritten. | |
262 | Although its main intent is to fix bugs, some behaviors, especially | |
263 | related to the scope of lexical variables, will have changed. This is | |
264 | described more fully in the L</Selected Bug Fixes> section. | |
265 | ||
266 | =head2 C<\N{BELL}> now refers to U+1F514 instead of U+0007 | |
267 | ||
268 | Unicode 6.0 reused the name "BELL" for a different code point than it | |
269 | traditionally had meant. Since Perl v5.14, use of this name still | |
270 | referred to U+0007, but would raise a deprecation warning. Now, "BELL" | |
271 | refers to U+1F514, and the name for U+0007 is "ALERT". All the | |
272 | functions in L<charnames> have been correspondingly updated. | |
273 | ||
274 | =head2 Alphanumeric operators must now be separated from the closing | |
275 | delimiter of regular expressions | |
276 | ||
277 | You may no longer write something like: | |
278 | ||
279 | m/a/and 1 | |
280 | ||
281 | Instead you must write | |
282 | ||
283 | m/a/ and 1 | |
284 | ||
285 | with whitespace separating the operator from the closing delimiter of | |
286 | the regular expression. Not having whitespace has resulted in a | |
287 | deprecation warning since Perl v5.14.0. | |
288 | ||
289 | =head2 C<require> dies for unreadable files | |
290 | ||
291 | When C<require> encounters an unreadable file, it now dies. It used to | |
292 | ignore the file and continue searching the directories in @INC | |
293 | [perl #113422]. | |
294 | ||
295 | =head2 Upgrade to the Unicode 6.2 beta | |
296 | ||
297 | Unicode 6.2 is proposing some changes that may very well break some CPAN | |
298 | modules. The timing of this nicely coincides with Perl's being early in the | |
299 | release cycle. This commit takes the current beta 6.2, adds the proposed | |
300 | changes that aren't yet in it, and subtracts the changes that would affect \X | |
301 | processing, as those turn out to have errors, and may have to be rethought. | |
302 | Unicode has been notified of these problems. | |
303 | ||
304 | This will allow us to gather data as to whether or not the proposed changes | |
305 | cause us problems. These will be presented to Unicode to aid in their final | |
306 | decision as to whether or not to go forward with the changes. | |
307 | ||
308 | These changes will be replaced by the final version of Unicode 6.2 before | |
309 | 5.18.0 is released. | |
310 | ||
e5ba1bf1 FC |
311 | =head1 Deprecations |
312 | ||
313 | XXX Any deprecated features, syntax, modules etc. should be listed here. In | |
314 | particular, deprecated modules should be listed here even if they are listed as | |
315 | an updated module in the L</Modules and Pragmata> section. | |
316 | ||
317 | [ List each deprecation as a =head2 entry ] | |
318 | ||
319 | =head1 Performance Enhancements | |
320 | ||
321 | XXX Changes which enhance performance without changing behaviour go here. | |
322 | There may well be none in a stable release. | |
323 | ||
324 | [ List each enhancement as a =item entry ] | |
325 | ||
326 | =over 4 | |
327 | ||
328 | =item * | |
329 | ||
00785cb7 RS |
330 | Speed up in regular expression matching against Unicode properties. The |
331 | largest gain is for C<\X>, the Unicode "extended grapheme cluster". The | |
332 | gain for it is about 35% - 40%. Bracketed character classes, e.g., | |
333 | C<[0-9\x{100}]> containing code points above 255 are also now faster. | |
334 | ||
335 | =item * | |
336 | ||
337 | On platforms supporting it, several former macros are now implemented as static | |
338 | inline functions. This should speed things up slightly on non-GCC platforms. | |
339 | ||
340 | =item * | |
341 | ||
342 | Apply the optimisation of hashes in boolean context, such as in C<if> or C<and>, | |
343 | to constructs in non-void context. | |
344 | ||
345 | =item * | |
346 | ||
347 | Extend the optimisation of hashes in boolean context to C<scalar(%hash)>, | |
348 | C<%hash ? ... : ...>, and C<sub { %hash || ... }>. | |
349 | ||
350 | =item * | |
351 | ||
352 | When making a copy of the string being matched against (so that $1, $& et al | |
353 | continue to show the correct value even if the original string is subsequently | |
354 | modified), only copy that substring of the original string needed for the | |
355 | capture variables, rather than copying the whole string. | |
356 | ||
357 | This is a big win for code like | |
358 | ||
359 | $&; | |
360 | $_ = 'x' x 1_000_000; | |
361 | 1 while /(.)/; | |
362 | ||
363 | Also, when pessimizing if the code contains C<$`>, C<$&> or C<$'>, record the | |
364 | presence of each variable separately, so that the determination of the substring | |
365 | range is based on each variable separately. So performance-wise, | |
366 | ||
367 | $&; /x/ | |
368 | ||
369 | is now roughly equivalent to | |
370 | ||
371 | /(x)/ | |
372 | ||
373 | whereas previously it was like | |
374 | ||
375 | /^(.*)(x)(.*)$/ | |
376 | ||
377 | and | |
378 | ||
379 | $&; $'; /x/ | |
380 | ||
381 | is now roughly equivalent to | |
382 | ||
383 | /(x)(.*)$/ | |
384 | ||
385 | etc. | |
386 | ||
00785cb7 RS |
387 | =item * |
388 | ||
0bba4573 RS |
389 | Filetest ops manage the stack in a fractionally more efficient manner. |
390 | ||
391 | =item * | |
392 | ||
393 | Globs used in a numeric context are now numerified directly in most cases, | |
394 | rather than being numerified via stringification. | |
e5ba1bf1 | 395 | |
0fef449b RS |
396 | =item * |
397 | ||
398 | The C<x> repetition operator is now folded to a single constant at compile | |
399 | time if called in scalar context with constant operands and no parentheses | |
400 | around the left operand. | |
401 | ||
e5ba1bf1 FC |
402 | =back |
403 | ||
404 | =head1 Modules and Pragmata | |
405 | ||
406 | XXX All changes to installed files in F<cpan/>, F<dist/>, F<ext/> and F<lib/> | |
407 | go here. If Module::CoreList is updated, generate an initial draft of the | |
408 | following sections using F<Porting/corelist-perldelta.pl>, which prints stub | |
409 | entries to STDOUT. Results can be pasted in place of the '=head2' entries | |
410 | below. A paragraph summary for important changes should then be added by hand. | |
411 | In an ideal world, dual-life modules would have a F<Changes> file that could be | |
412 | cribbed. | |
413 | ||
414 | [ Within each section, list entries as a =item entry ] | |
415 | ||
416 | =head2 New Modules and Pragmata | |
417 | ||
418 | =over 4 | |
419 | ||
420 | =item * | |
421 | ||
422 | XXX | |
423 | ||
424 | =back | |
425 | ||
426 | =head2 Updated Modules and Pragmata | |
427 | ||
428 | =over 4 | |
429 | ||
430 | =item * | |
431 | ||
432 | L<XXX> has been upgraded from version A.xx to B.yy. | |
433 | ||
434 | =back | |
435 | ||
436 | =head2 Removed Modules and Pragmata | |
437 | ||
0bba4573 | 438 | =over |
e5ba1bf1 FC |
439 | |
440 | =item * | |
441 | ||
0bba4573 RS |
442 | L<Version::Requirements> has been removed from the core distribution. It is |
443 | available under a different name: L<CPAN::Meta::Requirements>. | |
e5ba1bf1 FC |
444 | |
445 | =back | |
446 | ||
447 | =head1 Documentation | |
448 | ||
449 | XXX Changes to files in F<pod/> go here. Consider grouping entries by | |
450 | file and be sure to link to the appropriate page, e.g. L<perlfunc>. | |
451 | ||
452 | =head2 New Documentation | |
453 | ||
454 | XXX Changes which create B<new> files in F<pod/> go here. | |
455 | ||
456 | =head3 L<XXX> | |
457 | ||
458 | XXX Description of the purpose of the new file here | |
459 | ||
460 | =head2 Changes to Existing Documentation | |
461 | ||
0bba4573 | 462 | =head3 L<perldata> |
e5ba1bf1 | 463 | |
0bba4573 RS |
464 | =over 4 |
465 | ||
466 | =item * | |
467 | ||
468 | Now explicitly documents the behaviour of hash initializer lists that | |
469 | contain duplicate keys. | |
470 | ||
471 | =back | |
472 | ||
473 | =head3 L<perldiag> | |
474 | ||
475 | =over 4 | |
476 | ||
477 | =item * | |
478 | ||
479 | The explanation of symbolic references being prevented by "strict refs" | |
480 | now doesn't assume that the reader knows what symbolic references are. | |
481 | ||
482 | =back | |
483 | ||
484 | =head3 L<perlfunc> | |
e5ba1bf1 FC |
485 | |
486 | =over 4 | |
487 | ||
488 | =item * | |
489 | ||
0bba4573 | 490 | The return value of C<pipe> is now documented. |
e5ba1bf1 | 491 | |
37133b20 RS |
492 | =item * |
493 | ||
494 | Clarified documentation of C<our>. | |
495 | ||
e5ba1bf1 FC |
496 | =back |
497 | ||
0fef449b RS |
498 | =head3 L<perlfaq> |
499 | ||
500 | =over 4 | |
501 | ||
502 | =item * | |
503 | ||
504 | L<perlfaq> has been synchronized with version 5.0150040 from CPAN. | |
505 | ||
506 | =back | |
507 | ||
508 | =head3 L<perlcheat> | |
509 | ||
510 | =over 4 | |
511 | ||
512 | =item * | |
513 | ||
514 | L<perlcheat> has been reorganized, and a few new sections were added. | |
515 | ||
516 | =back | |
517 | ||
94b31d3f RS |
518 | =head3 L<perlop> |
519 | ||
520 | =over 4 | |
521 | ||
522 | =item * | |
523 | ||
524 | Loop control verbs (C<dump>, C<goto>, C<next>, C<last> and C<redo>) have always | |
525 | had the same precedence as assignment operators, but this was not documented | |
526 | until now. | |
527 | ||
528 | =back | |
529 | ||
0bba4573 | 530 | =head3 Diagnostics |
e5ba1bf1 FC |
531 | |
532 | The following additions or changes have been made to diagnostic output, | |
533 | including warnings and fatal error messages. For the complete list of | |
534 | diagnostic messages, see L<perldiag>. | |
535 | ||
536 | XXX New or changed warnings emitted by the core's C<C> code go here. Also | |
537 | include any changes in L<perldiag> that reconcile it to the C<C> code. | |
538 | ||
539 | =head2 New Diagnostics | |
540 | ||
541 | XXX Newly added diagnostic messages go under here, separated into New Errors | |
542 | and New Warnings | |
543 | ||
544 | =head3 New Errors | |
545 | ||
546 | =over 4 | |
547 | ||
548 | =item * | |
549 | ||
94b31d3f RS |
550 | L<Unterminated delimiter for here document|perldiag/"Unterminated delimiter for here document"> |
551 | ||
552 | This message now occurs when a here document label has an initial quotation | |
553 | mark but the final quotation mark is missing. | |
554 | ||
555 | This replaces a bogus and misleading error message about not finding the label | |
556 | itself [perl #114104]. | |
557 | ||
558 | =item * | |
559 | ||
560 | L<panic: child pseudo-process was never scheduled|perldiag/"panic: child pseudo-process was never scheduled"> | |
561 | ||
562 | This error is thrown when a child pseudo-process in the ithreads implementation | |
563 | on Windows was not scheduled within the time period allowed and therefore was | |
564 | not able to initialize properly [perl #88840]. | |
565 | ||
566 | =item * | |
567 | ||
37133b20 RS |
568 | L<Group name must start with a non-digit word character in regex; marked by <-- HERE in mE<sol>%sE<sol>|perldiag/"Group name must start with a non-digit word character in regex; marked by <-- HERE in m/%s/"> |
569 | ||
570 | This error has been added for C<(?&0)>, which is invalid. It used to | |
571 | produce an incomprehensible error message [perl #101666]. | |
572 | ||
573 | =item * | |
574 | ||
575 | L<Can't use an undefined value as a subroutine reference|perldiag/"Can't use an undefined value as %s reference"> | |
576 | ||
577 | Calling an undefined value as a subroutine now produces this error message. | |
578 | It used to, but was accidentally disabled, first in Perl 5.004 for | |
579 | non-magical variables, and then in Perl 5.14 for magical (e.g., tied) | |
580 | variables. It has now been restored. In the mean time, undef was treated | |
581 | as an empty string [perl #113576]. | |
e5ba1bf1 FC |
582 | |
583 | =back | |
584 | ||
585 | =head3 New Warnings | |
586 | ||
587 | =over 4 | |
588 | ||
589 | =item * | |
590 | ||
00785cb7 RS |
591 | L<Experimental "%s" subs not enabled|perldiag/"Experimental "%s" subs not enabled"> |
592 | ||
593 | (F) To use lexical subs, you must first enable them: | |
594 | ||
595 | no warnings 'experimental:lexical_subs'; | |
596 | use feature 'lexical_subs'; | |
597 | my sub foo { ... } | |
598 | ||
599 | =item * | |
600 | ||
601 | L<Subroutine "&%s" is not available|perldiag/"Subroutine "&%s" is not available"> | |
602 | ||
603 | (W closure) During compilation, an inner named subroutine or eval is | |
604 | attempting to capture an outer lexical subroutine that is not currently | |
605 | available. This can happen for one of two reasons. First, the lexical | |
606 | subroutine may be declared in an outer anonymous subroutine that has not | |
607 | yet been created. (Remember that named subs are created at compile time, | |
608 | while anonymous subs are created at run-time.) For example, | |
609 | ||
610 | sub { my sub a {...} sub f { \&a } } | |
611 | ||
612 | At the time that f is created, it can't capture the current the "a" sub, | |
613 | since the anonymous subroutine hasn't been created yet. Conversely, the | |
614 | following won't give a warning since the anonymous subroutine has by now | |
615 | been created and is live: | |
616 | ||
617 | sub { my sub a {...} eval 'sub f { \&a }' }->(); | |
618 | ||
619 | The second situation is caused by an eval accessing a variable that has | |
620 | gone out of scope, for example, | |
621 | ||
622 | sub f { | |
623 | my sub a {...} | |
624 | sub { eval '\&a' } | |
625 | } | |
626 | f()->(); | |
627 | ||
628 | Here, when the '\&a' in the eval is being compiled, f() is not currently | |
629 | being executed, so its &a is not available for capture. | |
630 | ||
631 | =item * | |
632 | ||
633 | L<"%s" subroutine &%s masks earlier declaration in same %s|perldiag/"%s" subroutine &%s masks earlier declaration in same %s> | |
634 | ||
635 | (W misc) A "my" or "state" subroutine has been redeclared in the | |
636 | current scope or statement, effectively eliminating all access to | |
637 | the previous instance. This is almost always a typographical error. | |
638 | Note that the earlier subroutine will still exist until the end of | |
639 | the scope or until all closure references to it are destroyed. | |
640 | ||
641 | =item * | |
642 | ||
643 | L<The %s feature is experimental|perldiag/"The %s feature is experimental"> | |
644 | ||
645 | (S experimental) This warning is emitted if you enable an experimental | |
646 | feature via C<use feature>. Simply suppress the warning if you want | |
647 | to use the feature, but know that in doing so you are taking the risk | |
648 | of using an experimental feature which may change or be removed in a | |
649 | future Perl version: | |
650 | ||
651 | no warnings "experimental:lexical_subs"; | |
652 | use feature "lexical_subs"; | |
653 | ||
654 | =item * | |
655 | ||
656 | L<sleep(%u) too large|perldiag/"sleep(%u) too large"> | |
657 | ||
658 | (W overflow) You called C<sleep> with a number that was larger than it can | |
659 | reliably handle and C<sleep> probably slept for less time than requested. | |
660 | ||
661 | =item * | |
662 | ||
94b31d3f RS |
663 | L<Wide character in setenv|perldiag/"Wide character in %s"> |
664 | ||
665 | Attempts to put wide characters into environment variables via C<%ENV> now | |
666 | provoke this warning. | |
667 | ||
668 | =item * | |
669 | ||
37133b20 RS |
670 | "L<Invalid negative number (%s) in chr|perldiag/"Invalid negative number (%s) in chr">" |
671 | ||
672 | C<chr()> now warns when passed a negative value [perl #83048]. | |
673 | ||
674 | =item * | |
675 | ||
676 | "L<Integer overflow in srand|perldiag/"Integer overflow in srand">" | |
677 | ||
678 | C<srand()> now warns when passed a value that doesn't fit in a C<UV> (since the | |
679 | value will be truncated rather than overflowing) [perl #40605]. | |
680 | ||
681 | =item * | |
682 | ||
683 | "L<-i used with no filenames on the command line, reading from STDIN|perldiag/"-i used with no filenames on the command line, reading from STDIN">" | |
684 | ||
685 | Running perl with the C<-i> flag now warns if no input files are provided on | |
686 | the command line [perl #113410]. | |
e5ba1bf1 FC |
687 | |
688 | =back | |
689 | ||
690 | =head2 Changes to Existing Diagnostics | |
691 | ||
692 | XXX Changes (i.e. rewording) of diagnostic messages go here | |
693 | ||
694 | =over 4 | |
695 | ||
696 | =item * | |
697 | ||
f7b06e7f RS |
698 | The error produced when a module cannot be loaded now includes a hint that |
699 | the module may need to be installed: "Can't locate hopping.pm in @INC (you | |
700 | may need to install the hopping module) (@INC contains: ...)" | |
701 | ||
702 | =item * | |
703 | ||
00785cb7 RS |
704 | L<vector argument not supported with alpha versions|perldiag/vector argument not supported with alpha versions> |
705 | ||
706 | This warning was not suppressable, even with C<no warnings>. Now it is | |
707 | suppressible, and has been moved from the "internal" category to the | |
708 | "printf" category. | |
709 | ||
710 | =item * | |
711 | ||
712 | C<< Can't do {n,m} with n > m in regex; marked by <-- HERE in m/%s/ >> | |
713 | ||
714 | This fatal error has been turned into a warning that reads: | |
715 | ||
716 | L<< Quantifier {n,m} with n > m can't match in regex | perldiag/Quantifier {n,m} with n > m can't match in regex >> | |
717 | ||
718 | (W regexp) Minima should be less than or equal to maxima. If you really want | |
719 | your regexp to match something 0 times, just put {0}. | |
720 | ||
721 | =item * | |
722 | ||
0fef449b RS |
723 | The "Runaway prototype" warning that occurs in bizarre cases has been |
724 | removed as being unhelpful and inconsistent. | |
725 | ||
726 | =item * | |
727 | ||
728 | The "Not a format reference" error has been removed, as the only case in | |
729 | which it could be triggered was a bug. | |
730 | ||
731 | =item * | |
732 | ||
733 | The "Unable to create sub named %s" error has been removed for the same | |
734 | reason. | |
e5ba1bf1 | 735 | |
37133b20 RS |
736 | =item * |
737 | ||
738 | The 'Can't use "my %s" in sort comparison' error has been downgraded to a | |
739 | warning, '"my %s" used in sort comparison' (with 'state' instead of 'my' | |
740 | for state variables). In addition, the heuristics for guessing whether | |
741 | lexical $a or $b has been misused have been improved to generate fewer | |
742 | false positives. Lexical $a and $b are no longer disallowed if they are | |
743 | outside the sort block. Also, a named unary or list operator inside the | |
744 | sort block no longer causes the $a or $b to be ignored [perl #86136]. | |
745 | ||
e5ba1bf1 FC |
746 | =back |
747 | ||
748 | =head1 Utility Changes | |
749 | ||
f7b06e7f | 750 | =head3 L<h2xs> |
e5ba1bf1 FC |
751 | |
752 | =over 4 | |
753 | ||
754 | =item * | |
755 | ||
f7b06e7f | 756 | F<h2xs> no longer produces invalid code for empty defines. [perl #20636] |
e5ba1bf1 FC |
757 | |
758 | =back | |
759 | ||
760 | =head1 Configuration and Compilation | |
761 | ||
762 | XXX Changes to F<Configure>, F<installperl>, F<installman>, and analogous tools | |
763 | go here. Any other changes to the Perl build process should be listed here. | |
764 | However, any platform-specific changes should be listed in the | |
765 | L</Platform Support> section, instead. | |
766 | ||
767 | [ List changes as a =item entry ]. | |
768 | ||
769 | =over 4 | |
770 | ||
771 | =item * | |
772 | ||
00785cb7 RS |
773 | F<Configure> will now correctly detect C<isblank()> when compiling with a C++ |
774 | compiler. | |
775 | ||
776 | =item * | |
777 | ||
94b31d3f RS |
778 | The pager detection in F<Configure> has been improved to allow responses which |
779 | specify options after the program name, e.g. B</usr/bin/less -R>, if the user | |
780 | accepts the default value. This helps B<perldoc> when handling ANSI escapes | |
781 | [perl #72156]. | |
e5ba1bf1 FC |
782 | |
783 | =back | |
784 | ||
785 | =head1 Testing | |
786 | ||
787 | XXX Any significant changes to the testing of a freshly built perl should be | |
788 | listed here. Changes which create B<new> files in F<t/> go here as do any | |
789 | large changes to the testing harness (e.g. when parallel testing was added). | |
790 | Changes to existing files in F<t/> aren't worth summarizing, although the bugs | |
791 | that they represent may be covered elsewhere. | |
792 | ||
793 | [ List each test improvement as a =item entry ] | |
794 | ||
795 | =over 4 | |
796 | ||
797 | =item * | |
798 | ||
0bba4573 RS |
799 | The test suite now has a section for tests that require very large amounts |
800 | of memory. These tests won't run by default; they can be enabled by | |
801 | setting the C<PERL_TEST_MEMORY> environment variable to the number of | |
802 | gibibytes of memory that may be safely used. | |
e5ba1bf1 FC |
803 | |
804 | =back | |
805 | ||
806 | =head1 Platform Support | |
807 | ||
808 | XXX Any changes to platform support should be listed in the sections below. | |
809 | ||
810 | [ Within the sections, list each platform as a =item entry with specific | |
811 | changes as paragraphs below it. ] | |
812 | ||
813 | =head2 New Platforms | |
814 | ||
815 | XXX List any platforms that this version of perl compiles on, that previous | |
816 | versions did not. These will either be enabled by new files in the F<hints/> | |
817 | directories, or new subdirectories and F<README> files at the top level of the | |
818 | source tree. | |
819 | ||
820 | =over 4 | |
821 | ||
822 | =item XXX-some-platform | |
823 | ||
824 | XXX | |
825 | ||
826 | =back | |
827 | ||
828 | =head2 Discontinued Platforms | |
829 | ||
e5ba1bf1 FC |
830 | =over 4 |
831 | ||
94b31d3f | 832 | =item UTS Global |
e5ba1bf1 | 833 | |
94b31d3f RS |
834 | Support code relating to UTS global has been removed. UTS was a mainframe |
835 | version of System V created by Amdahl, subsequently sold to UTS Global. The | |
836 | port has not been touched since before Perl 5.8.0, and UTS Global is now | |
837 | defunct. | |
e5ba1bf1 | 838 | |
00785cb7 RS |
839 | =item VM/ESA |
840 | ||
841 | Support for VM/ESA has been removed. The port was tested on 2.3.0, which | |
842 | IBM ended service on in March 2002. 2.4.0 ended service in June 2003, and | |
843 | was superseded by Z/VM. The current version of Z/VM is V6.2.0, and scheduled | |
844 | for end of service on 2015/04/30. | |
845 | ||
f7b06e7f RS |
846 | =item MPE/IX |
847 | ||
848 | Support for MPE/IX has been removed. | |
849 | ||
e5ba1bf1 FC |
850 | =back |
851 | ||
852 | =head2 Platform-Specific Notes | |
853 | ||
854 | XXX List any changes for specific platforms. This could include configuration | |
855 | and compilation changes or changes in portability/compatibility. However, | |
856 | changes within modules for platforms should generally be listed in the | |
857 | L</Modules and Pragmata> section. | |
858 | ||
859 | =over 4 | |
860 | ||
0bba4573 | 861 | =item clang++ |
e5ba1bf1 | 862 | |
0bba4573 RS |
863 | There is now a workaround for a compiler bug that prevented compiling |
864 | with clang++ since Perl 5.15.7 [perl #112786]. | |
865 | ||
866 | =item C++ | |
867 | ||
868 | When compiling the Perl core as C++ (which is only semi-supported), the | |
869 | mathom functions are now compiled as C<extern "C">, to ensure proper | |
870 | binary compatibility. (However, binary compatibility isn't generally | |
871 | guaranteed anyway in the situations where this would matter.) | |
872 | ||
00785cb7 RS |
873 | =item Win32 |
874 | ||
875 | Fixed a problem where perl could crash while cleaning up threads (including the | |
876 | main thread) in threaded debugging builds on Win32 and possibly other platforms | |
877 | [perl #114496]. | |
878 | ||
879 | A rare race condition that would lead to L<sleep|perlfunc/sleep> taking more | |
880 | time than requested, and possibly even hanging, has been fixed [perl #33096]. | |
881 | ||
f7b06e7f RS |
882 | =item Win32 |
883 | ||
884 | The option to build without USE_SOCKETS_AS_HANDLES has been removed. | |
885 | ||
00785cb7 RS |
886 | =item Solaris |
887 | ||
888 | In Configure, avoid running sed commands with flags not supported on Solaris. | |
889 | ||
890 | =item Darwin | |
891 | ||
892 | Stop hardcoding an alignment on 8 byte boundaries to fix builds using | |
893 | -Dusemorebits. | |
894 | ||
895 | =item VMS | |
896 | ||
897 | Fix linking on builds configured with -Dusemymalloc=y. | |
898 | ||
0bba4573 RS |
899 | =item VMS |
900 | ||
901 | It should now be possible to compile Perl as C++ on VMS. | |
e5ba1bf1 | 902 | |
0fef449b RS |
903 | =item Win32 |
904 | ||
905 | C<link> on Win32 now attempts to set C<$!> to more appropriate values | |
906 | based on the Win32 API error code. [perl #112272] | |
907 | ||
908 | Perl no longer mangles the environment block, e.g. when launching a new | |
909 | sub-process, when the environment contains non-ASCII characters. Known | |
910 | problems still remain, however, when the environment contains characters | |
911 | outside of the current ANSI codepage (e.g. see the item about Unicode in | |
912 | C<%ENV> in L<http://perl5.git.perl.org/perl.git/blob/HEAD:/Porting/todo.pod>). | |
913 | [perl #113536] | |
914 | ||
37133b20 RS |
915 | =item Win32 |
916 | ||
917 | Building perl with some Windows compilers used to fail due to a problem | |
918 | with miniperl's C<glob> operator (which uses the C<perlglob> program) | |
919 | deleting the PATH environment variable [perl #113798]. | |
920 | ||
94b31d3f RS |
921 | =item Win32 |
922 | ||
923 | A new makefile option, USE_64_BIT_INT, has been added to the Windows makefiles. | |
924 | Set this to "define" when building a 32-bit perl if you want it to use 64-bit | |
925 | integers. | |
926 | ||
927 | Machine code size reductions, already made to the DLLs of XS modules in Perl | |
928 | 5.17.2, have now been extended to the perl DLL itself. | |
929 | ||
930 | Building with VC++ 6.0 was inadvertently broken in Perl 5.17.2 but has now been | |
931 | fixed again. | |
932 | ||
0fef449b RS |
933 | =item VMS |
934 | ||
935 | All C header files from the top-level directory of the distribution are now | |
936 | installed on VMS, providing consistency with a long-standing practice on other | |
937 | platforms. Previously only a subset were installed, which broke non-core | |
938 | extension builds for extensions that depended on the missing include files. | |
939 | ||
37133b20 RS |
940 | =item VMS |
941 | ||
942 | Quotes are now removed from the command verb (but not the parameters) for | |
943 | commands spawned via C<system>, backticks, or a piped C<open>. Previously, | |
944 | quotes on the verb were passed through to DCL, which would fail to recognize | |
945 | the command. Also, if the verb is actually a path to an image or command | |
946 | procedure on an ODS-5 volume, quoting it now allows the path to contain spaces. | |
947 | ||
94b31d3f RS |
948 | =item VMS |
949 | ||
950 | The B<a2p> build has been fixed for the HP C++ compiler on OpenVMS. | |
951 | ||
37133b20 RS |
952 | =item AIX |
953 | ||
954 | Configure now always adds C<-qlanglvl=extc99> to the CC flags on AIX when | |
955 | using xlC. This will make it easier to compile a number of XS-based modules | |
956 | that assume C99 [perl #113778]. | |
957 | ||
e5ba1bf1 FC |
958 | =back |
959 | ||
960 | =head1 Internal Changes | |
961 | ||
0bba4573 | 962 | =over |
e5ba1bf1 | 963 | |
0bba4573 | 964 | =item * |
e5ba1bf1 | 965 | |
f7b06e7f RS |
966 | Case-insensitive matching inside a [bracketed] character class with a |
967 | multi-character fold, no longer excludes one of the possibilities in the | |
968 | circumstances that it used to. [perl #89774]. | |
969 | ||
970 | =item * | |
971 | ||
972 | C<PL_formfeed> has been removed. | |
973 | ||
974 | =item * | |
975 | ||
976 | The regular expression engine no longer reads one byte past the end of the | |
977 | target string. While for all internally well-formed scalars this should | |
978 | never have been a problem, this change facilitates clever tricks with | |
979 | string buffers in CPAN modules. [perl #73542] | |
980 | ||
981 | =item * | |
982 | ||
983 | Inside a BEGIN block, C<PL_compcv> now points to the currently-compiling | |
984 | subroutine, rather than the BEGIN block itself. | |
985 | ||
986 | =item * | |
987 | ||
988 | C<mg_length> has been deprecated. | |
989 | ||
990 | =item * | |
991 | ||
992 | C<sv_len> now always returns a byte count and C<sv_len_utf8> a character | |
993 | count. Previously, C<sv_len> and C<sv_len_utf8> were both buggy and would | |
994 | sometimes returns bytes and sometimes characters. C<sv_len_utf8> no longer | |
995 | assumes that its argument is in UTF8. Neither of these creates UTF8 caches | |
996 | for tied or overloaded values or for non-PVs any more. | |
997 | ||
998 | =item * | |
999 | ||
1000 | C<sv_mortalcopy> now copies string buffers of shared hash key scalars when | |
1001 | called from XS modules [perl #79824]. | |
1002 | ||
1003 | =item * | |
1004 | ||
1005 | C<RXf_SPLIT> and C<RXf_SKIPWHITE> are no longer used. They are now | |
1006 | #defined as 0. | |
1007 | ||
1008 | =item * | |
1009 | ||
1010 | The new C<RXf_MODIFIES_VARS> flag can be set by custom regular expression | |
1011 | engines to indicate that the execution of the regular expression may cause | |
1012 | variables to be modified. This lets C<s///> know to skip certain | |
1013 | optimisations. Perl's own regular expression engine sets this flag for the | |
1014 | special backtracking verbs that set $REGMARK and $REGERROR. | |
1015 | ||
1016 | =item * | |
1017 | ||
00785cb7 RS |
1018 | The APIs for accessing lexical pads have changed considerably. |
1019 | ||
1020 | C<PADLIST>s are now longer C<AV>s, but their own type instead. C<PADLIST>s now | |
1021 | contain a C<PAD> and a C<PADNAMELIST> of C<PADNAME>s, rather than C<AV>s for the | |
1022 | pad and the list of pad names. C<PAD>s, C<PADNAMELIST>s, and C<PADNAME>s are to | |
1023 | be accessed as such through the newly added pad API instead of the plain C<AV> | |
1024 | and C<SV> APIs. See L<perlapi> for details. | |
1025 | ||
1026 | =item * | |
1027 | ||
1028 | In the regex API, the numbered capture callbacks are passed an index | |
1029 | indicating what match variable is being accessed. There are special | |
1030 | index values for the C<$`, $&, $&> variables. Previously the same three | |
1031 | values were used to retrieve C<${^PREMATCH}, ${^MATCH}, ${^POSTMATCH}> | |
1032 | too, but these have now been assigned three separate values. See | |
1033 | L<perlreapi/Numbered capture callbacks>. | |
1034 | ||
1035 | =item * | |
1036 | ||
1037 | C<PL_sawampersand> was previously a boolean indicating that any of | |
1038 | C<$`, $&, $&> had been seen; it now contains three one-bit flags | |
1039 | indicating the presence of each of the variables individually. | |
1040 | ||
00785cb7 RS |
1041 | =item * |
1042 | ||
0bba4573 RS |
1043 | The C<CV *> typemap entry now supports C<&{}> overloading and typeglobs, |
1044 | just like C<&{...}> [perl #96872]. | |
e5ba1bf1 FC |
1045 | |
1046 | =item * | |
1047 | ||
0bba4573 RS |
1048 | The C<SVf_AMAGIC> flag to indicate overloading is now on the stash, not the |
1049 | object. It is now set automatically whenever a method or @ISA changes, so | |
1050 | its meaning has changed, too. It now means "potentially overloaded". When | |
1051 | the overload table is calculated, the flag is automatically turned off if | |
1052 | there is no overloading, so there should be no noticeable slowdown. | |
1053 | ||
1054 | The staleness of the overload tables is now checked when overload methods | |
1055 | are invoked, rather than during C<bless>. | |
1056 | ||
1057 | "A" magic is gone. The changes to the handling of the C<SVf_AMAGIC> flag | |
1058 | eliminate the need for it. | |
1059 | ||
1060 | C<PL_amagic_generation> has been removed as no longer necessary. For XS | |
1061 | modules, it is now a macro alias to C<PL_na>. | |
1062 | ||
1063 | The fallback overload setting is now stored in a stash entry separate from | |
1064 | overloadedness itself. | |
1065 | ||
1066 | =item * | |
1067 | ||
1068 | The character-processing code has been cleaned up in places. The changes | |
1069 | should be operationally invisible. | |
e5ba1bf1 | 1070 | |
0fef449b RS |
1071 | =item * |
1072 | ||
1073 | The C<study> function was made a no-op in 5.16. It was simply disabled via | |
1074 | a C<return> statement; the code was left in place. Now the code supporting | |
1075 | what C<study> used to do has been removed. | |
1076 | ||
1077 | =item * | |
1078 | ||
1079 | Under threaded perls, there is no longer a separate PV allocated for every | |
1080 | COP to store its package name (C<< cop->stashpv >>). Instead, there is an | |
1081 | offset (C<< cop->stashoff >>) into the new C<PL_stashpad> array, which | |
1082 | holds stash pointers. | |
1083 | ||
1084 | =item * | |
1085 | ||
1086 | In the pluggable regex API, the C<regexp_engine> struct has acquired a new | |
1087 | field C<op_comp>, which is currently just for perl's internal use, and | |
1088 | should be initialised to NULL by other regex plugin modules. | |
1089 | ||
1090 | =item * | |
1091 | ||
1092 | A new function C<alloccoptash> has been added to the API, but is considered | |
1093 | experimental. See L<perlapi>. | |
1094 | ||
37133b20 RS |
1095 | =item * |
1096 | ||
1097 | Perl used to implement get magic in a way that would sometimes hide bugs in | |
1098 | code could call mg_get() too many times on magical values. This hiding of | |
1099 | errors no longer occurs, so long-standing bugs may become visible now. If | |
1100 | you see magic-related errors in XS code, check to make sure it, together | |
1101 | with the Perl API functions it uses, calls mg_get() only once on SvGMAGICAL() | |
1102 | values. | |
1103 | ||
1104 | =item * | |
1105 | ||
1106 | OP allocation for CVs now uses a slab allocator. This simplifies | |
1107 | memory management for OPs allocated to a CV, so cleaning up after a | |
1108 | compilation error is simpler and safer [perl #111462][perl #112312]. | |
1109 | ||
1110 | =item * | |
1111 | ||
1112 | PERL_DEBUG_READONLY_OPS has been rewritten to work with the new slab | |
1113 | allocator, allowing it to catch more violations than before. | |
1114 | ||
1115 | =item * | |
1116 | ||
1117 | The old slab allocator for ops, which was only enabled for PERL_IMPLICIT_SYS | |
1118 | and PERL_DEBUG_READONLY_OPS, has been retired. | |
1119 | ||
e5ba1bf1 FC |
1120 | =back |
1121 | ||
1122 | =head1 Selected Bug Fixes | |
1123 | ||
94b31d3f RS |
1124 | =over 4 |
1125 | ||
1126 | =item * | |
e5ba1bf1 | 1127 | |
f7b06e7f RS |
1128 | A bug, case-insensitive regex with UTF8-flagged strings, introduced |
1129 | earlier in the 5.17 series has been fixed. [perl #114982] | |
1130 | ||
1131 | =item * | |
1132 | ||
1133 | Attributes applied to lexical variables no longer leak memory. | |
1134 | [perl #114764] | |
1135 | ||
1136 | =item * | |
1137 | ||
1138 | C<dump>, C<goto>, C<last>, C<next>, C<redo> or C<require> followed by a | |
1139 | bareword (or version) and then an infix operator is no longer a syntax | |
1140 | error. It used to be for those infix operators (like C<+>) that have a | |
1141 | different meaning where a term is expected. [perl #105924] | |
1142 | ||
1143 | =item * | |
1144 | ||
1145 | C<require a::b . 1> and C<require a::b + 1> no longer produce erroneous | |
1146 | ambiguity warnings. [perl #107002] | |
1147 | ||
1148 | =item * | |
1149 | ||
1150 | Class method calls are now allowed on any string, and not just strings | |
1151 | beginning with an alphanumeric character. [perl #105922] | |
1152 | ||
1153 | =item * | |
1154 | ||
1155 | An empty pattern created with C<qr//> used in C<m///> no longer triggers | |
1156 | the "empty pattern reuses last pattern" behaviour. [perl #96230] | |
1157 | ||
1158 | =item * | |
1159 | ||
1160 | Tying a hash during iteration no longer results in a memory leak. | |
1161 | ||
1162 | =item * | |
1163 | ||
1164 | Freeing a tied hash during iteration no longer results in a memory leak. | |
1165 | ||
1166 | =item * | |
1167 | ||
1168 | List assignment to a tied array or hash that dies on STORE no longer | |
1169 | results in a memory leak. | |
1170 | ||
1171 | =item * | |
1172 | ||
1173 | If the hint hash (C<%^H>) is tied, compile-time scope entry (which copies | |
1174 | the hint hash) no longer leaks memory if FETCH dies. [perl #107000] | |
1175 | ||
1176 | =item * | |
1177 | ||
1178 | Constant folding no longer inappropriately triggers the special | |
1179 | C<split " "> behaviour. [perl #94490] | |
1180 | ||
1181 | =item * | |
1182 | ||
1183 | C<defined scalar(@array)>, C<defined do { &foo }>, and similar constructs | |
1184 | now treat the argument to C<defined> as a simple scalar. [perl #97466] | |
1185 | ||
1186 | =item * | |
1187 | ||
1188 | Running a custom debugging that defines no C<*DB::DB> glob or provides a | |
1189 | subroutine stub for C<&DB::DB> no longer results in a crash, but an error | |
1190 | instead. [perl #114990] | |
1191 | ||
1192 | =item * | |
1193 | ||
1194 | C<reset ""> now matches its documentation. C<reset> only resets C<m?...?> | |
1195 | patterns when called with no argument. An empty string for an argument now | |
1196 | does nothing. (It used to be treated as no argument.) [perl #97958] | |
1197 | ||
1198 | =item * | |
1199 | ||
1200 | C<printf> with an argument returning an empty list no longer reads past the | |
1201 | end of the stack, resulting in erratic behaviour. [perl #77094] | |
1202 | ||
1203 | =item * | |
1204 | ||
1205 | C<--subname> no longer produces erroneous ambiguity warnings. | |
1206 | [perl #77240] | |
1207 | ||
1208 | =item * | |
1209 | ||
1210 | C<v10> is now allowed as a label or package name. This was inadvertently | |
1211 | broken when v-strings were added in Perl 5.6. [perl #56880] | |
1212 | ||
1213 | =item * | |
1214 | ||
1215 | A regression introduced in 5.17.2 has been fixed, which made C</[\@\\]||/> | |
1216 | result in a "panic" error. [perl #115050] | |
1217 | ||
1218 | =item * | |
1219 | ||
1220 | C<length>, C<pos>, C<substr> and C<sprintf> could be confused by ties, | |
1221 | overloading, references and typeglobs if the stringification of such | |
1222 | changed the internal representation to or from UTF8. [perl #114410] | |
1223 | ||
1224 | =item * | |
1225 | ||
1226 | utf8::encode now calls FETCH and STORE on tied variables. utf8::decode now | |
1227 | calls STORE (it was already calling FETCH). | |
1228 | ||
1229 | =item * | |
1230 | ||
1231 | C<$tied =~ s/$non_utf8/$utf8/> no longer loops infinitely if the tied | |
1232 | variable returns a Latin-1 string, shared hash key scalar, or reference or | |
1233 | typeglob that stringifies as ASCII or Latin-1. This is a regression from | |
1234 | 5.12.x. | |
1235 | ||
1236 | =item * | |
1237 | ||
1238 | C<s///> without /e is now better at detecting when it needs to forego | |
1239 | certain optimisations, fixing some buggy cases: | |
1240 | ||
1241 | =over | |
1242 | ||
1243 | =item * | |
1244 | ||
1245 | Match variables in certain constructs (C<&&>, C<||>, C<..> and others) in | |
1246 | the replacement part; e.g., C<s/(.)/$l{$a||$1}/g>. [perl #26986] | |
1247 | ||
1248 | =item * | |
1249 | ||
1250 | Aliases to match variables in the replacement. | |
1251 | ||
1252 | =item * | |
1253 | ||
1254 | $REGERROR or $REGMARK in the replacement. [perl #49190] | |
1255 | ||
1256 | =item * | |
1257 | ||
1258 | An empty pattern (C<s//$foo/>) that causes the last-successful pattern to | |
1259 | be used, when that pattern contains code blocks that modify the variables | |
1260 | in the replacement. | |
1261 | ||
1262 | =back | |
1263 | ||
1264 | =item * | |
1265 | ||
1266 | The taintedness of the replacement string no longer affects the taintedness | |
1267 | of the return value of C<s///e>. | |
1268 | ||
1269 | =item * | |
1270 | ||
1271 | The C<$|> autoflush variable is created on-the-fly when needed. If this | |
1272 | happened (e.g., if it was mentioned in a module or eval) when the | |
1273 | currently-selected filehandle was a typeglob with an empty IO slot, it used | |
1274 | to crash. [perl #115206] | |
1275 | ||
1276 | =item * | |
1277 | ||
1278 | Line numbers at the end of a string eval are no longer off by one. | |
1279 | [perl #114658] | |
1280 | ||
1281 | =item * | |
1282 | ||
1283 | @INC filters (subroutines returned by subroutines in @INC) that set $_ to a | |
1284 | copy-on-write scalar no longer cause the parser to modify that string | |
1285 | buffer in place. | |
1286 | ||
1287 | =item * | |
1288 | ||
1289 | C<length($object)> no longer returns the undefined value if the object has | |
1290 | string overloading that returns undef. [perl #115260] | |
1291 | ||
1292 | =item * | |
1293 | ||
1294 | The use of C<PL_stashcache>, the stash name lookup cache for method calls, has | |
1295 | been restored, | |
1296 | ||
1297 | Commit da6b625f78f5f133 in August 2011 inadvertently broke the code that looks | |
1298 | up values in C<PL_stashcache>. As it's a only cache, quite correctly everything | |
1299 | carried on working without it. | |
1300 | ||
1301 | =item * | |
1302 | ||
00785cb7 RS |
1303 | The error "Can't localize through a reference" had disappeared in 5.16.0 |
1304 | when C<local %$ref> appeared on the last line of an lvalue subroutine. | |
1305 | This error disappeared for C<\local %$ref> in perl 5.8.1. It has now | |
1306 | been restored. | |
1307 | ||
1308 | =item * | |
1309 | ||
1310 | The parsing of here-docs has been improved significantly, fixing several | |
1311 | parsing bugs and crashes and one memory leak, and correcting wrong | |
1312 | subsequent line numbers under certain conditions. | |
1313 | ||
1314 | =item * | |
1315 | ||
1316 | Inside an eval, the error message for an unterminated here-doc no longer | |
1317 | has a newline in the middle of it [perl #70836]. | |
1318 | ||
1319 | =item * | |
1320 | ||
1321 | A substitution inside a substitution pattern (C<s/${s|||}//>) no longer | |
1322 | confuses the parser. | |
1323 | ||
1324 | =item * | |
1325 | ||
1326 | It may be an odd place to allow comments, but C<s//"" # hello/e> has | |
1327 | always worked, I<unless> there happens to be a null character before the | |
1328 | first #. Now it works even in the presence of nulls. | |
1329 | ||
1330 | =item * | |
1331 | ||
1332 | An invalid range in C<tr///> or C<y///> no longer results in a memory leak. | |
1333 | ||
1334 | =item * | |
1335 | ||
1336 | String eval no longer treats a semicolon-delimited quote-like operator at | |
1337 | the very end (C<eval 'q;;'>) as a syntax error. | |
1338 | ||
1339 | =item * | |
1340 | ||
1341 | C<< warn {$_ => 1} + 1 >> is no longer a syntax error. The parser used to | |
1342 | get confused with certain list operators followed by an anonymous hash and | |
1343 | then an infix operator that shares its form with a unary operator. | |
1344 | ||
1345 | =item * | |
1346 | ||
1347 | C<(caller $n)[6]> (which gives the text of the eval) used to return the | |
1348 | actual parser buffer. Modifying it could result in crashes. Now it always | |
1349 | returns a copy. The string returned no longer has "\n;" tacked on to the | |
1350 | end. The returned text also includes here-doc bodies, which used to be | |
1351 | omitted. | |
1352 | ||
1353 | =item * | |
1354 | ||
1355 | Reset the utf8 position cache when accessing magical variables to avoid the | |
1356 | string buffer and the utf8 position cache getting out of sync | |
1357 | [perl #114410]. | |
1358 | ||
1359 | =item * | |
1360 | ||
1361 | Various cases of get magic being called twice for magical utf8 strings have been | |
1362 | fixed. | |
1363 | ||
1364 | =item * | |
1365 | ||
1366 | This code (when not in the presence of C<$&> etc) | |
1367 | ||
1368 | $_ = 'x' x 1_000_000; | |
1369 | 1 while /(.)/; | |
1370 | ||
1371 | used to skip the buffer copy for performance reasons, but suffered from C<$1> | |
1372 | etc changing if the original string changed. That's now been fixed. | |
1373 | ||
1374 | =item * | |
1375 | ||
1376 | Perl doesn't use PerlIO anymore to report out of memory messages, as PerlIO | |
1377 | might attempt to allocate more memory. | |
1378 | ||
1379 | =item * | |
1380 | ||
1381 | In a regular expression, if something is quantified with C<{n,m}> | |
1382 | where C<S<n E<gt> m>>, it can't possibly match. Previously this was a fatal error, | |
1383 | but now is merely a warning (and that something won't match). [perl #82954]. | |
1384 | ||
1385 | =item * | |
1386 | ||
1387 | It used to be possible for formats defined in subroutines that have | |
1388 | subsequently been undefined and redefined to close over variables in the | |
1389 | wrong pad (the newly-defined enclosing sub), resulting in crashes or | |
1390 | "Bizarre copy" errors. | |
1391 | ||
1392 | =item * | |
1393 | ||
1394 | Redefinition of XSUBs at run time could produce warnings with the wrong | |
1395 | line number. | |
1396 | ||
1397 | =item * | |
1398 | ||
1399 | The %vd sprintf format does not support version objects for alpha versions. | |
1400 | It used to output the format itself (%vd) when passed an alpha version, and | |
1401 | also emit an "Invalid conversion in printf" warning. It no longer does, | |
1402 | but produces the empty string in the output. It also no longer leaks | |
1403 | memory in this case. | |
1404 | ||
1405 | =item * | |
1406 | ||
1407 | A bug fix in an earlier 5.17.x release caused C<no a a 3> (a syntax error) | |
1408 | to result in a bad read or assertion failure, because an op was being freed | |
1409 | twice. | |
1410 | ||
1411 | =item * | |
1412 | ||
1413 | C<< $obj->SUPER::method >> calls in the main package could fail if the | |
1414 | SUPER package had already been accessed by other means. | |
1415 | ||
1416 | =item * | |
1417 | ||
1418 | Stash aliasing (C<*foo:: = *bar::>) no longer causes SUPER calls to ignore | |
1419 | changes to methods or @ISA or use the wrong package. | |
1420 | ||
1421 | =item * | |
1422 | ||
1423 | Method calls on packages whose names end in ::SUPER are no longer treated | |
1424 | as SUPER method calls, resulting in failure to find the method. | |
1425 | Furthermore, defining subroutines in such packages no longer causes them to | |
1426 | be found by SUPER method calls on the containing package [perl #114924]. | |
1427 | ||
00785cb7 RS |
1428 | =item * |
1429 | ||
94b31d3f RS |
1430 | C<\w> now matches the code points U+200C (ZERO WIDTH NON-JOINER) and U+200D |
1431 | (ZERO WIDTH JOINER). C<\W> no longer matches these. This change is because | |
1432 | Unicode corrected their definition of what C<\w> should match. | |
e5ba1bf1 | 1433 | |
94b31d3f RS |
1434 | =item * |
1435 | ||
1436 | C<dump LABEL> no longer leaks its label. | |
1437 | ||
1438 | =item * | |
1439 | ||
1440 | Constant folding no longer changes the behaviour of functions like C<stat()> | |
1441 | and C<truncate()> that can take either filenames or handles. | |
1442 | C<stat 1 ? foo : bar> nows treats its argument as a file name (since it is an | |
1443 | arbitrary expression), rather than the handle "foo". | |
1444 | ||
1445 | =item * | |
1446 | ||
1447 | C<truncate FOO, $len> no longer falls back to treating "FOO" as a file name if | |
1448 | the filehandle has been deleted. This was broken in Perl 5.16.0. | |
1449 | ||
1450 | =item * | |
1451 | ||
1452 | Subroutine redefinitions after sub-to-glob and glob-to-glob assignments no | |
1453 | longer cause double frees or panic messages. | |
1454 | ||
1455 | =item * | |
1456 | ||
1457 | C<s///> now turns vstrings into plain strings when performing a substitution, | |
1458 | even if the resulting string is the same (C<s/a/a/>). | |
1459 | ||
1460 | =item * | |
1461 | ||
1462 | Prototype mismatch warnings no longer erroneously treat constant subs as having | |
1463 | no prototype when they actually have "". | |
1464 | ||
1465 | =item * | |
1466 | ||
1467 | Constant subroutines and forward declarations no longer prevent prototype | |
1468 | mismatch warnings from omitting the sub name. | |
1469 | ||
1470 | =item * | |
1471 | ||
1472 | C<undef> on a subroutine now clears call checkers. | |
1473 | ||
1474 | =item * | |
1475 | ||
1476 | The C<ref> operator started leaking memory on blessed objects in Perl 5.16.0. | |
1477 | This has been fixed [perl #114340]. | |
1478 | ||
1479 | =item * | |
1480 | ||
1481 | C<use> no longer tries to parse its arguments as a statement, making | |
1482 | C<use constant { () };> a syntax error [perl #114222]. | |
1483 | ||
1484 | =item * | |
1485 | ||
1486 | On debugging builds, "uninitialized" warnings inside formats no longer cause | |
1487 | assertion failures. | |
1488 | ||
1489 | =item * | |
1490 | ||
1491 | On debugging builds, subroutines nested inside formats no longer cause | |
1492 | assertion failures [perl #78550]. | |
1493 | ||
1494 | =item * | |
1495 | ||
1496 | Formats and C<use> statements are now permitted inside formats. | |
1497 | ||
1498 | =item * | |
1499 | ||
1500 | C<print $x> and C<sub { print $x }-E<gt>()> now always produce the same output. | |
1501 | It was possible for the latter to refuse to close over $x if the variable was | |
1502 | not active; e.g., if it was defined outside a currently-running named | |
1503 | subroutine. | |
1504 | ||
1505 | =item * | |
1506 | ||
1507 | Similarly, C<print $x> and C<print eval '$x'> now produce the same output. | |
1508 | This also allows "my $x if 0" variables to be seen in the debugger [perl | |
1509 | #114018]. | |
1510 | ||
1511 | =item * | |
1512 | ||
1513 | Formats called recursively no longer stomp on their own lexical variables, but | |
1514 | each recursive call has its own set of lexicals. | |
1515 | ||
1516 | =item * | |
1517 | ||
1518 | Attempting to free an active format or the handle associated with it no longer | |
1519 | results in a crash. | |
1520 | ||
1521 | =item * | |
1522 | ||
1523 | Format parsing no longer gets confused by braces, semicolons and low-precedence | |
1524 | operators. It used to be possible to use braces as format delimiters (instead | |
1525 | of C<=> and C<.>), but only sometimes. Semicolons and low-precedence operators | |
1526 | in format argument lines no longer confuse the parser into ignoring the line's | |
1527 | return value. In format argument lines, braces can now be used for anonymous | |
1528 | hashes, instead of being treated always as C<do> blocks. | |
1529 | ||
1530 | =item * | |
1531 | ||
1532 | Formats can now be nested inside code blocks in regular expressions and other | |
1533 | quoted constructs (C</(?{...})/> and C<qq/${...}/>) [perl #114040]. | |
1534 | ||
1535 | =item * | |
1536 | ||
1537 | Formats are no longer created after compilation errors. | |
1538 | ||
1539 | =item * | |
1540 | ||
1541 | Some format syntax errors started causing crashes in Perl 5.17.2, but have now | |
1542 | been fixed. | |
1543 | ||
1544 | =item * | |
1545 | ||
1546 | Under debugging builds, the B<-DA> command line option started crashing in Perl | |
1547 | 5.16.0. It has been fixed [perl #114368]. | |
1548 | ||
1549 | =item * | |
1550 | ||
1551 | Scope::Escape compatibility, which was broken in Perl 5.17.2, has been restored | |
1552 | [perl #113872]. | |
1553 | ||
1554 | =item * | |
1555 | ||
1556 | A potential deadlock scenario involving the premature termination of a pseudo- | |
1557 | forked child in a Windows build with ithreads enabled has been fixed. This | |
1558 | resolves the common problem of the F<t/op/fork.t> test hanging on Windows [perl | |
1559 | #88840]. | |
1560 | ||
1561 | =item * | |
1562 | ||
1563 | The microperl build, broken since Perl 5.15.7, has now been restored. | |
1564 | ||
1565 | =item * | |
1566 | ||
1567 | The code which generates errors from C<require()> could potentially read one or | |
1568 | two bytes before the start of the filename for filenames less than three bytes | |
1569 | long and ending C</\.p?\z/>. This has now been fixed. Note that it could | |
1570 | never have happened with module names given to C<use()> or C<require()> anyway. | |
1571 | ||
1572 | =item * | |
1573 | ||
1574 | The handling of pathnames of modules given to C<require()> has been made | |
1575 | thread-safe on VMS. | |
1576 | ||
1577 | =item * | |
1578 | ||
1579 | The C<re_compile()> API function, the entry point for perl's regex compiler, | |
1580 | was accidentally changed in Perl 5.17.1 to operate on the current engine. This | |
1581 | has now been restored to its former core-engine-specific state [perl #114302]. | |
1582 | ||
1583 | =item * | |
1584 | ||
1585 | Perl 5.17.1 introduced a memory leak into the re-use of run-time regexes where | |
1586 | the pattern hasn't changed (i.e. C</$unchanging/>). This has now been fixed. | |
1587 | ||
1588 | =item * | |
1589 | ||
1590 | A bug in the compilation of a C</(?{})/> expression which affected the TryCatch | |
1591 | test suite has been fixed [perl #114242]. | |
1592 | ||
1593 | =item * | |
1594 | ||
1595 | Formats no longer leak. They started leaking in Perl 5.17.2. | |
1596 | ||
1597 | =item * | |
1598 | ||
1599 | Pod can now be nested in code inside a quoted construct outside of a string | |
1600 | eval. This used to work only within string evals [perl #114040]. | |
e5ba1bf1 FC |
1601 | |
1602 | =item * | |
1603 | ||
0bba4573 RS |
1604 | C<goto ''> now looks for an empty label, producing the "goto must have |
1605 | label" error message, instead of exiting the program [perl #111794]. | |
e5ba1bf1 | 1606 | |
0bba4573 | 1607 | =item * |
e5ba1bf1 | 1608 | |
0bba4573 RS |
1609 | C<goto "\0"> now dies with "Can't find label" instead of "goto must have |
1610 | label". | |
e5ba1bf1 | 1611 | |
0bba4573 | 1612 | =item * |
e5ba1bf1 | 1613 | |
0bba4573 RS |
1614 | The C function C<hv_store> used to result in crashes when used on C<%^H> |
1615 | [perl #111000]. | |
e5ba1bf1 | 1616 | |
0bba4573 RS |
1617 | =item * |
1618 | ||
1619 | A call checker attached to a closure prototype via C<cv_set_call_checker> | |
1620 | is now copied to closures cloned from it. So C<cv_set_call_checker> now | |
1621 | works inside an attribute handler for a closure. | |
e5ba1bf1 FC |
1622 | |
1623 | =item * | |
1624 | ||
0bba4573 RS |
1625 | Writing to C<$^N> used to have no effect. Now it croaks with "Modification |
1626 | of a read-only value" by default, but that can be overridden by a custom | |
1627 | regular expression engine, as with C<$1> [perl #112184]. | |
1628 | ||
23dd6e2e FC |
1629 | =item * |
1630 | ||
0bba4573 RS |
1631 | C<undef> on a control character glob (C<undef *^H>) no longer emits an |
1632 | erroneous warning about ambiguity [perl #112456]. | |
23dd6e2e | 1633 | |
0bba4573 RS |
1634 | =item * |
1635 | ||
1636 | For efficiency's sake, many operators and built-in functions return the | |
1637 | same scalar each time. Lvalue subroutines and subroutines in the CORE:: | |
1638 | namespace were allowing this implementation detail to leak through. | |
1639 | C<print &CORE::uc("a"), &CORE::uc("b")> used to print "BB". The same thing | |
1640 | would happen with an lvalue subroutine returning the return value of C<uc>. | |
1641 | Now the value is copied in such cases. | |
23dd6e2e FC |
1642 | |
1643 | =item * | |
1644 | ||
0bba4573 RS |
1645 | C<method {}> syntax with an empty block or a block returning an empty list |
1646 | used to crash or use some random value left on the stack as its invocant. | |
1647 | Now it produces an error. | |
b92848b5 | 1648 | |
0f023b5a FC |
1649 | =item * |
1650 | ||
0bba4573 | 1651 | C<vec> now works with extremely large offsets (E<gt>2 GB) [perl #111730]. |
0f023b5a FC |
1652 | |
1653 | =item * | |
1654 | ||
0bba4573 RS |
1655 | Changes to overload settings now take effect immediately, as do changes to |
1656 | inheritance that affect overloading. They used to take effect only after | |
1657 | C<bless>. | |
1658 | ||
1659 | Objects that were created before a class had any overloading used to remain | |
1660 | non-overloaded even if the class gained overloading through C<use overload> | |
1661 | or @ISA changes, and even after C<bless>. This has been fixed | |
1662 | [perl #112708]. | |
c53e3a75 FC |
1663 | |
1664 | =item * | |
1665 | ||
0bba4573 | 1666 | Classes with overloading can now inherit fallback values. |
c53e3a75 FC |
1667 | |
1668 | =item * | |
1669 | ||
0bba4573 RS |
1670 | Overloading was not respecting a fallback value of 0 if there were |
1671 | overloaded objects on both sides of an assignment operator like C<+=> | |
1672 | [perl #111856]. | |
0f023b5a FC |
1673 | |
1674 | =item * | |
1675 | ||
0bba4573 RS |
1676 | C<pos> now croaks with hash and array arguments, instead of producing |
1677 | erroneous warnings. | |
0f023b5a FC |
1678 | |
1679 | =item * | |
1680 | ||
0bba4573 RS |
1681 | C<while(each %h)> now implies C<while(defined($_ = each %h))>, like |
1682 | C<readline> and C<readdir>. | |
0f023b5a | 1683 | |
0bba4573 RS |
1684 | =item * |
1685 | ||
1686 | Subs in the CORE:: namespace no longer crash after C<undef *_> when called | |
1687 | with no argument list (C<&CORE::time> with no parentheses). | |
1688 | ||
1689 | =item * | |
1690 | ||
1691 | Unicode 6.1 published an incorrect alias for one of the | |
1692 | Canonical_Combining_Class property's values (which range between 0 and | |
1693 | 254). The alias C<CCC133> should have been C<CCC132>. Perl now | |
1694 | overrides the data file furnished by Unicode to give the correct value. | |
1695 | ||
1696 | =item * | |
1697 | ||
1698 | C<unpack> no longer produces the "'/' must follow a numeric type in unpack" | |
1699 | error when it is the data that are at fault [perl #60204]. | |
1700 | ||
1701 | =item * | |
1702 | ||
1703 | C<join> and C<"@array"> now call FETCH only once on a tied C<$"> | |
1704 | [perl #8931]. | |
1705 | ||
1706 | =item * | |
1707 | ||
1708 | Some subroutine calls generated by compiling core ops affected by a | |
1709 | C<CORE::GLOBAL> override had op checking performed twice. The checking | |
1710 | is always idempotent for pure Perl code, but the double checking can | |
1711 | matter when custom call checkers are involved. | |
1712 | ||
1713 | =item * | |
1714 | ||
1715 | A race condition used to exist around fork that could cause a signal sent to | |
1716 | the parent to be handled by both parent and child. Signals are now blocked | |
1717 | briefly around fork to prevent this from happening [perl #82580]. | |
e5ba1bf1 | 1718 | |
0fef449b RS |
1719 | =item * |
1720 | ||
1721 | The implementation of code blocks in regular expressions, such as C<(?{})> | |
1722 | and C<(??{})>, has been heavily reworked to eliminate a whole slew of bugs. | |
1723 | The main user-visible changes are: | |
1724 | ||
1725 | =over 4 | |
1726 | ||
1727 | =item * | |
1728 | ||
1729 | Code blocks within patterns are now parsed in the same pass as the | |
1730 | surrounding code; in particular it is no longer necessary to have balanced | |
1731 | braces: this now works: | |
1732 | ||
1733 | /(?{ $x='{' })/ | |
1734 | ||
1735 | This means that this error message is longer generated: | |
1736 | ||
1737 | Sequence (?{...}) not terminated or not {}-balanced in regex | |
1738 | ||
1739 | but a new error may be seen: | |
1740 | ||
1741 | Sequence (?{...}) not terminated with ')' | |
1742 | ||
1743 | In addition, literal code blocks within run-time patterns are only | |
1744 | compiled once, at perl compile-time: | |
1745 | ||
1746 | for my $p (...) { | |
1747 | # this 'FOO' block of code is compiled once, | |
1748 | # at the same time as the surrounding 'for' loop | |
1749 | /$p{(?{FOO;})/; | |
1750 | } | |
1751 | ||
1752 | =item * | |
1753 | ||
1754 | Lexical variables are now sane as regards scope, recursion and closure | |
1755 | behavior. In particular, C</A(?{B})C/> behaves (from a closure viewpoint) | |
1756 | exactly like C</A/ && do { B } && /C/>, while C<qr/A(?{B})C/> is like | |
1757 | C<sub {/A/ && do { B } && /C/}>. So this code now works how you might | |
1758 | expect, creating three regexes that match 0, 1, and 2: | |
1759 | ||
1760 | for my $i (0..2) { | |
1761 | push @r, qr/^(??{$i})$/; | |
1762 | } | |
1763 | "1" =~ $r[1]; # matches | |
1764 | ||
1765 | =item * | |
1766 | ||
1767 | The C<use re 'eval'> pragma is now only required for code blocks defined | |
1768 | at runtime; in particular in the following, the text of the C<$r> pattern is | |
1769 | still interpolated into the new pattern and recompiled, but the individual | |
1770 | compiled code-blocks within C<$r> are reused rather than being recompiled, | |
1771 | and C<use re 'eval'> isn't needed any more: | |
1772 | ||
1773 | my $r = qr/abc(?{....})def/; | |
1774 | /xyz$r/; | |
1775 | ||
1776 | =item * | |
1777 | ||
1778 | Flow control operators no longer crash. Each code block runs in a new | |
1779 | dynamic scope, so C<next> etc. will not see | |
1780 | any enclosing loops. C<return> returns a value | |
1781 | from the code block, not from any enclosing subroutine. | |
1782 | ||
1783 | =item * | |
1784 | ||
1785 | Perl normally caches the compilation of run-time patterns, and doesn't | |
1786 | recompile if the pattern hasn't changed, but this is now disabled if | |
1787 | required for the correct behavior of closures. For example: | |
1788 | ||
1789 | my $code = '(??{$x})'; | |
1790 | for my $x (1..3) { | |
1791 | # recompile to see fresh value of $x each time | |
1792 | $x =~ /$code/; | |
1793 | } | |
1794 | ||
0fef449b RS |
1795 | =item * |
1796 | ||
1797 | The C</msix> and C<(?msix)> etc. flags are now propagated into the return | |
1798 | value from C<(??{})>; this now works: | |
1799 | ||
1800 | "AB" =~ /a(??{'b'})/i; | |
1801 | ||
1802 | =item * | |
1803 | ||
1804 | Warnings and errors will appear to come from the surrounding code (or for | |
1805 | run-time code blocks, from an eval) rather than from an C<re_eval>: | |
1806 | ||
1807 | use re 'eval'; $c = '(?{ warn "foo" })'; /$c/; | |
1808 | /(?{ warn "foo" })/; | |
1809 | ||
1810 | formerly gave: | |
1811 | ||
1812 | foo at (re_eval 1) line 1. | |
1813 | foo at (re_eval 2) line 1. | |
1814 | ||
1815 | and now gives: | |
1816 | ||
1817 | foo at (eval 1) line 1. | |
1818 | foo at /some/prog line 2. | |
1819 | ||
1820 | =back | |
1821 | ||
1822 | =item * | |
1823 | ||
1824 | Perl now works as well as can be expected on all releases of Unicode so | |
1825 | far. In v5.16, it worked on Unicodes 6.0 and 6.1, but there were | |
1826 | various bugs for earlier releases; the older the release the more | |
1827 | problems. | |
1828 | ||
1829 | =item * | |
1830 | ||
1831 | C<vec> no longer produces "uninitialized" warnings in lvalue context | |
1832 | [perl #9423]. | |
1833 | ||
1834 | =item * | |
1835 | ||
1836 | An optimization involving fixed strings in regular expressions could cause | |
1837 | a severe performance penalty in edge cases. This has been fixed | |
1838 | [perl #76546]. | |
1839 | ||
1840 | =item * | |
1841 | ||
1842 | In certain cases, including empty subpatterns within a regular expression (such | |
1843 | as C<(?:)> or C<(?:|)>) could disable some optimizations. This has been fixed. | |
1844 | ||
1845 | =item * | |
1846 | ||
1847 | The "Can't find an opnumber" message that C<prototype> produces when passed | |
1848 | a string like "CORE::nonexistent_keyword" now passes UTF-8 and embedded | |
1849 | NULs through unchanged [perl #97478]. | |
1850 | ||
1851 | =item * | |
1852 | ||
1853 | C<prototype> now treats magical variables like C<$1> the same way as | |
1854 | non-magical variables when checking for the CORE:: prefix, instead of | |
1855 | treating them as subroutine names. | |
1856 | ||
1857 | =item * | |
1858 | ||
1859 | Under threaded perls, a runtime code block in a regular expression could | |
1860 | corrupt the package name stored in the op tree, resulting in bad reads | |
1861 | in C<caller>, and possibly crashes [perl #113060]. | |
1862 | ||
1863 | =item * | |
1864 | ||
1865 | Referencing a closure prototype (C<\&{$_[1]}> in an attribute handler for a | |
1866 | closure) no longer results in a copy of the subroutine (or assertion | |
1867 | failures on debugging builds). | |
1868 | ||
1869 | =item * | |
1870 | ||
1871 | C<eval '__PACKAGE__'> now returns the right answer on threaded builds if | |
1872 | the current package has been assigned over (as in | |
1873 | C<*ThisPackage:: = *ThatPackage::>) [perl #78742]. | |
1874 | ||
1875 | =item * | |
1876 | ||
1877 | If a package is deleted by code that it calls, it is possible for C<caller> | |
1878 | to see a stack frame belonging to that deleted package. C<caller> could | |
1879 | crash if the stash's memory address was reused for a scalar and a | |
1880 | substitution was performed on the same scalar [perl #113486]. | |
1881 | ||
1882 | =item * | |
1883 | ||
1884 | C<UNIVERSAL::can> no longer treats its first argument differently | |
1885 | depending on whether it is a string or number internally. | |
1886 | ||
1887 | =item * | |
1888 | ||
1889 | C<open> with C<< <& >> for the mode checks to see whether the third argument is | |
1890 | a number, in determining whether to treat it as a file descriptor or a handle | |
1891 | name. Magical variables like C<$1> were always failing the numeric check and | |
1892 | being treated as handle names. | |
1893 | ||
1894 | =item * | |
1895 | ||
1896 | C<warn>'s handling of magical variables (C<$1>, ties) has undergone several | |
1897 | fixes. C<FETCH> is only called once now on a tied argument or a tied C<$@> | |
1898 | [perl #97480]. Tied variables returning objects that stringify as "" are | |
1899 | no longer ignored. A tied C<$@> that happened to return a reference the | |
1900 | I<previous> time it was used is no longer ignored. | |
1901 | ||
1902 | =item * | |
1903 | ||
1904 | C<warn ""> now treats C<$@> with a number in it the same way, regardless of | |
1905 | whether it happened via C<$@=3> or C<$@="3">. It used to ignore the | |
1906 | former. Now it appends "\t...caught", as it has always done with | |
1907 | C<$@="3">. | |
1908 | ||
1909 | =item * | |
1910 | ||
1911 | Numeric operators on magical variables (e.g., S<C<$1 + 1>>) used to use | |
1912 | floating point operations even where integer operations were more appropriate, | |
1913 | resulting in loss of accuracy on 64-bit platforms [perl #109542]. | |
1914 | ||
1915 | =item * | |
1916 | ||
1917 | Unary negation no longer treats a string as a number if the string happened | |
1918 | to be used as a number at some point. So, if C<$x> contains the string "dogs", | |
1919 | C<-$x> returns "-dogs" even if C<$y=0+$x> has happened at some point. | |
1920 | ||
1921 | =item * | |
1922 | ||
1923 | In Perl 5.14, C<-'-10'> was fixed to return "10", not "+10". But magical | |
1924 | variables (C<$1>, ties) were not fixed till now [perl #57706]. | |
1925 | ||
1926 | =item * | |
1927 | ||
1928 | Unary negation now treats strings consistently, regardless of the internal | |
1929 | C<UTF8> flag. | |
1930 | ||
1931 | =item * | |
1932 | ||
1933 | A regression introduced in Perl v5.16.0 involving | |
1934 | C<tr/I<SEARCHLIST>/I<REPLACEMENTLIST>/> has been fixed. Only the first | |
1935 | instance is supposed to be meaningful if a character appears more than | |
1936 | once in C<I<SEARCHLIST>>. Under some circumstances, the final instance | |
1937 | was overriding all earlier ones. [perl #113584] | |
1938 | ||
1939 | =item * | |
1940 | ||
1941 | Regular expressions like C<qr/\87/> previously silently inserted a NUL | |
1942 | character, thus matching as if it had been written C<qr/\00087/>. Now it | |
1943 | matches as if it had been written as C<qr/87/>, with a message that the | |
1944 | sequence C<"\8"> is unrecognized. | |
1945 | ||
1946 | =item * | |
1947 | ||
1948 | C<__SUB__> now works in special blocks (C<BEGIN>, C<END>, etc.). | |
1949 | ||
1950 | =item * | |
1951 | ||
1952 | Thread creation on Windows could theoretically result in a crash if done | |
1953 | inside a C<BEGIN> block. It still does not work properly, but it no longer | |
1954 | crashes [perl #111610]. | |
1955 | ||
1956 | =item * | |
1957 | ||
1958 | C<\&{''}> (with the empty string) now autovivifies a stub like any other | |
1959 | sub name, and no longer produces the "Unable to create sub" error | |
1960 | [perl #94476]. | |
1961 | ||
37133b20 RS |
1962 | =item * |
1963 | ||
1964 | A regression introduced in v5.14.0 has been fixed, in which some calls | |
1965 | to the C<re> module would clobber C<$_> [perl #113750]. | |
1966 | ||
1967 | =item * | |
1968 | ||
1969 | C<do FILE> now always either sets or clears C<$@>, even when the file can't be | |
1970 | read. This ensures that testing C<$@> first (as recommended by the | |
1971 | documentation) always returns the correct result. | |
1972 | ||
1973 | =item * | |
1974 | ||
1975 | The array iterator used for the C<each @array> construct is now correctly | |
1976 | reset when C<@array> is cleared (RT #75596). This happens for example when the | |
1977 | array is globally assigned to, as in C<@array = (...)>, but not when its | |
1978 | B<values> are assigned to. In terms of the XS API, it means that C<av_clear()> | |
1979 | will now reset the iterator. | |
1980 | ||
1981 | This mirrors the behaviour of the hash iterator when the hash is cleared. | |
1982 | ||
1983 | =item * | |
1984 | ||
1985 | C<< $class->can >>, C<< $class->isa >>, and C<< $class->DOES >> now return | |
1986 | correct results, regardless of whether that package referred to by C<$class> | |
1987 | exists [perl #47113]. | |
1988 | ||
1989 | =item * | |
1990 | ||
1991 | Arriving signals no longer clear C<$@> [perl #45173]. | |
1992 | ||
1993 | =item * | |
1994 | ||
1995 | Allow C<my ()> declarations with an empty variable list [perl #113554]. | |
1996 | ||
1997 | =item * | |
1998 | ||
1999 | During parsing, subs declared after errors no longer leave stubs | |
2000 | [perl #113712]. | |
2001 | ||
2002 | =item * | |
2003 | ||
2004 | Closures containing no string evals no longer hang on to their containing | |
2005 | subroutines, allowing variables closed over by outer subroutines to be | |
2006 | freed when the outer sub is freed, even if the inner sub still exists | |
2007 | [perl #89544]. | |
2008 | ||
2009 | =item * | |
2010 | ||
2011 | Duplication of in-memory filehandles by opening with a "<&=" or ">&=" mode | |
2012 | stopped working properly in 5.16.0. It was causing the new handle to | |
2013 | reference a different scalar variable. This has been fixed [perl #113764]. | |
2014 | ||
2015 | =item * | |
2016 | ||
2017 | C<qr//> expressions no longer crash with custom regular expression engines | |
2018 | that do not set C<offs> at regular expression compilation time | |
2019 | [perl #112962]. | |
2020 | ||
2021 | =item * | |
2022 | ||
2023 | C<delete local> no longer crashes with certain magical arrays and hashes | |
2024 | [perl #112966]. | |
2025 | ||
2026 | =item * | |
2027 | ||
2028 | C<local> on elements of certain magical arrays and hashes used not to | |
2029 | arrange to have the element deleted on scope exit, even if the element did | |
2030 | not exist before C<local>. | |
2031 | ||
2032 | =item * | |
2033 | ||
2034 | C<scalar(write)> no longer returns multiple items [perl #73690]. | |
2035 | ||
2036 | =item * | |
2037 | ||
2038 | String to floating point conversions no longer misparse certain strings under | |
2039 | C<use locale> [perl #109318]. | |
2040 | ||
2041 | =item * | |
2042 | ||
2043 | C<@INC> filters that die no longer leak memory [perl #92252]. | |
2044 | ||
2045 | =item * | |
2046 | ||
2047 | The implementations of overloaded operations are now called in the correct | |
2048 | context. This allows, among other things, being able to properly override | |
2049 | C<< <> >> [perl #47119]. | |
2050 | ||
2051 | =item * | |
2052 | ||
2053 | Specifying only the C<fallback> key when calling C<use overload> now behaves | |
2054 | properly [perl #113010]. | |
2055 | ||
2056 | =item * | |
2057 | ||
2058 | C<< sub foo { my $a = 0; while ($a) { ... } } >> and | |
2059 | C<< sub foo { while (0) { ... } } >> now return the same thing [perl #73618]. | |
2060 | ||
2061 | =item * | |
2062 | ||
2063 | Fixed the debugger C<l> and C<M> commands, and other debugger | |
2064 | functionality which was broken in 5.17.0 [perl #113918]. | |
2065 | ||
2066 | =item * | |
2067 | ||
2068 | String negation now behaves the same under C<use integer;> as it does | |
2069 | without [perl #113012]. | |
2070 | ||
2071 | =item * | |
2072 | ||
2073 | C<chr> now returns the Unicode replacement character (U+FFFD) for -1, | |
2074 | regardless of the internal representation. -1 used to wrap if the argument | |
2075 | was tied or a string internally. | |
2076 | ||
2077 | =item * | |
2078 | ||
2079 | Using a C<format> after its enclosing sub was freed could crash as of | |
2080 | perl 5.12.0, if the format referenced lexical variables from the outer sub. | |
2081 | ||
2082 | =item * | |
2083 | ||
2084 | Using a C<format> after its enclosing sub was undefined could crash as of | |
2085 | perl 5.10.0, if the format referenced lexical variables from the outer sub. | |
2086 | ||
2087 | =item * | |
2088 | ||
2089 | Using a C<format> defined inside a closures, which format references | |
2090 | lexical variables from outside, never really worked unless the C<write> | |
2091 | call was directly inside the closure. In 5.10.0 it even started crashing. | |
2092 | Now the copy of that closure nearest the top of the call stack is used to | |
2093 | find those variables. | |
2094 | ||
2095 | =item * | |
2096 | ||
2097 | Formats that close over variables in special blocks no longer crash if a | |
2098 | stub exists with the same name as the special block before the special | |
2099 | block is compiled. | |
2100 | ||
2101 | =item * | |
2102 | ||
2103 | The parser no longer gets confused, treating C<eval foo ()> as a syntax | |
2104 | error if preceded by C<print;> [perl #16249]. | |
2105 | ||
2106 | =item * | |
2107 | ||
2108 | The return value of C<syscall> is no longer truncated on 64-bit platforms | |
2109 | [perl #113980]. | |
2110 | ||
2111 | =item * | |
2112 | ||
2113 | Constant folding no longer causes C<print 1 ? FOO : BAR> to print to the | |
2114 | FOO handle [perl #78064]. | |
2115 | ||
2116 | =item * | |
2117 | ||
2118 | C<do subname> now calls the named subroutine and uses the file name it | |
2119 | returns, instead of opening a file named "subname". | |
2120 | ||
2121 | =item * | |
2122 | ||
2123 | Subroutines looked up by rv2cv check hooks (registered by XS modules) are | |
2124 | now taken into consideration when determining whether C<foo bar> should be | |
2125 | the sub call C<foo(bar)> or the method call C<< "bar"->foo >>. | |
2126 | ||
2127 | =item * | |
2128 | ||
2129 | C<CORE::foo::bar> is no longer treated specially, allowing global overrides | |
2130 | to be called directly via C<CORE::GLOBAL::uc(...)> [perl #113016]. | |
2131 | ||
2132 | =item * | |
2133 | ||
2134 | Calling an undefined sub whose typeglob has been undefined now produces the | |
2135 | customary "Undefined subroutine called" error, instead of "Not a CODE | |
2136 | reference". | |
2137 | ||
2138 | =item * | |
2139 | ||
2140 | Two bugs involving @ISA have been fixed. C<*ISA = *glob_without_array> and | |
2141 | C<undef *ISA; @{*ISA}> would prevent future modifications to @ISA from | |
2142 | updating the internal caches used to look up methods. The | |
2143 | *glob_without_array case was a regression from Perl 5.12. | |
2144 | ||
2145 | =item * | |
2146 | ||
2147 | Regular expression optimisations sometimes caused C<$> with C</m> to | |
2148 | produce failed or incorrect matches [perl #114068]. | |
2149 | ||
2150 | =item * | |
2151 | ||
2152 | C<__SUB__> now works in a C<sort> block when the enclosing subroutine is | |
2153 | predeclared with C<sub foo;> syntax [perl #113710]. | |
2154 | ||
2155 | =item * | |
2156 | ||
2157 | Unicode properties only apply to Unicode code points, which leads to | |
2158 | some subtleties when regular expressions are matched against | |
2159 | above-Unicode code points. There is a warning generated to draw your | |
2160 | attention to this. However, this warning was being generated | |
2161 | inappropriately in some cases, such as when a program was being parsed. | |
2162 | Non-Unicode matches such as C<\w> and C<[:word;]> should not generate the | |
2163 | warning, as their definitions don't limit them to apply to only Unicode | |
2164 | code points. Now the message is only generated when matching against | |
2165 | C<\p{}> and C<\P{}>. There remains a bug, [perl #114148], for the very | |
2166 | few properties in Unicode that match just a single code point. The | |
2167 | warning is not generated if they are matched against an above-Unicode | |
2168 | code point. | |
2169 | ||
e5ba1bf1 FC |
2170 | =back |
2171 | ||
0bba4573 | 2172 | =head1 Known Problems |
e5ba1bf1 | 2173 | |
0bba4573 RS |
2174 | XXX Descriptions of platform agnostic bugs we know we can't fix go here. Any |
2175 | tests that had to be C<TODO>ed for the release would be noted here. Unfixed | |
2176 | platform specific bugs also go here. | |
2177 | ||
2178 | [ List each fix as a =item entry ] | |
2179 | ||
2180 | =over 4 | |
2181 | ||
2182 | =item * | |
2183 | ||
2184 | XXX | |
2185 | ||
2186 | =back | |
e5ba1bf1 FC |
2187 | |
2188 | =head1 Acknowledgements | |
2189 | ||
2190 | XXX Generate this with: | |
2191 | ||
de3d8d88 | 2192 | perl Porting/acknowledgements.pl v5.17.12..HEAD |
e5ba1bf1 FC |
2193 | |
2194 | =head1 Reporting Bugs | |
2195 | ||
2196 | If you find what you think is a bug, you might check the articles recently | |
2197 | posted to the comp.lang.perl.misc newsgroup and the perl bug database at | |
2198 | http://rt.perl.org/perlbug/ . There may also be information at | |
2199 | http://www.perl.org/ , the Perl Home Page. | |
2200 | ||
2201 | If you believe you have an unreported bug, please run the L<perlbug> program | |
2202 | included with your release. Be sure to trim your bug down to a tiny but | |
2203 | sufficient test case. Your bug report, along with the output of C<perl -V>, | |
2204 | will be sent off to perlbug@perl.org to be analysed by the Perl porting team. | |
2205 | ||
2206 | If the bug you are reporting has security implications, which make it | |
2207 | inappropriate to send to a publicly archived mailing list, then please send it | |
2208 | to perl5-security-report@perl.org. This points to a closed subscription | |
2209 | unarchived mailing list, which includes all the core committers, who will be | |
2210 | able to help assess the impact of issues, figure out a resolution, and help | |
2211 | co-ordinate the release of patches to mitigate or fix the problem across all | |
2212 | platforms on which Perl is supported. Please only use this address for | |
2213 | security issues in the Perl core, not for modules independently distributed on | |
2214 | CPAN. | |
2215 | ||
2216 | =head1 SEE ALSO | |
2217 | ||
2218 | The F<Changes> file for an explanation of how to view exhaustive details on | |
2219 | what changed. | |
2220 | ||
2221 | The F<INSTALL> file for how to build Perl. | |
2222 | ||
2223 | The F<README> file for general stuff. | |
2224 | ||
2225 | The F<Artistic> and F<Copying> files for copyright information. | |
2226 | ||
2227 | =cut |