Commit | Line | Data |
---|---|---|
30682cc3 RS |
1 | =encoding utf8 |
2 | ||
3 | =head1 NAME | |
4 | ||
92221470 | 5 | perl5160delta - what is new for perl v5.16.0 |
30682cc3 RS |
6 | |
7 | =head1 DESCRIPTION | |
8 | ||
9 | This document describes differences between the 5.14.0 release and | |
10 | the 5.16.0 release. | |
11 | ||
12 | If you are upgrading from an earlier release such as 5.12.0, first read | |
13 | L<perl5140delta>, which describes differences between 5.12.0 and | |
14 | 5.14.0. | |
15 | ||
16 | =head1 Notice | |
17 | ||
18 | XXX Any important notices here | |
19 | ||
20 | =head1 Core Enhancements | |
21 | ||
412912b6 RS |
22 | =head2 C<use I<VERSION>> |
23 | ||
24 | As of this release, version declarations like C<use v5.16> now disable | |
25 | all features before enabling the new feature bundle. This means that | |
26 | the following holds true: | |
27 | ||
28 | use 5.016; | |
a4574d2e | 29 | # only 5.16 features enabled here |
412912b6 | 30 | use 5.014; |
a4574d2e | 31 | # only 5.14 features enabled here (not 5.16) |
412912b6 RS |
32 | |
33 | C<use v5.12> and higher continue to enable strict, but explicit C<use | |
34 | strict> and C<no strict> now override the version declaration, even | |
35 | when they come first: | |
36 | ||
37 | no strict; | |
38 | use 5.012; | |
39 | # no strict here | |
40 | ||
41 | There is a new ":default" feature bundle that represents the set of | |
42 | features enabled before any version declaration or C<use feature> has | |
43 | been seen. Version declarations below 5.10 now enable the ":default" | |
44 | feature set. This does not actually change the behaviour of C<use | |
45 | v5.8>, because features added to the ":default" set are those that were | |
46 | traditionally enabled by default, before they could be turned off. | |
47 | ||
48 | C<$[> is now disabled under C<use v5.16>. It is part of the default | |
49 | feature set and can be turned on or off explicitly with C<use feature | |
50 | 'array_base'>. | |
51 | ||
a4574d2e RS |
52 | =head2 C<__SUB__> |
53 | ||
54 | The new C<__SUB__> token, available under the C<current_sub> feature | |
021c503d | 55 | (see L<feature>) or C<use v5.16>, returns a reference to the current |
a4574d2e | 56 | subroutine, making it easier to write recursive closures. |
412912b6 | 57 | |
a4574d2e | 58 | =head2 New and Improved Built-ins |
412912b6 | 59 | |
a4574d2e RS |
60 | =head3 More consistent C<eval> |
61 | ||
62 | The C<eval> operator sometimes treats a string argument as a sequence of | |
63 | characters and sometimes as a sequence of bytes, depending on the | |
64 | internal encoding. The internal encoding is not supposed to make any | |
65 | difference, but there is code that relies on this inconsistency. | |
66 | ||
67 | The new C<unicode_eval> and C<evalbytes> features (enabled under C<use | |
68 | 5.16.0> resolve this. The C<unicode_eval> feature causes C<eval | |
69 | $string> to treat the string always as Unicode. The C<evalbytes> | |
70 | features provides a function, itself called C<evalbytes>, which | |
71 | evaluates its argument always as a string of bytes. | |
72 | ||
73 | These features also fix oddities with source filters leaking to outer | |
74 | dynamic scopes. | |
75 | ||
76 | See L<feature> for more detail. | |
77 | ||
78 | =head3 C<substr> lvalue revamp | |
79 | ||
80 | =for comment Can this be compacted some? -- rjbs, 2012-02-20 | |
412912b6 RS |
81 | |
82 | When C<substr> is called in lvalue or potential lvalue context with two | |
83 | or three arguments, a special lvalue scalar is returned that modifies | |
84 | the original string (the first argument) when assigned to. | |
85 | ||
86 | Previously, the offsets (the second and third arguments) passed to | |
87 | C<substr> would be converted immediately to match the string, negative | |
88 | offsets being translated to positive and offsets beyond the end of the | |
89 | string being truncated. | |
90 | ||
91 | Now, the offsets are recorded without modification in the special | |
92 | lvalue scalar that is returned, and the original string is not even | |
93 | looked at by C<substr> itself, but only when the returned lvalue is | |
94 | read or modified. | |
95 | ||
96 | These changes result in several incompatible changes and bug fixes: | |
97 | ||
98 | =over | |
99 | ||
100 | =item * | |
101 | ||
102 | If the original string changes length after the call to C<substr> but | |
103 | before assignment to its return value, negative offsets will remember | |
104 | their position from the end of the string, affecting code like this: | |
105 | ||
106 | my $string = "string"; | |
107 | my $lvalue = \substr $string, -4, 2; | |
108 | print $lvalue, "\n"; # prints "ri" | |
109 | $string = "bailing twine"; | |
110 | print $lvalue, "\n"; # prints "wi"; used to print "il" | |
111 | ||
112 | The same thing happens with an omitted third argument. The returned | |
113 | lvalue will always extend to the end of the string, even if the string | |
114 | becomes longer. | |
115 | ||
116 | =item * | |
117 | ||
118 | Tied (and otherwise magical) variables are no longer exempt from the | |
119 | "Attempt to use reference as lvalue in substr" warning. | |
120 | ||
121 | =item * | |
122 | ||
123 | That warning now occurs when the returned lvalue is assigned to, not | |
124 | when C<substr> itself is called. This only makes a difference if the | |
125 | return value of C<substr> is referenced and assigned to later. | |
126 | ||
127 | =item * | |
128 | ||
129 | The order in which "uninitialized" warnings occur for arguments to | |
130 | C<substr> has changed. | |
131 | ||
132 | =item * | |
133 | ||
134 | Passing a substring of a read-only value or a typeglob to a function | |
135 | (potential lvalue context) no longer causes an immediate "Can't coerce" | |
136 | or "Modification of a read-only value" error. That error only occurs | |
137 | if and when the value passed is assigned to. | |
138 | ||
139 | The same thing happens with the "substr outside of string" error. If | |
140 | the lvalue is only read, not written to, it is now just a warning, as | |
141 | with rvalue C<substr>. | |
142 | ||
143 | =item * | |
144 | ||
145 | C<substr> assignments no longer call FETCH twice if the first argument | |
146 | is a tied variable, just once. | |
147 | ||
148 | =back | |
149 | ||
150 | It was impossible to fix all the bugs without an incompatible change, | |
151 | and the behaviour of negative offsets was never specified, so the | |
152 | change was deemed acceptable. | |
153 | ||
a4574d2e | 154 | =head3 Return value of C<tied> |
412912b6 RS |
155 | |
156 | The value returned by C<tied> on a tied variable is now the actual | |
157 | scalar that holds the object to which the variable is tied. This | |
158 | allows ties to be weakened with C<Scalar::Util::weaken(tied | |
159 | $tied_variable)>. | |
160 | ||
a4574d2e | 161 | =head2 Unicode Support |
412912b6 | 162 | |
a4574d2e | 163 | =head3 C<use charnames> is no longer needed for C<\N{I<name>}> |
12477442 | 164 | |
a4574d2e RS |
165 | When C<\N{I<name>}> is encountered, the C<charnames> module is now |
166 | automatically loaded when needed as if the C<:full> and C<:short> | |
167 | options had been specified. See L<charnames> for more information. | |
12477442 | 168 | |
021c503d RS |
169 | =head3 C<\N{...}> can now have Unicode loose name matching |
170 | ||
171 | This is described in the C<charnames> item in | |
172 | L</Updated Modules and Pragmata> below. | |
173 | ||
a4574d2e | 174 | =head3 Unicode Symbol Names |
12477442 RS |
175 | |
176 | Perl now has proper support for Unicode in symbol names. It used to be | |
177 | that C<*{$foo}> would ignore the internal UTF8 flag and use the bytes of | |
178 | the underlying representation to look up the symbol. That meant that | |
179 | C<*{"\x{100}"}> and C<*{"\xc4\x80"}> would return the same thing. All | |
180 | these parts of Perl have been fixed to account for Unicode: | |
181 | ||
182 | =over | |
183 | ||
184 | =item * | |
185 | ||
186 | Method names (including those passed to C<use overload>) | |
187 | ||
188 | =item * | |
189 | ||
190 | Typeglob names (including names of variables, subroutines and filehandles) | |
191 | ||
192 | =item * | |
193 | ||
194 | Package names | |
195 | ||
196 | =item * | |
197 | ||
198 | Constant subroutine names (not null-clean yet) | |
199 | ||
200 | =item * | |
201 | ||
202 | C<goto> | |
203 | ||
204 | =item * | |
205 | ||
206 | Symbolic dereferencing | |
207 | ||
208 | =item * | |
209 | ||
210 | Second argument to C<bless()> and C<tie()> | |
211 | ||
212 | =item * | |
213 | ||
214 | Return value of C<ref()> | |
215 | ||
216 | =item * | |
217 | ||
218 | Package names returned by C<caller()> | |
219 | ||
220 | =item * | |
221 | ||
222 | Subroutine prototypes | |
223 | ||
224 | =item * | |
225 | ||
226 | Attributes | |
227 | ||
a4574d2e RS |
228 | =item * |
229 | ||
230 | Various warnings and error messages that mention variable names or values, | |
231 | methods, etc. | |
232 | ||
233 | =back | |
234 | ||
235 | In addition, a parsing bug has been fixed that prevented C<*{é}> from | |
236 | implicitly quoting the name, but instead interpreted it as C<*{+é}>, which | |
237 | would cause a strict violation. | |
238 | ||
239 | C<*{"*a::b"}> automatically strips off the * if it is followed by an ASCII | |
240 | letter. That has been extended to all Unicode identifier characters. | |
241 | ||
242 | C<$é> is now subject to "Used only once" warnings. It used to be exempt, | |
243 | as it was treated as a punctuation variable. | |
244 | ||
245 | Also, single-character Unicode punctuation variables (like $‰) are now | |
246 | supported [perl #69032]. They are also supported with C<our> and C<my>, | |
247 | but that is a mistake that will be fixed before 5.16. | |
248 | ||
249 | =head2 The Unicode C<Script_Extensions> property is now supported. | |
250 | ||
251 | New in Unicode 6.0, this is an improved C<Script> property. Details | |
252 | are in L<perlunicode/Scripts>. | |
253 | ||
a4574d2e RS |
254 | =head2 XS Changes |
255 | ||
021c503d | 256 | =head3 Improved typemaps for Some Builtin Types |
a4574d2e RS |
257 | |
258 | Most XS authors will be aware that there is a longstanding bug in the | |
259 | OUTPUT typemap for T_AVREF (C<AV*>), T_HVREF (C<HV*>), T_CVREF (C<CV*>), | |
260 | and T_SVREF (C<SVREF> or C<\$foo>) that requires manually decrementing | |
261 | the reference count of the return value instead of the typemap taking | |
262 | care of this. For backwards-compatibility, this cannot be changed in the | |
263 | default typemaps. But we now provide additional typemaps | |
264 | C<T_AVREF_REFCOUNT_FIXED>, etc. that do not exhibit this bug. Using | |
265 | them in your extension is as simple as having one line in your | |
266 | C<TYPEMAP> section: | |
267 | ||
268 | HV* T_HVREF_REFCOUNT_FIXED | |
269 | ||
270 | =head3 C<is_utf8_char()> | |
271 | ||
272 | The XS-callable function C<is_utf8_char()>, when presented with | |
273 | malformed UTF-8 input, can read up to 12 bytes beyond the end of the | |
274 | string. This cannot be fixed without changing its API. It is not | |
275 | called from CPAN. The documentation now describes how to use it | |
276 | safely. | |
277 | ||
278 | =head3 Other C<is_utf8_foo()> functions, as well as C<utf8_to_foo()>, etc. | |
279 | ||
280 | Most of the other XS-callable functions that take UTF-8 encoded input | |
281 | implicitly assume that the UTF-8 is valid (not malformed) in regards to | |
282 | buffer length. Do not do things such as change a character's case or | |
283 | see if it is alphanumeric without first being sure that it is valid | |
284 | UTF-8. This can be safely done for a whole string by using one of the | |
285 | functions C<is_utf8_string()>, C<is_utf8_string_loc()>, and | |
286 | C<is_utf8_string_loclen()>. | |
287 | ||
021c503d RS |
288 | =head3 New Pad API |
289 | ||
290 | Many new functions have been added to the API for manipulating lexical | |
291 | pads. See L<perlapi/Pad Data Structures> for more information. | |
292 | ||
a4574d2e RS |
293 | =head2 Changes to Special Variables |
294 | ||
021c503d RS |
295 | =head3 C<$$> can be assigned to |
296 | ||
297 | C<$$> was made read-only in Perl 5.8.0. But only sometimes: C<local $$> | |
298 | would make it writable again. Some CPAN modules were using C<local $$> or | |
299 | XS code to bypass the read-only check, so there is no reason to keep C<$$> | |
300 | read-only. (This change also allowed a bug to be fixed while maintaining | |
301 | backward compatibility.) | |
302 | ||
303 | =head3 C<$^X> converted to an absolute path on FreeBSD, OS X and Solaris | |
304 | ||
305 | C<$^X> is now converted to an absolute path on OS X, FreeBSD (without | |
306 | needing F</proc> mounted) and Solaris 10 and 11. This augments the | |
307 | previous approach of using F</proc> on Linux, FreeBSD and NetBSD | |
308 | (in all cases, where mounted). | |
309 | ||
310 | This makes relocatable perl installations more useful on these platforms. | |
311 | (See "Relocatable @INC" in F<INSTALL>) | |
a4574d2e RS |
312 | |
313 | =head2 Debugger Changes | |
314 | ||
315 | =head3 Features inside the debugger | |
316 | ||
317 | The current Perl's L<feature> bundle is now enabled for commands entered | |
318 | in the interactive debugger. | |
319 | ||
320 | =head3 New option for the debugger's B<t> command | |
321 | ||
322 | The B<t> command in the debugger, which toggles tracing mode, now | |
323 | accepts a numeric argument that determines how many levels of subroutine | |
324 | calls to trace. | |
325 | ||
326 | =head3 C<enable> and C<disable> | |
327 | ||
328 | The debugger now has C<disable> and C<enable> commands for disabling | |
329 | existing breakpoints and reënabling them. See L<perldebug>. | |
330 | ||
331 | =head3 Breakpoints with file names | |
332 | ||
333 | The debugger's "b" command for setting breakpoints now allows a line | |
334 | number to be prefixed with a file name. See | |
335 | L<perldebug/"b [file]:[line] [condition]">. | |
336 | ||
337 | =head2 The C<CORE> Namespace | |
338 | ||
339 | =for comment This needs to be rewritten for 5.16 -- rjbs, 2012-02-20 | |
340 | ||
341 | The C<CORE::> prefix can now be used on keywords enabled by | |
342 | L<feature.pm|feature>, even outside the scope of C<use feature>. Relevant | |
343 | documentation files L<CORE>, L<feature>, L<perlfunc>, L<perlsub>, and | |
344 | L<perlsyn> have been updated. | |
345 | ||
346 | Perl 5.15.2 introduced subroutines in the CORE namespace. Most of them | |
347 | could only be called as barewords; i.e., they could be aliased at compile | |
348 | time and then inlined under new names. | |
349 | ||
350 | Almost all of these functions can now be called through references and via | |
351 | C<&foo()> syntax, bypassing the prototype. See L<CORE> for a list of the | |
352 | exceptions. | |
353 | ||
354 | =head2 Other Changes | |
355 | ||
021c503d RS |
356 | =head3 Anonymous handles |
357 | ||
358 | Automatically generated file handles are now named __ANONIO__ when the | |
359 | variable name cannot be determined, rather than $__ANONIO__. | |
360 | ||
361 | =head3 Autoloaded sort Subroutines | |
362 | ||
363 | Custom sort subroutines can now be autoloaded [perl #30661]: | |
364 | ||
365 | sub AUTOLOAD { ... } | |
366 | @sorted = sort foo @list; # uses AUTOLOAD | |
367 | ||
368 | =head3 C<continue> no longer requires the "switch" feature | |
369 | ||
370 | The C<continue> keyword has two meanings. It can introduce a C<continue> | |
371 | block after a loop, or it can exit the current C<when> block. Up till now, | |
372 | the latter meaning was only valid with the "switch" feature enabled, and | |
373 | was a syntax error otherwise. Since the main purpose of feature.pm is to | |
374 | avoid conflicts with user-defined subroutines, there is no reason for | |
375 | C<continue> to depend on it. | |
376 | ||
377 | =head3 The C<\$> prototype accepts any scalar lvalue | |
378 | ||
379 | The C<\$> and C<\[$]> subroutine prototypes now accept any scalar lvalue | |
380 | argument. Previously they only accepted scalars beginning with C<$> and | |
381 | hash and array elements. This change makes them consistent with the way | |
382 | the built-in C<read> and C<recv> functions (among others) parse their | |
383 | arguments. This means that one can override the built-in functions with | |
384 | custom subroutines that parse their arguments the same way. | |
385 | ||
386 | =head3 DTrace probes for interpreter phase change | |
387 | ||
388 | The C<phase-change> probes will fire when the interpreter's phase | |
389 | changes, which tracks the C<${^GLOBAL_PHASE}> variable. C<arg0> is | |
390 | the new phase name; C<arg1> is the old one. This is useful mostly | |
391 | for limiting your instrumentation to one or more of: compile time, | |
392 | run time, destruct time. | |
393 | ||
394 | =head3 C<__FILE__()> Syntax | |
395 | ||
396 | The C<__FILE__>, C<__LINE__> and C<__PACKAGE__> tokens can now be written | |
397 | with an empty pair of parentheses after them. This makes them parse the | |
398 | same way as C<time>, C<fork> and other built-in functions. | |
a4574d2e RS |
399 | |
400 | =head1 Security | |
401 | ||
402 | =head2 C<File::Glob::bsd_glob()> memory error with GLOB_ALTDIRFUNC (CVE-2011-2728). | |
403 | ||
404 | Calling C<File::Glob::bsd_glob> with the unsupported flag | |
405 | GLOB_ALTDIRFUNC would cause an access violation / segfault. A Perl | |
406 | program that accepts a flags value from an external source could expose | |
407 | itself to denial of service or arbitrary code execution attacks. There | |
408 | are no known exploits in the wild. The problem has been corrected by | |
409 | explicitly disabling all unsupported flags and setting unused function | |
410 | pointers to null. Bug reported by Clément Lecigne. | |
411 | ||
412 | =head2 Privileges are now set correctly when assigning to C<$(> | |
413 | ||
414 | A hypothetical bug (probably non-exploitable in practice) due to the | |
415 | incorrect setting of the effective group ID while setting C<$(> has been | |
416 | fixed. The bug would only have affected systems that have C<setresgid()> | |
417 | but not C<setregid()>, but no such systems are known of. | |
418 | ||
419 | =head1 Deprecations | |
420 | ||
421 | =head2 Don't read the Unicode data base files in F<lib/unicore> | |
422 | ||
423 | It is now deprecated to directly read the Unicode data base files. | |
424 | These are stored in the F<lib/unicore> directory. Instead, you should | |
425 | use the new functions in L<Unicode::UCD>. These provide a stable API, | |
021c503d | 426 | and give complete information. |
a4574d2e RS |
427 | |
428 | Perl may at some point in the future change or remove the files. The | |
429 | file most likely for applications to have used is | |
430 | F<lib/unicore/ToDigit.pl>. L<Unicode::UCD/prop_invmap()> can be used to | |
431 | get at its data instead. | |
432 | ||
433 | =head1 Future Deprecations | |
434 | ||
435 | This section serves as a notice of feature that are I<likely> to be | |
021c503d RS |
436 | removed or L<deprecated|perlpolicy/deprecated> in the next release of |
437 | perl (5.18.0). If your code depends on these features, you should | |
438 | contact the Perl 5 Porters via the L<mailing | |
a4574d2e RS |
439 | list|http://lists.perl.org/list/perl5-porters.html> or L<perlbug> to |
440 | explain your use case and inform the deprecation process. | |
441 | ||
442 | =head2 Core Modules | |
443 | ||
444 | These modules may be marked as deprecated I<from the core>. This only | |
445 | means that they will no longer be installed by default with the core | |
446 | distribution, but will remain available on the CPAN. | |
447 | ||
448 | =over | |
449 | ||
021c503d | 450 | =item * |
a4574d2e | 451 | |
021c503d | 452 | CPANPLUS |
a4574d2e | 453 | |
021c503d | 454 | =item * |
a4574d2e | 455 | |
021c503d | 456 | Filter::Simple |
a4574d2e | 457 | |
021c503d | 458 | =item * |
a4574d2e | 459 | |
021c503d | 460 | PerlIO::mmap |
a4574d2e | 461 | |
021c503d | 462 | =item * |
a4574d2e | 463 | |
021c503d | 464 | Pod::Parser, Pod::LaTeX |
a4574d2e | 465 | |
021c503d | 466 | =item * |
a4574d2e | 467 | |
021c503d | 468 | SelfLoader |
a4574d2e | 469 | |
021c503d | 470 | =item * |
a4574d2e | 471 | |
021c503d | 472 | Text::Soundex |
a4574d2e | 473 | |
021c503d | 474 | =item * |
a4574d2e | 475 | |
021c503d | 476 | Thread.pm |
a4574d2e RS |
477 | |
478 | =back | |
479 | ||
021c503d | 480 | =head2 Platforms with no supporting programmers: |
12477442 | 481 | |
021c503d RS |
482 | The platforms will probably have their special build support removed during the |
483 | 5.17.0 development series. | |
12477442 RS |
484 | |
485 | =over | |
486 | ||
487 | =item * | |
488 | ||
021c503d | 489 | BeOS |
12477442 RS |
490 | |
491 | =item * | |
492 | ||
021c503d | 493 | djgpp |
12477442 RS |
494 | |
495 | =item * | |
496 | ||
021c503d | 497 | dgux |
12477442 RS |
498 | |
499 | =item * | |
500 | ||
021c503d | 501 | EPOC |
12477442 RS |
502 | |
503 | =item * | |
504 | ||
021c503d | 505 | MPE/iX |
12477442 RS |
506 | |
507 | =item * | |
508 | ||
021c503d | 509 | Rhapsody |
12477442 RS |
510 | |
511 | =item * | |
512 | ||
021c503d | 513 | UTS |
12477442 RS |
514 | |
515 | =item * | |
516 | ||
021c503d | 517 | VM/ESA |
12477442 RS |
518 | |
519 | =back | |
520 | ||
021c503d | 521 | =head2 Other Future Deprecations |
a14d7d4a | 522 | |
021c503d | 523 | =over |
ccad93fd | 524 | |
021c503d | 525 | =item * |
ccad93fd | 526 | |
021c503d | 527 | Swapping of $< and $> |
ccad93fd | 528 | |
021c503d | 529 | https://rt.perl.org/rt3/Ticket/Display.html?id=96212 |
ccad93fd | 530 | |
021c503d | 531 | =item * |
ccad93fd | 532 | |
021c503d | 533 | sfio, stdio |
ccad93fd | 534 | |
021c503d | 535 | =back |
30682cc3 | 536 | |
021c503d | 537 | =head1 Incompatible Changes |
94c11dd4 | 538 | |
021c503d | 539 | =head2 Borland compiler |
94c11dd4 | 540 | |
021c503d RS |
541 | All support for the Borland compiler has been dropped. The code had not |
542 | worked for a long time anyway. | |
30682cc3 | 543 | |
b325a3a2 RS |
544 | =head2 Certain deprecated Unicode properties are no longer supported by default |
545 | ||
546 | Perl should never have exposed certain Unicode properties that are used | |
547 | by Unicode internally and not meant to be publicly available. Use of | |
548 | these has generated deprecated warning messages since Perl 5.12. The | |
549 | removed properties are Other_Alphabetic, | |
550 | Other_Default_Ignorable_Code_Point, Other_Grapheme_Extend, | |
551 | Other_ID_Continue, Other_ID_Start, Other_Lowercase, Other_Math, and | |
552 | Other_Uppercase. | |
553 | ||
554 | Perl may be recompiled to include any or all of them; instructions are | |
555 | given in | |
556 | L<perluniprops/Unicode character properties that are NOT accepted by Perl>. | |
557 | ||
558 | =head2 Dereferencing IO thingies as typeglobs | |
559 | ||
560 | The C<*{...}> operator, when passed a reference to an IO thingy (as in | |
561 | C<*{*STDIN{IO}}>), creates a new typeglob containing just that IO object. | |
562 | ||
563 | Previously, it would stringify as an empty string, but some operators would | |
564 | treat it as undefined, producing an "uninitialized" warning. | |
565 | ||
566 | Having a typeglob appear as an empty string is a side effect of the | |
567 | implementation that has caused various bugs over the years. | |
568 | ||
569 | The solution was to make it stringify like a normal anonymous typeglob, | |
570 | like those produced by C<< open($foo->{bar}, ...) >> [perl #96326]. | |
571 | ||
4bbade93 RS |
572 | =head2 User-defined case changing operations. |
573 | ||
574 | This feature was deprecated in Perl 5.14, and has now been removed. | |
575 | The CPAN module L<Unicode::Casing> provides better functionality without | |
576 | the drawbacks that this feature had, as are detailed in the 5.14 | |
577 | documentation: | |
578 | L<http://perldoc.perl.org/5.14.0/perlunicode.html#User-Defined-Case-Mappings-%28for-serious-hackers-only%29> | |
579 | ||
580 | =head2 XSUBs are now 'static' | |
581 | ||
582 | XSUB C functions are now 'static', that is, they are not visible from | |
583 | outside the compilation unit. Users can use the new C<XS_EXTERNAL(name)> | |
584 | and C<XS_INTERNAL(name)> macros to pick the desired linking behaviour. | |
585 | The ordinary C<XS(name)> declaration for XSUBs will continue to declare | |
586 | non-'static' XSUBs for compatibility, but the XS compiler, | |
587 | C<ExtUtils::ParseXS> (C<xsubpp>) will emit 'static' XSUBs by default. | |
588 | C<ExtUtils::ParseXS>'s behaviour can be reconfigured from XS using the | |
589 | C<EXPORT_XSUB_SYMBOLS> keyword, see L<perlxs> for details. | |
590 | ||
4bbade93 RS |
591 | =head2 Weakening read-only references |
592 | ||
593 | Weakening read-only references is no longer permitted. It should never | |
594 | hove worked anyway, and in some cases could result in crashes. | |
595 | ||
a14d7d4a RS |
596 | =head2 Tying scalars that hold typeglobs |
597 | ||
598 | Attempting to tie a scalar after a typeglob was assigned to it would | |
599 | instead tie the handle in the typeglob's IO slot. This meant that it was | |
600 | impossible to tie the scalar itself. Similar problems affected C<tied> and | |
601 | C<untie>: C<tied $scalar> would return false on a tied scalar if the last | |
602 | thing returned was a typeglob, and C<untie $scalar> on such a tied scalar | |
603 | would do nothing. | |
30682cc3 | 604 | |
a14d7d4a RS |
605 | We fixed this problem before Perl 5.14.0, but it caused problems with some |
606 | CPAN modules, so we put in a deprecation cycle instead. | |
30682cc3 | 607 | |
a14d7d4a RS |
608 | Now the deprecation has been removed and this bug has been fixed. So |
609 | C<tie $scalar> will always tie the scalar, not the handle it holds. To tie | |
610 | the handle, use C<tie *$scalar> (with an explicit asterisk). The same | |
611 | applies to C<tied *$scalar> and C<untie *$scalar>. | |
612 | ||
613 | =head2 IPC::Open3 no longer provides C<xfork()>, C<xclose_on_exec()> | |
614 | and C<xpipe_anon()> | |
615 | ||
616 | All three functions were private, undocumented and unexported. They do | |
617 | not appear to be used by any code on CPAN. Two have been inlined and one | |
618 | deleted entirely. | |
619 | ||
620 | =head2 C<$$> no longer caches PID | |
621 | ||
622 | Previously, if one embeds Perl or uses XS and calls fork(3) from C, Perls | |
623 | notion of C<$$> could go out of sync with what getpid() returns. By always | |
624 | fetching the value of C<$$> via getpid(), this potential bug is eliminated. | |
625 | Code that depends on the caching behavior will break. As described in | |
626 | L</Core Enhancements>, C<$$> is now writable, but it will be reset during a | |
627 | fork. | |
30682cc3 | 628 | |
a4574d2e | 629 | =head1 Performance Enhancements |
6c3c09b8 RS |
630 | |
631 | =over | |
632 | ||
a4574d2e | 633 | =item * |
6c3c09b8 | 634 | |
a4574d2e | 635 | Improved performance for Unicode properties in regular expressions |
6c3c09b8 | 636 | |
a4574d2e | 637 | =for comment Can this be compacted some? -- rjbs, 2012-02-20 |
6c3c09b8 | 638 | |
a4574d2e RS |
639 | Matching a code point against a Unicode property is now done via a |
640 | binary search instead of linear. This means for example that the worst | |
641 | case for a 1000 item property is 10 probes instead of 1000. This | |
642 | inefficiency has been compensated for in the past by permanently storing | |
643 | in a hash the results of a given probe plus the results for the adjacent | |
644 | 64 code points, under the theory that near-by code points are likely to | |
645 | be searched for. A separate hash was used for each mention of a Unicode | |
646 | property in each regular expression. Thus, C<qr/\p{foo}abc\p{foo}/> | |
647 | would generate two hashes. Any probes in one instance would be unknown | |
648 | to the other, and the hashes could expand separately to be quite large | |
649 | if the regular expression were used on many different widely-separated | |
650 | code points. This can lead to running out of memory in extreme cases. | |
651 | Now, however, there is just one hash shared by all instances of a given | |
652 | property. This means that if C<\p{foo}> is matched against "A" in one | |
653 | regular expression in a thread, the result will be known immediately to | |
654 | all regular expressions, and the relentless march of using up memory is | |
655 | slowed considerably. | |
6c3c09b8 | 656 | |
a4574d2e | 657 | =item * |
6c3c09b8 | 658 | |
a4574d2e RS |
659 | Version declarations with the C<use> keyword (e.g., C<use 5.012>) are now |
660 | faster, as they enable features without loading F<feature.pm>. | |
6c3c09b8 | 661 | |
a4574d2e | 662 | =item * |
6c3c09b8 | 663 | |
a4574d2e RS |
664 | C<local $_> is faster now, as it no longer iterates through magic that it |
665 | is not going to copy anyway. | |
6c3c09b8 | 666 | |
a4574d2e | 667 | =item * |
6c3c09b8 | 668 | |
a4574d2e RS |
669 | Perl 5.12.0 sped up the destruction of objects whose classes define |
670 | empty C<DESTROY> methods (to prevent autoloading), by simply not | |
671 | calling such empty methods. This release takes this optimisation a | |
672 | step further, by not calling any C<DESTROY> method that begins with a | |
673 | C<return> statement. This can be useful for destructors that are only | |
674 | used for debugging: | |
6c3c09b8 | 675 | |
a4574d2e RS |
676 | use constant DEBUG => 1; |
677 | sub DESTROY { return unless DEBUG; ... } | |
6c3c09b8 | 678 | |
a4574d2e RS |
679 | Constant-folding will reduce the first statement to C<return;> if DEBUG |
680 | is set to 0, triggering this optimisation. | |
6c3c09b8 | 681 | |
a4574d2e | 682 | =item * |
6c3c09b8 | 683 | |
a4574d2e RS |
684 | Assigning to a variable that holds a typeglob or copy-on-write scalar |
685 | is now much faster. Previously the typeglob would be stringified or | |
686 | the copy-on-write scalar would be copied before being clobbered. | |
6c3c09b8 | 687 | |
a4574d2e | 688 | =item * |
6c3c09b8 | 689 | |
a4574d2e RS |
690 | Assignment to C<substr> in void context is now more than twice its |
691 | previous speed. Instead of creating and returning a special lvalue | |
692 | scalar that is then assigned to, C<substr> modifies the original string | |
693 | itself. | |
6c3c09b8 | 694 | |
a4574d2e | 695 | =item * |
6c3c09b8 | 696 | |
a4574d2e RS |
697 | C<substr> no longer calculates a value to return when called in void |
698 | context. | |
6c3c09b8 RS |
699 | |
700 | =back | |
701 | ||
ccad93fd | 702 | =over 4 |
30682cc3 | 703 | |
ccad93fd | 704 | =item * |
30682cc3 | 705 | |
a4574d2e RS |
706 | Due to changes in L<File::Glob>, Perl's C<glob> function and its C<< |
707 | <...> >> equivalent are now much faster. The splitting of the pattern | |
708 | into words has been rewritten in C, resulting in speed-ups of 20% in | |
709 | some cases. | |
b325a3a2 RS |
710 | |
711 | This does not affect VMS, as it does not use File::Glob. | |
712 | ||
713 | =item * | |
714 | ||
ccad93fd RS |
715 | The short-circuiting operators C<&&>, C<||>, and C<//>, when chained |
716 | (such as C<$a || $b || $c>), are now considerably faster to short-circuit, | |
717 | due to reduced optree traversal. | |
30682cc3 RS |
718 | |
719 | =item * | |
720 | ||
ccad93fd RS |
721 | The implementation of C<s///r> makes one fewer copy of the scalar's value. |
722 | ||
723 | =item * | |
724 | ||
021c503d | 725 | C<study> is now a no-op. |
ccad93fd RS |
726 | |
727 | =item * | |
728 | ||
729 | Recursive calls to lvalue subroutines in lvalue scalar context use less | |
730 | memory. | |
30682cc3 RS |
731 | |
732 | =back | |
733 | ||
734 | =head1 Modules and Pragmata | |
735 | ||
736 | XXX All changes to installed files in F<cpan/>, F<dist/>, F<ext/> and F<lib/> | |
737 | go here. If Module::CoreList is updated, generate an initial draft of the | |
738 | following sections using F<Porting/corelist-perldelta.pl>, which prints stub | |
739 | entries to STDOUT. Results can be pasted in place of the '=head2' entries | |
740 | below. A paragraph summary for important changes should then be added by hand. | |
741 | In an ideal world, dual-life modules would have a F<Changes> file that could be | |
742 | cribbed. | |
743 | ||
744 | [ Within each section, list entries as a =item entry ] | |
745 | ||
cb82babd RS |
746 | =head2 Deprecated Modules |
747 | ||
748 | =over | |
749 | ||
750 | =item L<Version::Requirements> | |
751 | ||
752 | Version::Requirements is now DEPRECATED, use CPAN::Meta::Requirements, | |
753 | which is a drop-in replacement. It will be deleted from perl.git blead | |
754 | in v5.17.0. | |
755 | ||
756 | =back | |
757 | ||
30682cc3 RS |
758 | =head2 New Modules and Pragmata |
759 | ||
760 | =over 4 | |
761 | ||
762 | =item * | |
763 | ||
b325a3a2 | 764 | L<arybase> -- this new module implements the C<$[> variable. |
30682cc3 RS |
765 | |
766 | =back | |
767 | ||
768 | =head2 Updated Modules and Pragmata | |
769 | ||
770 | =over 4 | |
771 | ||
772 | =item * | |
773 | ||
774 | L<XXX> has been upgraded from version 0.69 to version 0.70. | |
775 | ||
776 | =back | |
777 | ||
778 | =head2 Removed Modules and Pragmata | |
779 | ||
a14d7d4a RS |
780 | As promised in Perl 5.14.0's release notes, the following modules have |
781 | been removed from the core distribution, and if needed should be installed | |
782 | from CPAN instead. | |
783 | ||
784 | =over | |
30682cc3 RS |
785 | |
786 | =item * | |
787 | ||
021c503d RS |
788 | C<Devel::DProf> has been removed from the Perl core. Prior version was |
789 | 20110228.00. | |
a14d7d4a RS |
790 | |
791 | =item * | |
792 | ||
793 | C<Shell> has been removed from the Perl core. Prior version was 0.72_01. | |
30682cc3 RS |
794 | |
795 | =back | |
796 | ||
797 | =head1 Documentation | |
798 | ||
30682cc3 RS |
799 | =head2 New Documentation |
800 | ||
ccad93fd | 801 | =head3 L<perldtrace> |
30682cc3 | 802 | |
ccad93fd RS |
803 | L<perldtrace> describes Perl's DTrace support, listing the provided probes |
804 | and gives examples of their use. | |
30682cc3 | 805 | |
94c11dd4 RS |
806 | =head3 L<perlexperiment> |
807 | ||
808 | This document is intended to provide a list of experimental features in | |
809 | Perl. It is still a work in progress. | |
810 | ||
021c503d RS |
811 | =head3 L<perlootut> |
812 | ||
813 | This a new OO tutorial. It focuses on basic OO concepts, and then recommends | |
814 | that readers choose an OO framework from CPAN. | |
815 | ||
30682cc3 RS |
816 | =head2 Changes to Existing Documentation |
817 | ||
021c503d RS |
818 | =head3 L<perlapi> |
819 | ||
820 | =over 4 | |
821 | ||
822 | =item * | |
823 | ||
824 | The HV API has long accepted negative lengths to indicate that the key is | |
825 | in UTF8. Now this is documented. | |
826 | ||
827 | =item * | |
828 | ||
829 | The C<boolSV()> macro is now documented. | |
830 | ||
831 | =back | |
832 | ||
cb82babd RS |
833 | =head3 L<perlfunc> |
834 | ||
835 | =over 4 | |
836 | ||
837 | =item * | |
838 | ||
839 | C<dbmopen> treats a 0 mode as a special case, that prevents a nonexistent | |
840 | file from being created. This has been the case since Perl 5.000, but was | |
841 | never documented anywhere. Now the perlfunc entry mentions it | |
842 | [perl #90064]. | |
843 | ||
844 | =item * | |
845 | ||
021c503d RS |
846 | As an accident of history, C<open $fh, "<:", ...> applies the default |
847 | layers for the platform (C<:raw> on Unix, C<:crlf> on Windows), ignoring | |
848 | whatever is declared by L<open.pm|open>. This seems such a useful feature | |
849 | it has been documented in L<perlfunc|perlfunc/open> and L<open>. | |
850 | ||
851 | =item * | |
852 | ||
cb82babd RS |
853 | The entry for C<split> has been rewritten. It is now far clearer than |
854 | before. | |
855 | ||
856 | =back | |
857 | ||
021c503d | 858 | =head3 L<perlguts> |
cb82babd RS |
859 | |
860 | =over 4 | |
861 | ||
862 | =item * | |
863 | ||
021c503d RS |
864 | A new section, L<Autoloading with XSUBs|perlguts/Autoloading with XSUBs>, |
865 | has been added, which explains the two APIs for accessing the name of the | |
866 | autoloaded sub. | |
cb82babd RS |
867 | |
868 | =item * | |
869 | ||
021c503d RS |
870 | Some of the function descriptions in L<perlguts> were confusing, as it was |
871 | not clear whether they referred to the function above or below the | |
872 | description. This has been clarified [perl #91790]. | |
cb82babd RS |
873 | |
874 | =back | |
875 | ||
021c503d | 876 | =head3 L<perlobj> |
412912b6 RS |
877 | |
878 | =over 4 | |
879 | ||
880 | =item * | |
881 | ||
021c503d RS |
882 | This document has been rewritten from scratch, and its coverage of various OO |
883 | concepts has been expanded. | |
412912b6 RS |
884 | |
885 | =back | |
886 | ||
021c503d | 887 | =head3 L<perlop> |
12477442 RS |
888 | |
889 | =over 4 | |
890 | ||
891 | =item * | |
892 | ||
021c503d RS |
893 | Documentation of the smartmatch operator has been reworked and moved from |
894 | perlsyn to perlop where it belongs. | |
12477442 | 895 | |
021c503d RS |
896 | It has also been corrected for the case of C<undef> on the left-hand |
897 | side. The list of different smart match behaviours had an item in the | |
898 | wrong place. | |
12477442 RS |
899 | |
900 | =item * | |
901 | ||
021c503d RS |
902 | Documentation of the ellipsis statement (C<...>) has been reworked and |
903 | moved from perlop to perlsyn. | |
12477442 RS |
904 | |
905 | =item * | |
906 | ||
021c503d RS |
907 | The explanation of bitwise operators has been expanded to explain how they |
908 | work on Unicode strings (5.14.1). | |
12477442 RS |
909 | |
910 | =item * | |
911 | ||
021c503d RS |
912 | The section on the triple-dot or yada-yada operator has been moved up, as |
913 | it used to separate two closely related sections about the comma operator | |
914 | (5.14.1). | |
12477442 | 915 | |
021c503d | 916 | =item * |
4bbade93 | 917 | |
021c503d | 918 | More examples for C<m//g> have been added (5.14.1). |
4bbade93 RS |
919 | |
920 | =item * | |
921 | ||
021c503d | 922 | The C<<< <<\FOO >>> here-doc syntax has been documented (5.14.1). |
4bbade93 RS |
923 | |
924 | =back | |
925 | ||
926 | =head3 L<perlpragma> | |
927 | ||
928 | =over 4 | |
929 | ||
930 | =item * | |
931 | ||
932 | There is now a standard convention for naming keys in the C<%^H>, | |
933 | documented under L<Key naming|perlpragma/Key naming>. | |
934 | ||
935 | =back | |
936 | ||
021c503d | 937 | =head3 L<perlsec/Laundering and Detecting Tainted Data> |
30682cc3 | 938 | |
021c503d | 939 | =over 4 |
ccad93fd RS |
940 | |
941 | =item * | |
942 | ||
021c503d RS |
943 | The example function for checking for taintedness contained a subtle |
944 | error. C<$@> needs to be localized to prevent its changing this | |
945 | global's value outside the function. The preferred method to check for | |
946 | this remains L<Scalar::Util/tainted>. | |
ccad93fd RS |
947 | |
948 | =back | |
949 | ||
950 | =head3 L<perllol> | |
951 | ||
952 | =over | |
953 | ||
954 | =item * | |
955 | ||
956 | L<perllol> has been expanded with examples using the new C<push $scalar> | |
957 | syntax introduced in Perl 5.14.0 (5.14.1). | |
958 | ||
959 | =back | |
960 | ||
961 | =head3 L<perlmod> | |
962 | ||
963 | =over | |
964 | ||
965 | =item * | |
966 | ||
967 | L<perlmod> now states explicitly that some types of explicit symbol table | |
968 | manipulation are not supported. This codifies what was effectively already | |
969 | the case [perl #78074]. | |
970 | ||
971 | =back | |
972 | ||
ccad93fd RS |
973 | =head3 L<perlpodstyle> |
974 | ||
975 | =over 4 | |
976 | ||
977 | =item * | |
978 | ||
979 | The tips on which formatting codes to use have been corrected and greatly | |
980 | expanded. | |
981 | ||
982 | =item * | |
983 | ||
984 | There are now a couple of example one-liners for previewing POD files after | |
985 | they have been edited. | |
986 | ||
987 | =back | |
988 | ||
021c503d | 989 | =head3 L<perlre> |
ccad93fd RS |
990 | |
991 | =over | |
992 | ||
993 | =item * | |
994 | ||
021c503d RS |
995 | The C<(*COMMIT)> directive is now listed in the right section |
996 | (L<Verbs without an argument|perlre/Verbs without an argument>). | |
94c11dd4 | 997 | |
ccad93fd RS |
998 | =back |
999 | ||
021c503d | 1000 | =head3 L<perlrun> |
ccad93fd RS |
1001 | |
1002 | =over | |
1003 | ||
1004 | =item * | |
1005 | ||
021c503d RS |
1006 | L<perlrun> has undergone a significant clean-up. Most notably, the |
1007 | B<-0x...> form of the B<-0> flag has been clarified, and the final section | |
1008 | on environment variables has been corrected and expanded (5.14.1). | |
ccad93fd RS |
1009 | |
1010 | =back | |
1011 | ||
021c503d | 1012 | =head3 L<perlsub> |
ccad93fd RS |
1013 | |
1014 | =over | |
1015 | ||
1016 | =item * | |
1017 | ||
021c503d RS |
1018 | The L<perlsub/"Lvalue subroutines"> section has been amended to reflect |
1019 | the many changes present in 5.16.0. | |
1020 | ||
1021 | =item * | |
1022 | ||
1023 | The ($;) prototype syntax, which has existed for rather a long time, is now | |
1024 | documented in L<perlsub>. It allows a unary function to have the same | |
1025 | precedence as a list operator. | |
ccad93fd RS |
1026 | |
1027 | =back | |
1028 | ||
1029 | =head3 L<perltie> | |
1030 | ||
1031 | =over | |
1032 | ||
1033 | =item * | |
1034 | ||
1035 | Documented the required syntax for tying handles. | |
1036 | ||
1037 | =back | |
1038 | ||
1039 | =head3 L<perlvar> | |
1040 | ||
1041 | =over | |
1042 | ||
1043 | =item * | |
1044 | ||
1045 | The documentation for L<$!|perlvar/$!> has been corrected and clarified. | |
1046 | It used to state that $! could be C<undef>, which is not the case. It was | |
1047 | also unclear as to whether system calls set C's C<errno> or Perl's C<$!> | |
1048 | [perl #91614]. | |
1049 | ||
1050 | =item * | |
1051 | ||
1052 | Documentation for L<$$|perlvar/$$> has been amended with additional | |
1053 | cautions regarding changing the process ID. | |
1054 | ||
1055 | =back | |
30682cc3 | 1056 | |
021c503d RS |
1057 | =head3 Other Changes |
1058 | ||
30682cc3 RS |
1059 | =over 4 |
1060 | ||
1061 | =item * | |
1062 | ||
ccad93fd RS |
1063 | L<perlxs> was extended with documentation on inline typemaps. |
1064 | ||
1065 | =item * | |
1066 | ||
1067 | L<perlref> has a new L<Circular References|perlref/Circular References> | |
1068 | section explaining how circularities may not be freed and how to solve that | |
1069 | with weak references. | |
1070 | ||
1071 | =item * | |
1072 | ||
ccad93fd RS |
1073 | Parts of L<perlapi> were clarified, and Perl equivalents of some C |
1074 | functions have been added as an additional mode of exposition. | |
1075 | ||
1076 | =item * | |
1077 | ||
1078 | A few parts of L<perlre> and L<perlrecharclass> were clarified. | |
30682cc3 RS |
1079 | |
1080 | =back | |
1081 | ||
4bbade93 RS |
1082 | =head2 Removed Documentation |
1083 | ||
1084 | =head3 Old OO Documentation | |
1085 | ||
1086 | All the old OO tutorials, perltoot, perltooc, and perlboot, have been | |
a4574d2e RS |
1087 | removed. The perlbot (bag of object tricks) document has been removed |
1088 | as well. | |
4bbade93 RS |
1089 | |
1090 | =head3 Development Deltas | |
1091 | ||
021c503d RS |
1092 | The perldelta files for development releases are no longer packaged with |
1093 | perl. These can still be found in the perl source code repository. | |
4bbade93 | 1094 | |
30682cc3 RS |
1095 | =head1 Diagnostics |
1096 | ||
1097 | The following additions or changes have been made to diagnostic output, | |
1098 | including warnings and fatal error messages. For the complete list of | |
1099 | diagnostic messages, see L<perldiag>. | |
1100 | ||
30682cc3 RS |
1101 | =head2 New Diagnostics |
1102 | ||
30682cc3 RS |
1103 | =head3 New Errors |
1104 | ||
1105 | =over 4 | |
1106 | ||
1107 | =item * | |
1108 | ||
cb82babd RS |
1109 | L<Cannot set tied @DB::args|perldiag/"Cannot set tied @DB::args"> |
1110 | ||
1111 | This error occurs when C<caller> tries to set C<@DB::args> but finds it | |
1112 | tied. Before this error was added, it used to crash instead. | |
1113 | ||
1114 | =item * | |
1115 | ||
1116 | L<Cannot tie unreifiable array|perldiag/"Cannot tie unreifiable array"> | |
1117 | ||
1118 | This error is part of a safety check that the C<tie> operator does before | |
1119 | tying a special array like C<@_>. You should never see this message. | |
1120 | ||
1121 | =item * | |
1122 | ||
b325a3a2 RS |
1123 | L<Source filters apply only to byte streams|perldiag/"Source filters apply only to byte streams"> |
1124 | ||
1125 | This new error occurs when you try to activate a source filter (usually by | |
1126 | loading a source filter module) within a string passed to C<eval> under the | |
1127 | C<unicode_eval> feature. | |
1128 | ||
1129 | =item * | |
1130 | ||
94c11dd4 RS |
1131 | L<&CORE::%s cannot be called directly|perldiag/"&CORE::%s cannot be called directly"> |
1132 | ||
1133 | (F) You tried to call a subroutine in the C<CORE::> namespace | |
1134 | with C<&foo> syntax or through a reference. The subroutines | |
1135 | in this package cannot yet be called that way, but must be | |
1136 | called as barewords. Something like this will work: | |
1137 | ||
1138 | BEGIN { *shove = \&CORE::push; } | |
1139 | shove @array, 1,2,3; # pushes on to @array | |
30682cc3 RS |
1140 | |
1141 | =back | |
1142 | ||
1143 | =head3 New Warnings | |
1144 | ||
1145 | =over 4 | |
1146 | ||
b325a3a2 RS |
1147 | =item * |
1148 | ||
cb82babd RS |
1149 | L<defined(@array) is deprecated|perldiag/"defined(@array) is deprecated"> |
1150 | ||
1151 | The long-deprecated C<defined(@array)> now also warns for package variables. | |
1152 | Previously it only issued a warning for lexical variables. | |
1153 | ||
1154 | =item * | |
1155 | ||
1156 | L<Useless use of \E|perldiag/"Useless use of \E"> | |
1157 | ||
1158 | C<\E> does nothing unless preceded by C<\Q>, C<\L> or C<\U>. | |
1159 | ||
1160 | =item * | |
1161 | ||
1162 | L<overload arg '%s' is invalid|perldiag/"overload arg '%s' is invalid"> | |
1163 | ||
1164 | This warning, in the "overload" category, is produced when the overload | |
1165 | pragma is given an argument it doesn't recognize, presumably a mistyped | |
1166 | operator. | |
1167 | ||
cb82babd RS |
1168 | =item * |
1169 | ||
b325a3a2 | 1170 | L<Useless assignment to a temporary|perldiag/"Useless assignment to a temporary"> |
30682cc3 | 1171 | |
a14d7d4a RS |
1172 | Assigning to a temporary returned from an XS lvalue subroutine now produces a |
1173 | warning [perl #31946]. | |
1174 | ||
b325a3a2 RS |
1175 | =item * |
1176 | ||
1177 | L<length() used on %s|perldiag/length() used on %s> | |
1178 | ||
1179 | This new warning occurs when C<length> is used on an array or hash, instead | |
1180 | of C<scalar(@array)> or C<scalar(keys %hash)>. | |
1181 | ||
1182 | =item * | |
1183 | ||
1184 | L<$[ used in %s (did you mean $] ?)|perldiag/"$[ used in %s (did you mean $] ?)"> | |
1185 | ||
1186 | This new warning exists to catch the mistaken use of C<$[> in version | |
1187 | checks. C<$]>, not C<$[>, contains the version number. C<$[> in a numeric | |
1188 | comparison is almost always wrong. | |
1189 | ||
1190 | =item * | |
1191 | ||
1192 | L<Use of assignment to $[ is deprecated|perldiag/"Use of assignment to $[ is deprecated"> | |
1193 | ||
1194 | This previously removed warning has been restored with the re-implementation | |
1195 | of C<$[> as a module. | |
1196 | ||
a14d7d4a | 1197 | =back |
30682cc3 | 1198 | |
cb82babd RS |
1199 | =head2 Removed Warnings |
1200 | ||
1201 | =over | |
1202 | ||
1203 | =item * | |
1204 | ||
1205 | "sort is now a reserved word" | |
1206 | ||
a4574d2e RS |
1207 | This error used to occur when C<sort> was called without arguments, |
1208 | followed by C<;> or C<)>. (E.g., C<sort;> would die, but C<{sort}> was | |
cb82babd RS |
1209 | OK.) This error message was added in Perl 3 to catch code like |
1210 | C<close(sort)> which would no longer work. More than two decades later, | |
1211 | this message is no longer appropriate. Now C<sort> without arguments is | |
a4574d2e RS |
1212 | always allowed, and returns an empty list, as it did in those cases |
1213 | where it was already allowed [perl #90030]. | |
cb82babd RS |
1214 | |
1215 | =back | |
1216 | ||
30682cc3 RS |
1217 | =head2 Changes to Existing Diagnostics |
1218 | ||
ccad93fd RS |
1219 | =over 4 |
1220 | ||
1221 | =item * | |
1222 | ||
412912b6 RS |
1223 | Redefinition warnings for constant subroutines used to be mandatory, |
1224 | even occurring under C<no warnings>. Now they respect the L<warnings> | |
1225 | pragma. | |
1226 | ||
1227 | =item * | |
1228 | ||
1229 | The "Attempt to free non-existent shared string" has had the spelling | |
1230 | of "non-existent" corrected to "nonexistent". It was already listed | |
1231 | with the correct spelling in L<perldiag>. | |
1232 | ||
1233 | =item * | |
1234 | ||
1235 | The 'Use of "foo" without parentheses is ambiguous' warning has been | |
1236 | extended to apply also to user-defined subroutines with a (;$) | |
1237 | prototype, and not just to built-in functions. | |
1238 | ||
1239 | =item * | |
1240 | ||
1241 | The error messages for using C<default> and C<when> outside of a | |
a4574d2e RS |
1242 | topicalizer have been standardised to match the messages for C<continue> |
1243 | and loop controls. They now read 'Can't "default" outside a | |
1244 | topicalizer' and 'Can't "when" outside a topicalizer'. They both used | |
1245 | to be 'Can't use when() outside a topicalizer' [perl #91514]. | |
412912b6 RS |
1246 | |
1247 | =item * | |
1248 | ||
a4574d2e RS |
1249 | The uninitialized warning for C<y///r> when C<$_> is implicit and |
1250 | undefined now mentions the variable name, just like the non-/r variation | |
1251 | of the operator. | |
b325a3a2 RS |
1252 | |
1253 | =item * | |
1254 | ||
a4574d2e RS |
1255 | The "Applying pattern match..." or similar warning produced when an |
1256 | array or hash is on the left-hand side of the C<=~> operator now | |
1257 | mentions the name of the variable. | |
b325a3a2 RS |
1258 | |
1259 | =item * | |
1260 | ||
ccad93fd RS |
1261 | The L<Invalid version format|perldiag/"Invalid version format (%s)"> |
1262 | error message now says "negative version number" within the parentheses, | |
1263 | rather than "non-numeric data", for negative numbers. | |
1264 | ||
1265 | =item * | |
1266 | ||
1267 | The two warnings | |
1268 | L<Possible attempt to put comments in qw() list|perldiag/"Possible attempt to put comments in qw() list"> | |
1269 | and | |
1270 | L<Possible attempt to separate words with commas|perldiag/"Possible attempt to separate words with commas"> | |
021c503d RS |
1271 | are no longer mutually exclusive: the same C<qw> construct may produce |
1272 | both. | |
30682cc3 | 1273 | |
021c503d | 1274 | =item * |
412912b6 | 1275 | |
021c503d RS |
1276 | The message, "Code point 0x%X is not Unicode, no properties match it; |
1277 | all inverse prop erties do" has been changed to "Code point 0x%X is not | |
1278 | Unicode, all \p{} matches fail; all \P{} matches succeed" | |
412912b6 RS |
1279 | |
1280 | =item * | |
30682cc3 | 1281 | |
021c503d RS |
1282 | Warnings that mention the names of lexical (C<my>) variables with |
1283 | Unicode characters in them now respect the presence or absence of the | |
1284 | C<:utf8> layer on the output handle, instead of outputting UTF8 | |
1285 | regardless. Also, the correct names are included in the strings passed | |
1286 | to C<$SIG{__WARN__}> handlers, rather than the raw UTF8 bytes. | |
412912b6 RS |
1287 | |
1288 | =back | |
30682cc3 | 1289 | |
021c503d RS |
1290 | =head1 Utility Changes |
1291 | ||
4bbade93 | 1292 | =head3 L<h2ph> |
30682cc3 RS |
1293 | |
1294 | =over 4 | |
1295 | ||
1296 | =item * | |
1297 | ||
4bbade93 RS |
1298 | L<h2ph> used to generate code of the form |
1299 | ||
412912b6 RS |
1300 | unless(defined(&FOO)) { |
1301 | sub FOO () {42;} | |
1302 | } | |
4bbade93 RS |
1303 | |
1304 | But the subroutine is a compile-time declaration, and is hence unaffected | |
1305 | by the condition. It has now been corrected to emit a string C<eval> | |
1306 | around the subroutine [perl #99368]. | |
30682cc3 RS |
1307 | |
1308 | =back | |
1309 | ||
cb82babd RS |
1310 | =head3 L<splain> |
1311 | ||
1312 | =over 4 | |
1313 | ||
1314 | =item * | |
1315 | ||
a4574d2e RS |
1316 | F<splain> no longer emits backtraces with the first line number repeated. |
1317 | ||
cb82babd RS |
1318 | This: |
1319 | ||
1320 | Uncaught exception from user code: | |
1321 | Cannot fwiddle the fwuddle at -e line 1. | |
1322 | at -e line 1 | |
1323 | main::baz() called at -e line 1 | |
1324 | main::bar() called at -e line 1 | |
1325 | main::foo() called at -e line 1 | |
1326 | ||
1327 | has become this: | |
1328 | ||
1329 | Uncaught exception from user code: | |
1330 | Cannot fwiddle the fwuddle at -e line 1. | |
1331 | main::baz() called at -e line 1 | |
1332 | main::bar() called at -e line 1 | |
1333 | main::foo() called at -e line 1 | |
1334 | ||
1335 | =item * | |
1336 | ||
1337 | Some error messages consist of multiple lines that are listed as separate | |
1338 | entries in L<perldiag>. splain has been taught to find the separate | |
1339 | entries in these cases, instead of simply failing to find the message. | |
1340 | ||
1341 | =back | |
1342 | ||
021c503d RS |
1343 | =head3 L<zipdetails> |
1344 | ||
1345 | =over 4 | |
1346 | ||
1347 | =item * | |
1348 | ||
1349 | L<zipdetails> displays information about the internal record structure | |
1350 | of the zip file. It is not concerned with displaying any details of | |
1351 | the compressed data stored in the zip file. | |
1352 | ||
1353 | =back | |
1354 | ||
30682cc3 RS |
1355 | =head1 Configuration and Compilation |
1356 | ||
a14d7d4a | 1357 | =over 4 |
30682cc3 | 1358 | |
a14d7d4a | 1359 | =item * |
30682cc3 | 1360 | |
a4574d2e | 1361 | The C<-Dusesitecustomize> and C<-Duserelocatableinc> options now work |
412912b6 RS |
1362 | together properly. |
1363 | ||
1364 | =item * | |
1365 | ||
a14d7d4a RS |
1366 | F<regexp.h> has been modified for compatibility with GCC's B<-Werror> |
1367 | option, as used by some projects that include perl's header files (5.14.1). | |
30682cc3 RS |
1368 | |
1369 | =item * | |
1370 | ||
a14d7d4a RS |
1371 | C<USE_LOCALE{,_COLLATE,_CTYPE,_NUMERIC}> have been added the output of perl -V |
1372 | as they have affect the behaviour of the interpreter binary (albeit only | |
1373 | in a small area). | |
1374 | ||
1375 | =item * | |
1376 | ||
1377 | The code and tests for L<IPC::Open2> have been moved from F<ext/IPC-Open2> | |
1378 | into F<ext/IPC-Open3>, as C<IPC::Open2::open2()> is implemented as a thin | |
1379 | wrapper around C<IPC::Open3::_open3()>, and hence is very tightly coupled to | |
1380 | it. | |
1381 | ||
1382 | =item * | |
1383 | ||
1384 | The magic types and magic vtables are now generated from data in a new script | |
1385 | F<regen/mg_vtable.pl>, instead of being maintained by hand. As different EBCDIC | |
1386 | variants can't agree on the code point for '~', the character to code point | |
1387 | conversion is done at build time by F<generate_uudmap> to a new generated header | |
1388 | F<mg_data.h>. C<PL_vtbl_bm> and C<PL_vtbl_fm> are now defined by the | |
1389 | pre-processor as C<PL_vtbl_regexp>, instead of being distinct C variables. | |
1390 | C<PL_vtbl_sig> has been removed. | |
1391 | ||
1392 | =item * | |
1393 | ||
1394 | Building with C<-DPERL_GLOBAL_STRUCT> works again. This configuration is not | |
1395 | generally used. | |
1396 | ||
1397 | =item * | |
1398 | ||
1399 | Perl configured with I<MAD> now correctly frees C<MADPROP> structures when | |
1400 | OPs are freed. C<MADPROP>s are now allocated with C<PerlMemShared_malloc()> | |
1401 | ||
1402 | =back | |
30682cc3 | 1403 | |
30682cc3 RS |
1404 | =head1 Testing |
1405 | ||
1406 | XXX Any significant changes to the testing of a freshly built perl should be | |
1407 | listed here. Changes which create B<new> files in F<t/> go here as do any | |
1408 | large changes to the testing harness (e.g. when parallel testing was added). | |
1409 | Changes to existing files in F<t/> aren't worth summarising, although the bugs | |
1410 | that they represent may be covered elsewhere. | |
1411 | ||
1412 | [ List each test improvement as a =item entry ] | |
1413 | ||
1414 | =over 4 | |
1415 | ||
1416 | =item * | |
1417 | ||
1418 | XXX | |
1419 | ||
1420 | =back | |
1421 | ||
1422 | =head1 Platform Support | |
1423 | ||
1424 | XXX Any changes to platform support should be listed in the sections below. | |
1425 | ||
1426 | [ Within the sections, list each platform as a =item entry with specific | |
1427 | changes as paragraphs below it. ] | |
1428 | ||
1429 | =head2 New Platforms | |
1430 | ||
1431 | XXX List any platforms that this version of perl compiles on, that previous | |
1432 | versions did not. These will either be enabled by new files in the F<hints/> | |
1433 | directories, or new subdirectories and F<README> files at the top level of the | |
1434 | source tree. | |
1435 | ||
1436 | =over 4 | |
1437 | ||
1438 | =item XXX-some-platform | |
1439 | ||
1440 | XXX | |
1441 | ||
1442 | =back | |
1443 | ||
1444 | =head2 Discontinued Platforms | |
1445 | ||
1446 | XXX List any platforms that this version of perl no longer compiles on. | |
1447 | ||
1448 | =over 4 | |
1449 | ||
1450 | =item XXX-some-platform | |
1451 | ||
1452 | XXX | |
1453 | ||
1454 | =back | |
1455 | ||
1456 | =head2 Platform-Specific Notes | |
1457 | ||
412912b6 RS |
1458 | =head3 VMS |
1459 | ||
30682cc3 RS |
1460 | =over 4 |
1461 | ||
412912b6 | 1462 | =item * |
30682cc3 | 1463 | |
4bbade93 RS |
1464 | Remove unnecessary includes, fix miscellaneous compiler warnings and |
1465 | close some unclosed comments on F<vms/vms.c>. | |
1466 | ||
1467 | Remove sockadapt layer from the VMS build. | |
30682cc3 | 1468 | |
412912b6 RS |
1469 | =item * |
1470 | ||
412912b6 RS |
1471 | Explicit support for VMS versions prior to v7.0 and DEC C versions |
1472 | prior to v6.0 has been removed. | |
1473 | ||
1474 | =item * | |
1475 | ||
1476 | Since Perl 5.10.1, the home-grown C<stat> wrapper has been unable to | |
1477 | distinguish between a directory name containing an underscore and an | |
1478 | otherwise-identical filename containing a dot in the same position | |
1479 | (e.g., t/test_pl as a directory and t/test.pl as a file). This problem | |
1480 | has been corrected. | |
1481 | ||
1482 | =back | |
1483 | ||
1484 | =head3 GNU/Hurd | |
b325a3a2 RS |
1485 | |
1486 | Numerous build and test failures on GNU/Hurd have been resolved with hints | |
1487 | for building DBM modules, detection of the library search path, and enabling | |
1488 | of large file support. | |
1489 | ||
412912b6 | 1490 | =head3 OpenVOS |
b325a3a2 RS |
1491 | |
1492 | Perl is now built with dynamic linking on OpenVOS, the minimum supported | |
1493 | version of which is now Release 17.1.0. | |
1494 | ||
412912b6 | 1495 | =head3 SunOS |
b325a3a2 RS |
1496 | |
1497 | The CC workshop C++ compiler is now detected and used on systems that ship | |
1498 | without cc. | |
1499 | ||
30682cc3 RS |
1500 | =head1 Internal Changes |
1501 | ||
4bbade93 | 1502 | =over 4 |
30682cc3 | 1503 | |
4bbade93 | 1504 | =item * |
30682cc3 | 1505 | |
cb82babd RS |
1506 | There are now feature bundle hints in C<PL_hints> (C<$^H>) that version |
1507 | declarations use, to avoid having to load F<feature.pm>. One setting of | |
1508 | the hint bits indicates a "custom" feature bundle, which means that the | |
1509 | entries in C<%^H> still apply. F<feature.pm> uses that. | |
1510 | ||
1511 | The C<HINT_FEATURE_MASK> macro is defined in F<perl.h> along with other | |
1512 | hints. Other macros for setting and testing features and bundles are in | |
1513 | the new F<feature.h>. C<FEATURE_IS_ENABLED> (which has moved to | |
1514 | F<feature.h>) is no longer used throughout the codebase, but more specific | |
1515 | macros, e.g., C<FEATURE_SAY_IS_ENABLED>, that are defined in F<feature.h>. | |
1516 | ||
1517 | =item * | |
1518 | ||
1519 | F<lib/feature.pm> is now a generated file, created by the new | |
1520 | F<regen/feature.pl> script, which also generates F<feature.h>. | |
1521 | ||
1522 | =item * | |
1523 | ||
1524 | Tied arrays are now always C<AvREAL>. If C<@_> or C<DB::args> is tied, it | |
1525 | is reified first, to make sure this is always the case. | |
1526 | ||
cb82babd RS |
1527 | =item * |
1528 | ||
4bbade93 RS |
1529 | The C<is_gv_magical_sv> function has been eliminated and merged with |
1530 | C<gv_fetchpvn_flags>. It used to be called to determine whether a GV | |
1531 | should be autovivified in rvalue context. Now it has been replaced with a | |
1532 | new C<GV_ADDMG> flag (not part of the API). | |
30682cc3 RS |
1533 | |
1534 | =item * | |
1535 | ||
4bbade93 RS |
1536 | Padlists are now marked C<AvREAL>; i.e., reference-counted. They have |
1537 | always been reference-counted, but were not marked real, because F<pad.c> | |
1538 | did its own clean-up, instead of using the usual clean-up code in F<sv.c>. | |
1539 | That caused problems in thread cloning, so now the C<AvREAL> flag is on, | |
1540 | but is turned off in F<pad.c> right before the padlist is freed (after | |
1541 | F<pad.c> has done its custom freeing of the pads). | |
1542 | ||
1543 | =item * | |
1544 | ||
1545 | All the C files that make up the Perl core have been converted to UTF-8. | |
30682cc3 RS |
1546 | |
1547 | =back | |
1548 | ||
1549 | =head1 Selected Bug Fixes | |
1550 | ||
a14d7d4a | 1551 | =head2 Regular expressions and character classes |
30682cc3 RS |
1552 | |
1553 | =over 4 | |
1554 | ||
1555 | =item * | |
1556 | ||
a14d7d4a RS |
1557 | The new (in 5.14.0) regular expression modifier C</a> when repeated like |
1558 | C</aa> forbids the characters outside the ASCII range that match | |
1559 | characters inside that range from matching under C</i>. This did not | |
1560 | work under some circumstances, all involving alternation, such as: | |
1561 | ||
1562 | "\N{KELVIN SIGN}" =~ /k|foo/iaa; | |
1563 | ||
1564 | succeeded inappropriately. This is now fixed. | |
1565 | ||
1566 | =item * | |
1567 | ||
1568 | 5.14.0 introduced some memory leaks in regular expression character | |
1569 | classes such as C<[\w\s]>, which have now been fixed (5.14.1) | |
1570 | ||
1571 | =item * | |
1572 | ||
1573 | An edge case in regular expression matching could potentially loop. | |
1574 | This happened only under C</i> in bracketed character classes that have | |
1575 | characters with multi-character folds, and the target string to match | |
1576 | against includes the first portion of the fold, followed by another | |
1577 | character that has a multi-character fold that begins with the remaining | |
1578 | portion of the fold, plus some more. | |
1579 | ||
1580 | "s\N{U+DF}" =~ /[\x{DF}foo]/i | |
1581 | ||
1582 | is one such case. C<\xDF> folds to C<"ss">. (5.14.1) | |
1583 | ||
1584 | =item * | |
1585 | ||
1586 | A few characters in regular expression pattern matches did not | |
1587 | match correctly in some circumstances, all involving C</i>. The | |
1588 | affected characters are: | |
1589 | COMBINING GREEK YPOGEGRAMMENI, | |
1590 | GREEK CAPITAL LETTER IOTA, | |
1591 | GREEK CAPITAL LETTER UPSILON, | |
1592 | GREEK PROSGEGRAMMENI, | |
1593 | GREEK SMALL LETTER IOTA WITH DIALYTIKA AND OXIA, | |
1594 | GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS, | |
1595 | GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND OXIA, | |
1596 | GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS, | |
1597 | LATIN SMALL LETTER LONG S, | |
1598 | LATIN SMALL LIGATURE LONG S T, | |
1599 | and | |
1600 | LATIN SMALL LIGATURE ST. | |
1601 | ||
1602 | =item * | |
1603 | ||
1604 | Fixed memory leak regression in regular expression compilation | |
1605 | under threading | |
1606 | ||
1607 | =back | |
1608 | ||
1609 | =head2 Formats | |
1610 | ||
1611 | =over | |
1612 | ||
1613 | =item * | |
1614 | ||
1615 | A number of edge cases have been fixed with formats and C<formline>; | |
1616 | in particular, where the format itself is potentially variable (such as | |
1617 | with ties and overloading), and where the format and data differ in their | |
1618 | encoding. In both these cases, it used to possible for the output to be | |
1619 | corrupted [perl #91032]. | |
1620 | ||
1621 | =item * | |
1622 | ||
1623 | C<formline> no longer converts its argument into a string in-place. So | |
1624 | passing a reference to C<formline> no longer destroys the reference | |
1625 | [perl #79532]. | |
1626 | ||
1627 | =back | |
1628 | ||
1629 | =head2 Copy-on-write scalars | |
1630 | ||
1631 | Copy-on-write scalars were introduced in 5.8.0, but most Perl code | |
1632 | did not encounter them (they were used mostly internally). Perl | |
1633 | 5.10.0 extended them, such that assigning C<__PACKAGE__> or a | |
1634 | hash key to a scalar would make it copy-on-write. Several parts | |
1635 | of Perl were not updated to account for them, but have now been fixed. | |
1636 | ||
1637 | =over | |
1638 | ||
1639 | =item * | |
1640 | ||
1641 | C<utf8::decode> had a nasty bug that would modify copy-on-write scalars' | |
1642 | string buffers in place (i.e., skipping the copy). This could result in | |
1643 | hashes having two elements with the same key [perl #91834]. | |
1644 | ||
1645 | =item * | |
1646 | ||
1647 | Lvalue subroutines were not allowing COW scalars to be returned. This was | |
1648 | fixed for lvalue scalar context in Perl 5.12.3 and 5.14.0, but list context | |
1649 | was not fixed until this release. | |
1650 | ||
1651 | =item * | |
1652 | ||
1653 | Elements of restricted hashes (see the L<fields> pragma) containing | |
1654 | copy-on-write values couldn't be deleted, nor could such hashes be cleared | |
1655 | (C<%hash = ()>). | |
1656 | ||
1657 | =item * | |
1658 | ||
1659 | Localising a tied variable used to make it read-only if it contained a | |
1660 | copy-on-write string. | |
1661 | ||
1662 | =item * | |
1663 | ||
1664 | L<Storable>, L<Devel::Peek> and L<PerlIO::scalar> had similar problems. | |
1665 | See L</Updated Modules and Pragmata>, above. | |
1666 | ||
1667 | =back | |
1668 | ||
1669 | =head2 lvalue subroutines | |
1670 | ||
1671 | There have been various fixes to lvalue subroutines. | |
1672 | ||
1673 | =over | |
1674 | ||
1675 | =item * | |
1676 | ||
1677 | Explicit return now returns the actual argument passed to return, instead | |
1678 | of copying it [perl #72724] [perl #72706]. | |
1679 | ||
1680 | B<Note:> There are still some discrepancies between explicit and implicit | |
1681 | return, which will hopefully be resolved soon. So the exact behaviour is | |
1682 | not set in stone yet. | |
1683 | ||
1684 | =item * | |
1685 | ||
1686 | Lvalue subroutines used to enforce lvalue syntax (i.e., whatever can go on | |
1687 | the left-hand side of C<=>) for the last statement and the arguments to | |
1688 | return. Since lvalue subroutines are not always called in lvalue context, | |
1689 | this restriction has been lifted. | |
1690 | ||
1691 | =item * | |
1692 | ||
1693 | Lvalue subroutines are less restrictive as to what values can be returned. | |
1694 | It used to croak on values returned by C<shift> and C<delete> and from | |
1695 | other subroutines, but no longer does so [perl #71172]. | |
1696 | ||
1697 | =item * | |
1698 | ||
1699 | Empty lvalue subroutines (C<sub :lvalue {}>) used to return C<@_> in list | |
1700 | context. In fact, all subroutines used to, but regular subs were fixed in | |
1701 | Perl 5.8.2. Now lvalue subroutines have been likewise fixed. | |
1702 | ||
1703 | =item * | |
1704 | ||
1705 | Lvalue subroutines used to copy their return values in rvalue context. Not | |
1706 | only was this a waste of CPU cycles, but it also caused bugs. A C<($)> | |
1707 | prototype would cause an lvalue sub to copy its return value [perl #51408], | |
1708 | and C<while(lvalue_sub() =~ m/.../g) { ... }> would loop endlessly | |
1709 | [perl #78680]. | |
1710 | ||
1711 | =item * | |
1712 | ||
1713 | Autovivification now works on values returned from lvalue subroutines | |
1714 | [perl #7946]. | |
1715 | ||
1716 | =item * | |
1717 | ||
1718 | When called in pass-by-reference context (e.g., subroutine arguments or a list | |
1719 | passed to C<for>), an lvalue subroutine returning arrays or hashes used to bind | |
1720 | the arrays (or hashes) to scalar variables--something that is not supposed to | |
1721 | happen. This could result in "Bizarre copy of ARRAY" errors or C<print> | |
1722 | ignoring its arguments. It also made nonsensical code like C<@{\$_}> "work". | |
1723 | This was fixed in 5.14.0 if an array were the first thing returned from the | |
1724 | subroutine (but not for C<$scalar, @array> or hashes being returned). Now a | |
1725 | more general fix has been applied [perl #23790]. | |
1726 | ||
1727 | =item * | |
1728 | ||
1729 | When called in pass-by-reference context, lvalue subroutines used to copy | |
1730 | any read-only value that was returned. E.g., C< sub :lvalue { $] } > | |
1731 | would not return C<$]>, but a copy of it. | |
1732 | ||
1733 | =item * | |
1734 | ||
1735 | Assignment to C<keys> returned from an lvalue sub used not to work, but now | |
1736 | it does. | |
1737 | ||
1738 | =item * | |
1739 | ||
1740 | Applying the C<:lvalue> attribute to an XSUB or to an aliased subroutine | |
1741 | stub with C<< sub foo :lvalue; >> syntax stopped working in Perl 5.12. | |
1742 | This has been fixed. | |
1743 | ||
1744 | =back | |
1745 | ||
1746 | =head2 Fixes related to hashes | |
1747 | ||
1748 | =over | |
1749 | ||
1750 | =item * | |
1751 | ||
1752 | A bug has been fixed that would cause a "Use of freed value in iteration" | |
1753 | error if the next two hash elements that would be iterated over are | |
1754 | deleted [perl #85026]. (5.14.1) | |
1755 | ||
1756 | =item * | |
1757 | ||
1758 | Freeing deeply nested hashes no longer crashes [perl #44225]. | |
1759 | ||
1760 | =item * | |
1761 | ||
1762 | Deleting the current hash iterator (the hash element that would be returend | |
1763 | by the next call to C<each>) in void context used not to free it. The hash | |
1764 | would continue to reference it until the next iteration. This has been | |
1765 | fixed [perl #85026]. | |
1766 | ||
1767 | =back | |
1768 | ||
021c503d RS |
1769 | =head2 Support for Embedded Nulls |
1770 | ||
1771 | Some parts of Perl did not work correctly with nulls (C<chr 0>) embedded in | |
1772 | strings. That meant that, for instance, C<< $m = "a\0b"; foo->$m >> would | |
1773 | call the "a" method, instead of the actual method name contained in $m. | |
1774 | These parts of perl have been fixed to support nulls: | |
1775 | ||
1776 | =over | |
1777 | ||
1778 | =item * | |
1779 | ||
1780 | Method names | |
1781 | ||
1782 | =item * | |
1783 | ||
1784 | Typeglob names (including filehandle names) | |
1785 | ||
1786 | =item * | |
1787 | ||
1788 | Package names | |
1789 | ||
1790 | =item * | |
1791 | ||
1792 | Autoloading | |
1793 | ||
1794 | =item * | |
1795 | ||
1796 | Return value of C<ref()> | |
1797 | ||
1798 | =item * | |
1799 | ||
1800 | Package names returned by C<caller()> | |
1801 | ||
1802 | =item * | |
1803 | ||
1804 | Filehandle warnings | |
1805 | ||
1806 | =item * | |
1807 | ||
1808 | Typeglob elements (C<*foo{"THING\0stuff"}>) | |
1809 | ||
1810 | =item * | |
1811 | ||
1812 | Signal names | |
1813 | ||
1814 | =item * | |
1815 | ||
1816 | Various warnings and error messages that mention variable names or values, | |
1817 | methods, etc. | |
1818 | ||
1819 | =back | |
1820 | ||
1821 | One side effect of these changes is that blessing into "\0" no longer | |
1822 | causes C<ref()> to return false. | |
1823 | ||
a14d7d4a RS |
1824 | =head2 Other notable fixes |
1825 | ||
1826 | =over | |
1827 | ||
021c503d RS |
1828 | =item * |
1829 | ||
1830 | Last-accessed filehandle | |
1831 | ||
1832 | Perl has an internal variable that stores the last filehandle to be | |
1833 | accessed. It is used by C<$.> and by C<tell> and C<eof> without | |
1834 | arguments. | |
1835 | ||
1836 | It used to be possible to set this internal variable to a glob copy and | |
1837 | then modify that glob copy to be something other than a glob, and still | |
1838 | have the last-accessed filehandle associated with the variable after | |
1839 | assigning a glob to it again: | |
1840 | ||
1841 | my $foo = *STDOUT; # $foo is a glob copy | |
1842 | <$foo>; # $foo is now the last-accessed handle | |
1843 | $foo = 3; # no longer a glob | |
1844 | $foo = *STDERR; # still the last-accessed handle | |
1845 | ||
1846 | Now the C<$foo = 3> assignment unsets that internal variable, so there | |
1847 | is no last-accessed filehandle, just as if C<< <$foo> >> had never | |
1848 | happened. | |
1849 | ||
1850 | =item * | |
cb82babd | 1851 | |
021c503d | 1852 | Tying C<%^H> |
cb82babd | 1853 | |
021c503d RS |
1854 | Tying C<%^H> no longer causes perl to crash or ignore the contents of |
1855 | C<%^H> when entering a compilation scope [perl #106282]. | |
cb82babd | 1856 | |
021c503d | 1857 | =item * |
cb82babd | 1858 | |
021c503d | 1859 | C<~> on vstrings |
cb82babd RS |
1860 | |
1861 | The bitwise complement operator (and possibly other operators, too) when | |
1862 | passed a vstring would leave vstring magic attached to the return value, | |
1863 | even though the string had changed. This meant that | |
1864 | C<< version->new(~v1.2.3) >> would create a version looking like "v1.2.3" | |
1865 | even though the string passed to C<< version->new >> was actually | |
1866 | "\376\375\374". This also caused L<B::Deparse> to deparse C<~v1.2.3> | |
1867 | incorrectly, without the C<~> [perl #29070]. | |
1868 | ||
021c503d RS |
1869 | =item * |
1870 | ||
1871 | Vstrings blowing away magic | |
cb82babd RS |
1872 | |
1873 | Assigning a vstring to a magic (e.g., tied, C<$!>) variable and then | |
1874 | assigning something else used to blow away all the magic. This meant that | |
1875 | tied variables would come undone, C<$!> would stop getting updated on | |
1876 | failed system calls, C<$|> would stop setting autoflush, and other | |
1877 | mischief would take place. This has been fixed. | |
1878 | ||
021c503d RS |
1879 | =item * |
1880 | ||
1881 | C<newHVhv> and tied hashes | |
cb82babd RS |
1882 | |
1883 | The C<newHVhv> XS function now works on tied hashes, instead of crashing or | |
1884 | returning an empty hash. | |
1885 | ||
021c503d RS |
1886 | =item * |
1887 | ||
1888 | Hashes will null elements | |
cb82babd RS |
1889 | |
1890 | It is possible from XS code to create hashes with elements that have no | |
1891 | values. Perl itself sometimes creates such hashes, but they are rarely | |
1892 | visible to Perl code. The hash element and slice operators used to crash | |
1893 | when handling these in lvalue context. These have been fixed. They now | |
1894 | produce a "Modification of non-creatable hash value attempted" error | |
1895 | message. | |
1896 | ||
021c503d RS |
1897 | =item * |
1898 | ||
1899 | No warning for C<open(foo::bar)> | |
cb82babd RS |
1900 | |
1901 | When one writes C<open foo || die>, which used to work in Perl 4, a | |
1902 | "Precedence problem" warning is produced. This warning used erroneously to | |
1903 | apply to fully-qualified bareword handle names not followed by C<||>. This | |
1904 | has been corrected. | |
1905 | ||
021c503d RS |
1906 | =item * |
1907 | ||
1908 | C<select> and package aliasing | |
cb82babd RS |
1909 | |
1910 | After package aliasing (C<*foo:: = *bar::>), C<select> with 0 or 1 argument | |
1911 | would sometimes return a name that could not be used to refer to the | |
1912 | filehandle, or sometimes it would return C<undef> even when a filehandle | |
1913 | was selected. Now it returns a typeglob reference in such cases. | |
1914 | ||
021c503d RS |
1915 | =item * |
1916 | ||
1917 | C<PerlIO::get_layers> and tied variables | |
cb82babd RS |
1918 | |
1919 | C<PerlIO::get_layers> no longer ignores FETCH on tied variables as it used | |
1920 | to most of the time [perl #97956]. | |
1921 | ||
021c503d RS |
1922 | =item * |
1923 | ||
1924 | C<PerlIO::get_layers> and numbers | |
cb82babd RS |
1925 | |
1926 | C<PerlIO::get_layers> no longer ignores some arguments that it thinks are | |
1927 | numeric, while treating others as filehandle names. It is now consistent | |
1928 | for flat scalars (i.e., not references). | |
1929 | ||
021c503d RS |
1930 | =item * |
1931 | ||
1932 | Lvalue subs and strict mode | |
cb82babd RS |
1933 | |
1934 | Lvalue sub calls that are not determined to be such at compile time | |
1935 | (C<&$name> or &{"name"}) are no longer exempt from strict refs if they | |
1936 | occur in the last statement of an lvalue subroutine [perl #102486]. | |
1937 | ||
021c503d RS |
1938 | =item * |
1939 | ||
1940 | Non-lvalue sub calls in potentially lvalue context | |
cb82babd RS |
1941 | |
1942 | Sub calls whose subs are not visible at compile time, if | |
1943 | they occurred in the last statement of an lvalue subroutine, | |
1944 | would reject non-lvalue subroutines and die with "Can't modify non-lvalue | |
1945 | subroutine call" [perl #102486]. | |
1946 | ||
1947 | Non-lvalue sub calls whose subs I<are> visible at compile time exhibited | |
1948 | the opposite bug. If the call occurred in the last statement of an lvalue | |
1949 | subroutine, there would be no error when the lvalue sub was called in | |
1950 | lvalue context. Perl would blindly assign to the temporary value returned | |
1951 | by the non-lvalue subroutine. | |
1952 | ||
021c503d RS |
1953 | =item * |
1954 | ||
1955 | AUTOLOADing lvalue subs | |
cb82babd RS |
1956 | |
1957 | C<AUTOLOAD> routines used to take precedence over the actual sub being | |
1958 | called (i.e., when autoloading wasn't needed), for sub calls in lvalue or | |
1959 | potential lvalue context, if the subroutine was not visible at compile | |
1960 | time. | |
1961 | ||
021c503d RS |
1962 | =item * |
1963 | ||
1964 | C<caller> and tied C<@DB::args> | |
cb82babd RS |
1965 | |
1966 | C<caller> sets C<@DB::args> to the subroutine arguments when called from | |
1967 | the DB package. It used to crash when doing so if C<@DB::args> happened to | |
1968 | be tied. Now it croaks instead. | |
1969 | ||
021c503d RS |
1970 | =item * |
1971 | ||
1972 | Tying C<@_> | |
cb82babd RS |
1973 | |
1974 | Under debugging builds, this code: | |
1975 | ||
1976 | sub TIEARRAY{bless[]} | |
1977 | sub { | |
1978 | tie @_, ""; | |
1979 | \@_; | |
1980 | }->(1); | |
1981 | ||
1982 | use to produce an "av_reify called on tied array" warning. It doesn't any | |
1983 | more. | |
1984 | ||
021c503d RS |
1985 | =item * |
1986 | ||
1987 | Unrecognised switches on C<#!> line | |
cb82babd RS |
1988 | |
1989 | If a switch, such as B<-x>, that cannot occur on the C<#!> line is used | |
1990 | there, perl dies with "Can't emulate...". | |
1991 | ||
1992 | It used to produce the same message for switches that perl did not | |
1993 | recognise at all, whether on the command line or the C<#!> line. | |
1994 | ||
1995 | Now it produces the "Unrecognized switch" error message [perl #104288]. | |
1996 | ||
021c503d RS |
1997 | =item * |
1998 | ||
1999 | C<system> and SIGCHLD | |
cb82babd RS |
2000 | |
2001 | C<system> now temporarily blocks the SIGCHLD signal handler, to prevent the | |
2002 | signal handler from stealing the exit status [perl #105700]. | |
2003 | ||
021c503d RS |
2004 | =item * |
2005 | ||
2006 | Deleting methods via C<delete> | |
cb82babd RS |
2007 | |
2008 | Deletion of methods via C<delete $Class::{method}> syntax used to update | |
2009 | method caches if called in void context, but not scalar or list context. | |
2010 | Now it always updates those caches. | |
2011 | ||
021c503d RS |
2012 | =item * |
2013 | ||
2014 | Hash element deletion and destructors | |
cb82babd RS |
2015 | |
2016 | When hash elements are deleted in void context, the internal hash entry is | |
2017 | now freed before the value is freed, to prevent destructors called by that | |
2018 | latter freeing from seeing the hash in an inconsistent state. It was | |
2019 | possible to cause double-frees if the destructor freed the hash itself | |
2020 | [perl #100340]. | |
2021 | ||
021c503d RS |
2022 | =item * |
2023 | ||
2024 | C<(s)printf>'s %n formatting code | |
cb82babd RS |
2025 | |
2026 | The %n formatting code, which causes the number of characters to be | |
2027 | assigned to the next argument to C<printf> or C<sprintf> now actually | |
2028 | assigns the number of characters, instead of the number of bytes. | |
2029 | ||
2030 | It also works now with special lvalue functions like C<substr> and with | |
2031 | nonexistent hash and array elements [perl #3471, #103492]. | |
2032 | ||
021c503d RS |
2033 | =item * |
2034 | ||
2035 | Typeglobs and threads | |
cb82babd RS |
2036 | |
2037 | Typeglobs returned from threads are no longer cloned if the parent thread | |
2038 | already has a glob with the same name. This means that returned | |
2039 | subroutines will now assign to the right package variables [perl #107366]. | |
2040 | ||
021c503d RS |
2041 | =item * |
2042 | ||
2043 | C<local $_> | |
cb82babd RS |
2044 | |
2045 | In Perl 5.14, C<local $_> was changed to create a new variable not tied to | |
2046 | anything, even if $_ was tied before that. But, due to an oversight, it | |
2047 | would still call FETCH once on a tied $_ before replacing it with the new | |
2048 | variable. This has been fixed [perl #105912]. | |
2049 | ||
021c503d RS |
2050 | =item * |
2051 | ||
2052 | Returning tied variables | |
cb82babd RS |
2053 | |
2054 | When returning a value from a non-lvalue subroutine, Perl copies the value. | |
2055 | Sometimes it cheats for the sake of speed, and does not copy the value if | |
2056 | it makes no observable difference. This optimisation was erroneously | |
2057 | allowing the copy to be skipped on tied variables, causing a difference in | |
2058 | behaviour depending on the tied variable's reference count. This has been | |
2059 | fixed [perl #95548]. | |
2060 | ||
021c503d | 2061 | =item * |
cb82babd RS |
2062 | |
2063 | C<utf8::decode> now refuses to modify read-only scalars [perl #91850]. | |
2064 | ||
021c503d RS |
2065 | =item * |
2066 | ||
2067 | C<dbmopen> with undefined mode | |
cb82babd RS |
2068 | |
2069 | C<dbmopen> now only warns once, rather than three times, if the mode | |
2070 | argument is C<undef> [perl #90064]. | |
2071 | ||
021c503d RS |
2072 | =item * |
2073 | ||
2074 | Freeing an aggregate during list assignment | |
cb82babd RS |
2075 | |
2076 | If list assignment to a hash or array triggered destructors that freed the | |
2077 | hash or array itself, a crash would ensue. This is no longer the case | |
2078 | [perl #107440]. | |
2079 | ||
021c503d RS |
2080 | =item * |
2081 | ||
2082 | Confused internal bookkeeping with @ISA arrays | |
cb82babd RS |
2083 | |
2084 | Creating a weak reference to an @ISA array or accessing the array index | |
2085 | (C<$#ISA>) could result in confused internal bookkeeping for elements | |
2086 | subsequently added to the @ISA array. For instance, creating a weak | |
2087 | reference to the element itself could push that weak reference on to @ISA; | |
2088 | and elements added after use of C<$#ISA> would be ignored by method lookup | |
2089 | [perl #85670]. | |
2090 | ||
021c503d RS |
2091 | =item * |
2092 | ||
2093 | DELETE on scalar ties | |
cb82babd RS |
2094 | |
2095 | Tying an element of %ENV or C<%^H> and then deleting that element would | |
2096 | result in a call to the tie object's DELETE method, even though tying the | |
2097 | element itself is supposed to be equivalent to tying a scalar (the element | |
2098 | is, of course, a scalar) [perl #67490]. | |
2099 | ||
021c503d RS |
2100 | =item * |
2101 | ||
2102 | Freeing $_ inside C<grep> or C<map> | |
cb82babd RS |
2103 | |
2104 | Freeing $_ inside a C<grep> or C<map> block or a code block embedded in a | |
2105 | regular expression used to result in double frees [perl #92254, #92256]. | |
2106 | ||
021c503d RS |
2107 | =item * |
2108 | ||
2109 | Warnings with C<+=> | |
cb82babd RS |
2110 | |
2111 | The C<+=> operator does not usually warn when the left-hand side is | |
2112 | C<undef>, but it was doing so for tied variables. This has been fixed | |
2113 | [perl #44895]. | |
2114 | ||
021c503d RS |
2115 | =item * |
2116 | ||
2117 | Tying and autovivification | |
cb82babd RS |
2118 | |
2119 | When Perl autovivifies an element of a tied array or hash (which entails | |
2120 | calling STORE with a new reference), it now calls FETCH immediately after | |
2121 | the STORE, instead of assuming that FETCH would have returned the same | |
2122 | reference. This can make it easier to implement tied objects [perl #35865, #43011]. | |
2123 | ||
021c503d RS |
2124 | =item * |
2125 | ||
2126 | C<@&> and C<$&> | |
cb82babd RS |
2127 | |
2128 | Mentioning a variable named "&" other than C<$&> (i.e., C<@&> or C<%&>) no | |
2129 | longer stops C<$&> from working. The same applies to variables named "'" | |
2130 | and "`" [perl #24237]. | |
2131 | ||
021c503d RS |
2132 | =item * |
2133 | ||
2134 | Stacked filetests | |
cb82babd RS |
2135 | |
2136 | C<-T> and C<-B> now work when stacked up with other filetest operators | |
2137 | [perl #77388]. | |
2138 | ||
021c503d RS |
2139 | =item * |
2140 | ||
2141 | Filetests and stat buffers | |
cb82babd RS |
2142 | |
2143 | Perl keeps several internal variables to keep track of the last stat | |
2144 | buffer, from which file(handle) it originated, what type it was, and | |
2145 | whether the last stat succeeded. | |
2146 | ||
2147 | There were various cases where these could get out of synch, resulting in | |
2148 | inconsistent or erratic behaviour in edge cases (every mention of C<-T> | |
2149 | applies to C<-B> as well): | |
2150 | ||
2151 | =over | |
2152 | ||
2153 | =item * | |
2154 | ||
2155 | C<-T I<HANDLE>>, even though it does a C<stat>, was not resetting the last | |
2156 | stat type, so an C<lstat _> following it would merrily return the wrong | |
2157 | results. Also, it was not setting the success status. | |
2158 | ||
2159 | =item * | |
2160 | ||
2161 | Freeing the handle last used by C<stat> or a filetest could result in | |
2162 | S<C<-T _>> using an unrelated handle. | |
2163 | ||
2164 | =item * | |
2165 | ||
2166 | C<stat> with an IO reference (as returned by C<*STDIO{IO}>, for instance) | |
2167 | would not reset the stat type. | |
2168 | ||
2169 | =item * | |
2170 | ||
2171 | C<stat> with an IO reference was not recording the filehandle for | |
2172 | S<C<-T _>> to use. | |
2173 | ||
2174 | =item * | |
2175 | ||
2176 | The presence of fatal warnings could cause the stat buffer not to be reset | |
2177 | for a filetest operator on an unopened filehandle or C<-l> on any handle. | |
2178 | ||
2179 | =item * | |
2180 | ||
2181 | Fatal warnings would stop C<-T> from setting C<$!>. | |
2182 | ||
2183 | =item * | |
2184 | ||
2185 | When the last stat was on an unreadable file, C<-T _> is supposed to | |
2186 | return C<undef>, leaving the last stat buffer unchanged. But it was | |
2187 | setting the stat type, causing C<lstat _> to stop working. | |
2188 | ||
2189 | =item * | |
2190 | ||
2191 | C<-T I<FILENAME>> was not resetting the internal stat buffers for | |
2192 | unreadable files. | |
2193 | ||
2194 | =back | |
2195 | ||
2196 | These have all been fixed. | |
2197 | ||
021c503d | 2198 | =item * |
cb82babd | 2199 | |
021c503d | 2200 | C<-T _> with no preceding C<stat> |
cb82babd RS |
2201 | |
2202 | This used to produce a confusing "uninitialized" warning, even though there | |
2203 | is no visible uninitialized value to speak of. | |
2204 | ||
021c503d RS |
2205 | =item * |
2206 | ||
2207 | C<stat I<HANDLE>> and fstat failures | |
cb82babd RS |
2208 | |
2209 | If the operating system's C<fstat> function failed, C<stat> would warn | |
2210 | about an unopened handle, even though that was not the case. This has been | |
2211 | fixed. | |
2212 | ||
021c503d RS |
2213 | =item * |
2214 | ||
2215 | C<lstat I<IOREF>> | |
cb82babd RS |
2216 | |
2217 | C<lstat> is documented to fall back to C<stat> (with a warning) when given | |
2218 | a filehandle. When passed an IO reference, it was actually doing the | |
2219 | equivalent of S<C<stat _>> and ignoring the handle. | |
2220 | ||
021c503d | 2221 | =item * |
cb82babd | 2222 | |
021c503d | 2223 | Bitwise assignment operators and copy-on-write |
cb82babd RS |
2224 | |
2225 | In 5.14.0, the bitwise assignment operators C<|=>, C<^=> and C<&=> started | |
2226 | leaving the left-hand side undefined if it happened to be a copy-on-write | |
2227 | string. This has been fixed [perl #108480]. | |
2228 | ||
021c503d RS |
2229 | =item * |
2230 | ||
2231 | Three problematic Unicode characters now work better in regex pattern matching under C</i> | |
cb82babd RS |
2232 | |
2233 | In the past, three Unicode characters: | |
2234 | LATIN SMALL LETTER SHARP S, | |
2235 | GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS, | |
2236 | and | |
2237 | GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS, | |
2238 | along with the sequences that they fold to | |
2239 | (including "ss" in the case of LATIN SMALL LETTER SHARP S), | |
2240 | did not properly match under C</i>. 5.14.0 fixed some of these cases, | |
2241 | but introduced others, including a panic when one of the characters or | |
2242 | sequences was used in the C<(?(DEFINE)> regular expression predicate. | |
2243 | The known bugs that were introduced in 5.14 have now been fixed; as well | |
2244 | as some other edge cases that have never worked until now. All these | |
2245 | involve using the characters and sequences outside bracketed character | |
2246 | classes under C</i>. This closes [perl #98546]. | |
2247 | ||
2248 | There remain known problems when using certain characters with | |
2249 | multi-character folds inside bracketed character classes, including such | |
2250 | constructs as C<qr/[\N{LATIN SMALL LETTER SHARP}a-z]/i>. These | |
2251 | remaining bugs are addressed in [perl #89774]. | |
2252 | ||
a14d7d4a RS |
2253 | =item * |
2254 | ||
412912b6 RS |
2255 | RT #78266: The regex engine has been leaking memory when accessing |
2256 | named captures that weren't matched as part of a regex ever since 5.10 | |
2257 | when they were introduced, e.g. this would consume over a hundred MB of | |
2258 | memory: | |
2259 | ||
2260 | for (1..10_000_000) { | |
2261 | if ("foo" =~ /(foo|(?<capture>bar))?/) { | |
2262 | my $capture = $+{capture} | |
2263 | } | |
2264 | } | |
2265 | system "ps -o rss $$"' | |
2266 | ||
2267 | =item * | |
2268 | ||
2269 | A constant subroutine assigned to a glob whose name contains a null | |
2270 | will no longer cause extra globs to pop into existence when the | |
2271 | constant is referenced under its new name. | |
2272 | ||
2273 | =item * | |
2274 | ||
2275 | C<sort> was not treating C<sub {}> and C<sub {()}> as equivalent when | |
2276 | such a sub was provided as the comparison routine. It used to croak on | |
2277 | C<sub {()}>. | |
2278 | ||
2279 | =item * | |
2280 | ||
2281 | Subroutines from the C<autouse> namespace are once more exempt from | |
2282 | redefinition warnings. This used to work in 5.005, but was broken in | |
2283 | 5.6 for most subroutines. For subs created via XS that redefine | |
2284 | subroutines from the C<autouse> package, this stopped working in 5.10. | |
2285 | ||
2286 | =item * | |
2287 | ||
2288 | New XSUBs now produce redefinition warnings if they overwrite existing | |
2289 | subs, as they did in 5.8.x. (The C<autouse> logic was reversed in | |
2290 | 5.10-14. Only subroutines from the C<autouse> namespace would warn | |
2291 | when clobbered.) | |
2292 | ||
2293 | =item * | |
2294 | ||
412912b6 RS |
2295 | C<newCONSTSUB> used to use compile-time warning hints, instead of |
2296 | run-time hints. The following code should never produce a redefinition | |
2297 | warning, but it used to, if C<newCONSTSUB> redefined an existing | |
2298 | subroutine: | |
2299 | ||
2300 | use warnings; | |
2301 | BEGIN { | |
2302 | no warnings; | |
2303 | some_XS_function_that_calls_new_CONSTSUB(); | |
2304 | } | |
2305 | ||
2306 | =item * | |
2307 | ||
2308 | Redefinition warnings for constant subroutines are on by default (what | |
2309 | are known as severe warnings in L<perldiag>). This was only the case | |
2310 | when it was a glob assignment or declaration of a Perl subroutine that | |
2311 | caused the warning. If the creation of XSUBs triggered the warning, it | |
2312 | was not a default warning. This has been corrected. | |
2313 | ||
2314 | =item * | |
2315 | ||
2316 | The internal check to see whether a redefinition warning should occur | |
2317 | used to emit "uninitialized" warnings in cases like this: | |
2318 | ||
2319 | use warnings "uninitialized"; | |
2320 | use constant {u => undef, v => undef}; | |
2321 | sub foo(){u} | |
2322 | sub foo(){v} | |
2323 | ||
2324 | =item * | |
2325 | ||
2326 | A bug fix in Perl 5.14 introduced a new bug, causing "uninitialized" | |
2327 | warnings to report the wrong variable if the operator in question had | |
2328 | two operands and one was C<%{...}> or C<@{...}>. This has been fixed | |
2329 | [perl #103766]. | |
2330 | ||
2331 | =item * | |
2332 | ||
2333 | C<< version->new("version") >> and C<printf "%vd", "version"> no longer | |
2334 | crash [perl #102586]. | |
2335 | ||
2336 | =item * | |
2337 | ||
2338 | C<$tied =~ y/a/b/>, C<chop $tied> and C<chomp $tied> now call FETCH | |
2339 | just once when $tied holds a reference. | |
2340 | ||
2341 | =item * | |
2342 | ||
2343 | Four-argument C<select> now always calls FETCH on tied arguments. It | |
2344 | used to skip the call if the tied argument happened to hold C<undef> or | |
2345 | a typeglob. | |
2346 | ||
2347 | =item * | |
2348 | ||
2349 | Four-argument C<select> no longer produces its "Non-string passed as | |
2350 | bitmask" warning on tied or tainted variables that are strings. | |
2351 | ||
2352 | =item * | |
2353 | ||
2354 | C<sysread> now always calls FETCH on the buffer passed to it if the | |
2355 | buffer is tied. It used to skip the call if the tied variable happened | |
2356 | to hold a typeglob. | |
2357 | ||
2358 | =item * | |
2359 | ||
2360 | C<< $tied .= <> >> now calls FETCH once on C<$tied>. It used to call | |
2361 | it multiple times if the last value assigned to or returned from the | |
2362 | tied variable was anything other than a string or typeglob. | |
2363 | ||
2364 | =item * | |
2365 | ||
021c503d RS |
2366 | Return value of C<eval> |
2367 | ||
2368 | C<eval> returns C<undef> in scalar context or an empty list in list | |
2369 | context when there is a run-time error. When C<eval> was passed a | |
2370 | string in list context and a syntax error occurred, it used to return a | |
2371 | list containing a single undefined element. Now it returns an empty | |
2372 | list in list context for all errors [perl #80630]. | |
412912b6 RS |
2373 | |
2374 | =item * | |
2375 | ||
2376 | C<goto &func> no longer crashes, but produces an error message, when | |
2377 | the unwinding of the current subroutine's scope fires a destructor that | |
2378 | undefines the subroutine being "goneto" [perl #99850]. | |
2379 | ||
2380 | =item * | |
2381 | ||
2382 | Arithmetic assignment (C<$left += $right>) involving overloaded objects | |
2383 | that rely on the 'nomethod' override no longer segfault when the left | |
2384 | operand is not overloaded. | |
2385 | ||
2386 | =item * | |
2387 | ||
2388 | Assigning C<__PACKAGE__> or any other shared hash key scalar to a stash | |
2389 | element no longer causes a double free. Regardless of this change, the | |
2390 | results of such assignments are still undefined. | |
2391 | ||
2392 | =item * | |
2393 | ||
2394 | Assigning C<__PACKAGE__> or another shared hash key string to a | |
2395 | variable no longer stops that variable from being tied if it happens to | |
2396 | be a PVMG or PVLV internally. | |
2397 | ||
2398 | =item * | |
2399 | ||
2400 | Creating a C<UNIVERSAL::AUTOLOAD> sub no longer stops C<%+>, C<%-> and | |
2401 | C<%!> from working some of the time [perl #105024]. | |
2402 | ||
2403 | =item * | |
2404 | ||
2405 | When presented with malformed UTF-8 input, the XS-callable functions | |
2406 | C<is_utf8_string()>, C<is_utf8_string_loc()>, and | |
2407 | C<is_utf8_string_loclen()> could read beyond the end of the input | |
2408 | string by up to 12 bytes. This no longer happens. [perl #32080]. | |
2409 | However, currently, C<is_utf8_char()> still has this defect, see | |
2410 | L</is_utf8_char()> above. | |
2411 | ||
2412 | =item * | |
2413 | ||
2414 | Doing a substitution on a tied variable returning a copy-on-write | |
2415 | scalar used to cause an assertion failure or an "Attempt to free | |
2416 | nonexistent shared string" warning. | |
2417 | ||
2418 | =item * | |
2419 | ||
412912b6 RS |
2420 | The debugger no longer tries to do C<local $_> when dumping data |
2421 | structures. | |
2422 | ||
2423 | =item * | |
2424 | ||
2425 | Calling C<readline($fh)> where $fh is a glob copy (e.g., after C<$fh = | |
2426 | *STDOUT>), assigning something other than a glob to $fh, and then | |
2427 | freeing $fh (e.g., by leaving the scope where it is defined) no longer | |
2428 | causes the internal variable used by C<$.> (C<PL_last_in_gv>) to point | |
2429 | to a freed scalar, that could be reused for some other glob, causing | |
2430 | C<$.> to use some unrelated filehandle [perl #97988]. | |
2431 | ||
2432 | =item * | |
2433 | ||
2434 | A regression in 5.14 caused these statements not to set the internal | |
2435 | variable that holds the handle used by C<$.>: | |
2436 | ||
2437 | my $fh = *STDOUT; | |
2438 | tell $fh; | |
2439 | eof $fh; | |
2440 | seek $fh, 0,0; | |
2441 | tell *$fh; | |
2442 | eof *$fh; | |
2443 | seek *$fh, 0,0; | |
2444 | readline *$fh; | |
2445 | ||
2446 | This is now fixed, but C<tell *{ *$fh }> still has the problem, and it | |
2447 | is not clear how to fix it [perl #106536]. | |
2448 | ||
2449 | =item * | |
2450 | ||
2451 | Version comparisons, such as those that happen implicitly with C<use | |
2452 | v5.43>, no longer cause locale settings to change [perl #105784]. | |
2453 | ||
2454 | =item * | |
2455 | ||
b325a3a2 RS |
2456 | Perl now holds an extra reference count on the package that code is |
2457 | currently compiling in. This means that the following code no longer crashes [perl #101486]: | |
2458 | ||
2459 | package Foo; | |
2460 | BEGIN {*Foo:: = *Bar::} | |
2461 | sub foo; | |
2462 | ||
2463 | =item * | |
2464 | ||
2465 | F<dumpvar.pl>, and consequently the C<x> command in the debugger, have been | |
2466 | fixed to handle objects blessed into classes whose names contain "=". The | |
2467 | contents of such objects used not to be dumped [perl #101814]. | |
2468 | ||
2469 | =item * | |
2470 | ||
2471 | The C<x> repetition operator no longer crashes on 64-bit builds with large | |
2472 | repeat counts [perl #94560]. | |
2473 | ||
2474 | =item * | |
2475 | ||
b325a3a2 RS |
2476 | On OSes other than VMS, Perl's C<glob> operator (and the C<< <...> >> form) |
2477 | use L<File::Glob> underneath. L<File::Glob> splits the pattern into words, | |
2478 | before feeding each word to its C<bsd_glob> function. | |
2479 | ||
2480 | There were several inconsistencies in the way the split was done. Now | |
2481 | quotation marks (' and ") are always treated as shell-style word delimiters | |
2482 | (that allow whitespace as part of a word) and backslashes are always | |
2483 | preserved, unless they exist to escape quotation marks. Before, those | |
2484 | would only sometimes be the case, depending on whether the pattern | |
2485 | contained whitespace. Also, escaped whitespace at the end of the pattern | |
2486 | is no longer stripped [perl #40470]. | |
2487 | ||
2488 | =item * | |
2489 | ||
2490 | C<CORE::glob> now works as a way to call the default globbing function. It | |
2491 | used to respect overrides, despite the C<CORE::> prefix. | |
2492 | ||
2493 | =item * | |
2494 | ||
2495 | In 5.14, C</[[:lower:]]/i> and C</[[:upper:]]/i> no longer matched the | |
2496 | opposite case. This has been fixed [perl #101970]. | |
2497 | ||
2498 | =item * | |
2499 | ||
2500 | A regular expression match with an overloaded object on the right-hand side | |
2501 | would in some cases stringify the object too many times. | |
2502 | ||
2503 | =item * | |
2504 | ||
2505 | The C-level C<pregcomp> function could become confused as to whether the | |
2506 | pattern was in UTF8 if the pattern was an overloaded, tied, or otherwise | |
2507 | magical scalar [perl #101940]. | |
2508 | ||
2509 | =item * | |
2510 | ||
2511 | A regression has been fixed that was introduced in 5.14, in C</i> | |
2512 | regular expression matching, in which a match improperly fails if the | |
2513 | pattern is in UTF-8, the target string is not, and a Latin-1 character | |
2514 | precedes a character in the string that should match the pattern. [perl | |
2515 | #101710] | |
2516 | ||
2517 | =item * | |
2518 | ||
b325a3a2 RS |
2519 | Weak references to lexical hashes going out of scope were not going stale |
2520 | (becoming undefined), but continued to point to the hash. | |
2521 | ||
2522 | =item * | |
2523 | ||
2524 | Weak references to lexical variables going out of scope are now broken | |
2525 | before any magical methods (e.g., DESTROY on a tie object) are called. | |
2526 | This prevents such methods from modifying the variable that will be seen | |
2527 | the next time the scope is entered. | |
2528 | ||
2529 | =item * | |
2530 | ||
2531 | A C<keys> optimisation in Perl 5.12.0 to make it faster on empty hashes | |
2532 | caused C<each> not to reset the iterator if called after the last element | |
2533 | was deleted. This has been fixed. | |
2534 | ||
2535 | =item * | |
2536 | ||
2537 | The C<#line 42 foo> directive used not to update the arrays of lines used | |
2538 | by the debugger if it occurred in a string eval. This was partially fixed | |
2539 | in 5.14, but it only worked for a single C<#line 42 foo> in each eval. Now | |
2540 | it works for multiple. | |
2541 | ||
2542 | =item * | |
2543 | ||
2544 | String eval used not to localise C<%^H> when compiling its argument if it | |
2545 | was empty at the time the C<eval> call itself was compiled. This could | |
2546 | lead to scary side effects, like C<use re "/m"> enabling other flags that | |
2547 | the surrounding code was trying to enable for its caller [perl #68750]. | |
2548 | ||
2549 | =item * | |
2550 | ||
2551 | Creating a BEGIN block from XS code (via C<newXS> or C<newATTRSUB>) would, | |
2552 | on completion, make the hints of the current compiling code the current | |
2553 | hints. This could cause warnings to occur in a non-warning scope. | |
2554 | ||
2555 | =item * | |
2556 | ||
2557 | C<eval $string> and C<require> no longer localise hints (C<$^H> and C<%^H>) | |
2558 | at run time, but only during compilation of the $string or required file. | |
2559 | This makes C<BEGIN { $^H{foo}=7 }> equivalent to | |
2560 | C<BEGIN { eval '$^H{foo}=7' }> [perl #70151]. | |
2561 | ||
2562 | =item * | |
2563 | ||
2564 | When subroutine calls are intercepted by the debugger, the name of the | |
2565 | subroutine or a reference to it is stored in C<$DB::sub>, for the debugger | |
2566 | to access. In some cases (such as C<$foo = *bar; undef *bar; &$foo>) | |
2567 | C<$DB::sub> would be set to a name that could not be used to find the | |
2568 | subroutine, and so the debugger's attempt to call it would fail. Now the | |
2569 | check to see whether a reference is needed is more robust, so those | |
2570 | problems should not happen anymore [rt.cpan.org #69862]. | |
2571 | ||
2572 | =item * | |
2573 | ||
2574 | Localising a tied scalar that returns a typeglob no longer stops it from | |
2575 | being tied till the end of the scope. | |
2576 | ||
2577 | =item * | |
2578 | ||
2579 | When C<open> is called with three arguments, the third being a file handle | |
2580 | (as in C<< open $fh, ">&", $fh2 >>), if the third argument is tied or a | |
2581 | reference to a tied variable, FETCH is now called exactly once, instead of | |
2582 | 0, 2, or 3 times (all of which could occur in various circumstances). | |
2583 | ||
2584 | =item * | |
2585 | ||
2586 | C<sort> no longer ignores FETCH when passed a reference to a tied glob for | |
2587 | the comparison routine. | |
2588 | ||
2589 | =item * | |
2590 | ||
2591 | Warnings emitted by C<sort> when a custom comparison routine returns a | |
2592 | non-numeric value now show the line number of the C<sort> operator, rather | |
2593 | than the last line of the comparison routine. The warnings also occur now | |
2594 | only if warnings are enabled in the scope where C<sort> occurs. Previously | |
2595 | the warnings would occur if enabled in the comparison routine's scope. | |
2596 | ||
2597 | =item * | |
2598 | ||
2599 | C<Internals::SvREFCNT> now behaves consistently in 'get' and 'set' scenarios | |
2600 | [perl #103222] and also treats the reference count as unsigned. | |
2601 | ||
2602 | =item * | |
2603 | ||
2604 | Calling C<require> on an implicit C<$_> when C<*CORE::GLOBAL::require> has | |
2605 | been overridden does not segfault anymore, and C<$_> is now passed to the | |
2606 | overriding subroutine [perl #78260]. | |
2607 | ||
2608 | =item * | |
2609 | ||
12477442 RS |
2610 | In Perl 5.14.0, C<$tainted ~~ @array> stopped working properly. Sometimes |
2611 | it would erroneously fail (when C<$tainted> contained a string that occurs | |
2612 | in the array I<after> the first element) or erroneously succeed (when | |
2613 | C<undef> occurred after the first element) [perl #93590]. | |
2614 | ||
2615 | =item * | |
2616 | ||
12477442 RS |
2617 | Functions in the CORE package can now be called as methods. That used to |
2618 | work only when they had been called or referenced already. So | |
2619 | C<< "foo"->CORE::ucfirst >> returns Foo. | |
2620 | ||
2621 | =item * | |
2622 | ||
2623 | C<use> and C<require> are no longer affected by the I/O layers active in | |
2624 | the caller's scope (enabled by L<open.pm|open>) [perl #96008]. | |
2625 | ||
2626 | =item * | |
2627 | ||
2628 | Errors that occur when methods cannot be found during overloading now | |
2629 | mention the correct package name, as they did in 5.8.x, instead of | |
2630 | erroneously mentioning the "overload" package, as they have since 5.10.0. | |
2631 | ||
2632 | =item * | |
2633 | ||
2634 | Undefining C<%overload::> no longer causes a crash. | |
2635 | ||
2636 | =item * | |
2637 | ||
2638 | C<our $::é; $é> (which is invalid) no longer produces the "Compilation | |
2639 | error at lib/utf8_heavy.pl..." error message, which it started emitting in | |
2640 | 5.10.0 [perl #99984]. | |
2641 | ||
2642 | =item * | |
2643 | ||
12477442 RS |
2644 | In case-insensitive regular expression pattern matching, no longer on |
2645 | UTF-8 encoded strings does the scan for the start of match only look at | |
2646 | the first possible position. This caused matches such as | |
2647 | C<"f\x{FB00}" =~ /ff/i> to fail. | |
2648 | ||
2649 | =item * | |
2650 | ||
2651 | On 64-bit systems, C<read()> now understands large string offsets beyond | |
2652 | the 32-bit range. | |
2653 | ||
2654 | =item * | |
2655 | ||
2656 | Errors that occur when processing subroutine attributes no longer cause the | |
2657 | subroutine's op tree to leak. | |
2658 | ||
2659 | =item * | |
2660 | ||
2661 | C<sort> now works once more with custom sort routines that are XSUBs. It | |
2662 | stopped working in 5.10.0. | |
2663 | ||
2664 | =item * | |
2665 | ||
2666 | C<sort> with a constant for a custom sort routine, although it produces | |
2667 | unsorted results, no longer crashes. It started crashing in 5.10.0. | |
2668 | ||
2669 | =item * | |
2670 | ||
2671 | Warnings produced when a custom sort routine returns a non-numeric value | |
2672 | now contain "in sort"; e.g., "Use of uninitialized value in sort". | |
2673 | ||
2674 | =item * | |
2675 | ||
2676 | C<< sort { $a <=> $b } >>, which is optimised internally, now produces | |
2677 | "uninitialized" warnings for NaNs (not-a-number values), since C<< <=> >> | |
2678 | returns C<undef> for those. This brings it in line with | |
2679 | S<C<< sort { 1; $a <=> $b } >>> and other more complex cases, which are not | |
2680 | optimised [perl #94390]. | |
2681 | ||
2682 | =item * | |
2683 | ||
2684 | C<..> and C<...> in list context now call FETCH only once on tied | |
2685 | arguments, instead of three or four times [perl #53554]. | |
2686 | ||
2687 | =item * | |
2688 | ||
2689 | C<..> and C<...> in list context now mention the name of the variable in | |
2690 | "uninitialized" warnings for string (as opposed to numeric) ranges. | |
2691 | ||
2692 | =item * | |
2693 | ||
a14d7d4a RS |
2694 | Passing the same constant subroutine to both C<index> and C<formline> no |
2695 | longer causes one or the other to fail [perl #89218]. (5.14.1) | |
2696 | ||
2697 | =item * | |
2698 | ||
2699 | List assignment to lexical variables declared with attributes in the same | |
2700 | statement (C<my ($x,@y) : blimp = (72,94)>) stopped working in Perl 5.8.0. | |
2701 | It has now been fixed. | |
2702 | ||
2703 | =item * | |
2704 | ||
2705 | Perl 5.10.0 introduced some faulty logic that made "U*" in the middle of | |
2706 | a pack template equivalent to "U0" if the input string was empty. This has | |
2707 | been fixed [perl #90160]. | |
2708 | ||
2709 | =item * | |
2710 | ||
2711 | Destructors on objects were not called during global destruction on objects | |
2712 | that were not referenced by any scalars. This could happen if an array | |
2713 | element were blessed (e.g., C<bless \$a[0]>) or if a closure referenced a | |
2714 | blessed variable (C<bless \my @a; sub foo { @a }>). | |
2715 | ||
2716 | Now there is an extra pass during global destruction to fire destructors on | |
2717 | any objects that might be left after the usual passes that check for | |
2718 | objects referenced by scalars [perl #36347]. | |
2719 | ||
2720 | This bug fix was added in Perl 5.13.9, but caused problems with some CPAN | |
2721 | modules that were relying on the bug. Since it was so close to Perl | |
2722 | 5.14.0, the fix was reverted in 5.13.10, to allow more time for the modules | |
2723 | to adapt. Hopefully they will be fixed soon (see L</Known Problems>, | |
2724 | below). | |
2725 | ||
2726 | =item * | |
2727 | ||
2728 | C<given> was not calling set-magic on the implicit lexical C<$_> that it | |
2729 | uses. This meant, for example, that C<pos> would be remembered from one | |
2730 | execution of the same C<given> block to the next, even if the input were a | |
2731 | different variable [perl #84526]. | |
2732 | ||
2733 | =item * | |
2734 | ||
2735 | The "R" command for restarting a debugger session has been fixed to work on | |
2736 | Windows, or any other system lacking a C<POSIX::_SC_OPEN_MAX> constant | |
2737 | [perl #87740]. | |
2738 | ||
2739 | =item * | |
2740 | ||
2741 | Fixed a case where it was possible that a freed buffer may have been read | |
2742 | from when parsing a here document [perl #90128]. (5.14.1) | |
2743 | ||
2744 | =item * | |
2745 | ||
2746 | The C<study> function could become confused if fed a string longer than | |
021c503d | 2747 | 2**31 characters. Now that it's a no-op, it can't. |
a14d7d4a RS |
2748 | |
2749 | =item * | |
2750 | ||
2751 | C<each(I<ARRAY>)> is now wrapped in C<defined(...)>, like C<each(I<HASH>)>, | |
2752 | inside a C<while> condition [perl #90888]. | |
2753 | ||
2754 | =item * | |
2755 | ||
2756 | In @INC filters (subroutines returned by subroutines in @INC), $_ used to | |
2757 | misbehave: If returned from a subroutine, it would not be copied, but the | |
2758 | variable itself would be returned; and freeing $_ (e.g., with C<undef *_>) | |
2759 | would cause perl to crash. This has been fixed [perl #91880]. | |
2760 | ||
2761 | =item * | |
2762 | ||
2763 | An ASCII single quote (') in a symbol name is meant to be equivalent to a | |
2764 | double colon (::) except at the end of the name. It was not equivalent if | |
2765 | followed by a null character, but now it is [perl #88138]. | |
2766 | ||
2767 | =item * | |
2768 | ||
021c503d RS |
2769 | The abbreviations for four C1 control characters C<MW> C<PM>, C<RI>, and |
2770 | C<ST> were previously unrecognized by C<\N{}>, vianame(), and | |
2771 | string_vianame(). | |
a14d7d4a RS |
2772 | |
2773 | =item * | |
2774 | ||
2775 | Some cases of threads crashing due to memory allocation during cloning have | |
2776 | been fixed [perl #90006]. | |
2777 | ||
2778 | =item * | |
2779 | ||
2780 | Attempting to C<goto> out of a tied handle method used to cause memory | |
2781 | corruption or crashes. Now it produces an error message instead | |
2782 | [perl #8611]. | |
2783 | ||
2784 | =item * | |
2785 | ||
2786 | Perl skips copying values returned from a subroutine if it thinks the value | |
2787 | is not in use elsewhere. Due to faulty logic, this would happen with the | |
2788 | result of C<delete>, C<shift> or C<splice>, even if the result was | |
2789 | referenced elsewhere. So C<< \sub { delete $_[0] }->($x) >> would return a | |
2790 | reference to C<$x>. This has been fixed [perl #91844]. | |
30682cc3 | 2791 | |
ccad93fd RS |
2792 | =item * |
2793 | ||
2794 | Applying the :lvalue attribute to subroutine that is already defined does | |
2795 | not work properly, as the attribute changes the way the sub is compiled. | |
2796 | Hence, Perl 5.12 began warning when an attempt is made to apply the | |
2797 | attribute to an already defined sub. In such cases, the attribute is | |
2798 | discarded. | |
2799 | ||
2800 | But the change in 5.12 missed the case where custom attributes are also | |
2801 | present: that case still silently and ineffectively applied the attribute. | |
2802 | That omission has now been corrected. C<sub foo :lvalue :Whatever> (when | |
2803 | C<foo> is already defined) now warns about the :lvalue attribute, and does | |
2804 | not apply it. | |
2805 | ||
2806 | L<attributes.pm|attributes> has likewise been updated to warn and not apply | |
2807 | the attribute. | |
2808 | ||
2809 | =item * | |
2810 | ||
2811 | The remaining discrepancies between explicit and implicit return from | |
2812 | lvalue subroutines have been resolved. They mainly involved which error | |
2813 | message to display when a read-only value is returned in lvalue context. | |
2814 | Also, returning a PADTMP (the result of most built-ins, like C<index>) in | |
2815 | lvalue context is now forbidden for explicit return, as it always has been | |
2816 | for implicit return. This is not a regression from 5.14, as all the cases | |
2817 | in which it could happen where previously syntax errors. | |
2818 | ||
2819 | =item * | |
2820 | ||
ccad93fd RS |
2821 | The C<prototype> function no longer dies for the C<__FILE__>, C<__LINE__> |
2822 | and C<__PACKAGE__> directives. It now returns an empty-string prototype | |
2823 | for them, because they are syntactically very similar to nullary functions | |
2824 | like C<time>. | |
2825 | ||
2826 | =item * | |
2827 | ||
2828 | C<prototype> now returns C<undef> for all overridable infix operators, | |
2829 | such as C<eq>, which are not callable in any way resembling functions. | |
2830 | It used to return incorrect prototypes for some and die for others | |
2831 | [perl #94984]. | |
2832 | ||
2833 | =item * | |
2834 | ||
2835 | A bug affecting lvalue context propagation through nested lvalue subroutine | |
2836 | calls has been fixed. Previously, returning a value in nested rvalue | |
2837 | context would be treated as lvalue context by the inner subroutine call, | |
2838 | resulting in some values (such as read-only values) being rejected. | |
2839 | ||
2840 | =item * | |
2841 | ||
2842 | Some core bugs affecting L<Hash::Util> have been fixed: locking a hash | |
2843 | element that is a glob copy no longer causes subsequent assignment to it to | |
2844 | corrupt the glob, and unlocking a hash element that holds a copy-on-write | |
2845 | scalar no longer causes modifications to that scalar to modify other | |
2846 | scalars that were sharing the same string buffer. | |
2847 | ||
2848 | =item * | |
2849 | ||
2850 | C<when> blocks are now capable of returning variables declared inside the | |
2851 | enclosing C<given> block [perl #93548]. | |
2852 | ||
2853 | =item * | |
2854 | ||
2855 | A problem with context propagation when a C<do> block is an argument to | |
2856 | C<return> has been fixed. It used to cause C<undef> to be returned in | |
2857 | some cases of a C<return> inside an C<if> block which itself is followed by | |
2858 | another C<return>. | |
2859 | ||
2860 | =item * | |
2861 | ||
2862 | Calling C<index> with a tainted constant no longer causes constants in | |
2863 | subsequently compiled code to become tainted [perl #64804]. | |
2864 | ||
2865 | =item * | |
2866 | ||
2867 | Use of lexical (C<my>) variables in code blocks embedded in regular | |
2868 | expressions will no longer result in memory corruption or crashes. | |
2869 | ||
2870 | Nevertheless, these code blocks are still experimental, as there are still | |
2871 | problems with the wrong variables being closed over (in loops for instance) | |
2872 | and with abnormal exiting (e.g., C<die>) causing memory corruption. | |
2873 | ||
2874 | =item * | |
2875 | ||
2876 | The C<SvIsCOW> C macro now returns false for read-only copies of typeglobs, | |
2877 | such as those created by: | |
2878 | ||
2879 | $hash{elem} = *foo; | |
2880 | Hash::Util::lock_value %hash, 'elem'; | |
2881 | ||
2882 | It used to return true. | |
2883 | ||
2884 | =item * | |
2885 | ||
2886 | Assignment to C<$^A> (the format output accumulator) now recalculates | |
2887 | the number of lines output. | |
2888 | ||
2889 | =item * | |
2890 | ||
2891 | The regexp optimiser no longer crashes on debugging builds when merging | |
2892 | fixed-string nodes with inconvenient contents. | |
2893 | ||
94c11dd4 RS |
2894 | =item * |
2895 | ||
2896 | Locking a subroutine (via C<lock &sub>) is no longer a compile-time error | |
2897 | for regular subs. For lvalue subroutines, it no longer tries to return the | |
2898 | sub as a scalar, resulting in strange side effects like C<ref \$_> | |
2899 | returning "CODE" in some instances. | |
2900 | ||
2901 | C<lock &sub> is now a run-time error if L<threads::shared> is loaded (a | |
2902 | no-op otherwise), but that may be rectified in a future version. | |
2903 | ||
2904 | =item * | |
2905 | ||
2906 | The prototypes of several built-in functions--C<getprotobynumber>, C<lock>, | |
2907 | C<not> and C<select>--have been corrected, or at least are now closer to | |
2908 | reality than before. | |
2909 | ||
2910 | =item * | |
2911 | ||
2912 | Most dereferencing operators (C<${}>, etc.) used to call C<FETCH> twice on | |
2913 | a tied operand when doing a symbolic dereference (looking up a variable by | |
2914 | name, which is not permitted under C<use strict 'refs'>). Only C<&{}> did | |
2915 | not have this problem. This has been fixed. | |
2916 | ||
2917 | =item * | |
2918 | ||
94c11dd4 RS |
2919 | A panic involving the combination of the regular expression modifiers |
2920 | C</aa> and the C<\b> escape sequence introduced in 5.14.0 has been | |
2921 | fixed [perl #95964]. | |
2922 | ||
2923 | =item * | |
2924 | ||
2925 | stat() would always return the inode number as an IV, even when the | |
2926 | original was unsigned, or too large to fit in an IV. stat() now | |
2927 | returns the inode number as the type that would best preserve the | |
2928 | original value. [perl #84590] | |
2929 | ||
2930 | =item * | |
2931 | ||
2932 | The combination of the regular expression modifiers C</aa> and the C<\b> | |
2933 | and C<\B> escape sequences did not work properly on UTF-8 encoded | |
2934 | strings. All non-ASCII characters under C</aa> should be treated as | |
2935 | non-word characters, but what was happening was that Unicode rules were | |
2936 | used to determine wordness/non-wordness for non-ASCII characters. This | |
2937 | is now fixed [perl #95968]. | |
2938 | ||
2939 | =item * | |
2940 | ||
2941 | Infinite loops like C<1 while 1> used to stop C<strict 'subs'> mode from | |
2942 | working for the rest of the block.t | |
2943 | ||
2944 | =item * | |
2945 | ||
2946 | The C<\h>, C<\H>, C<\v> and C<\V> regular expression metacharacters used to | |
2947 | cause a panic error message when attempting to match at the end of the | |
2948 | string [perl #96354]. | |
2949 | ||
2950 | =item * | |
2951 | ||
2952 | For list assignments like C<($a,$b) = ($b,$a)>, Perl has to make a copy of | |
2953 | the items on the right-hand side before assignment them to the left. For | |
2954 | efficiency's sake, it assigns the values on the right straight to the items | |
2955 | on the left no variable is mentioned on both sides, as in | |
2956 | C<($a,$b) = ($c,$d)>. The logic for determining when it can cheat was | |
2957 | faulty, in that C<&&> and C<||> on the right-hand side could fool it. So | |
2958 | C<($a,$b) = $some_true_value && ($b,$a)> would end up assigning the value | |
2959 | of C<$b> to both scalars. | |
2960 | ||
2961 | =item * | |
2962 | ||
2963 | Perl no longer tries to apply lvalue context to the string in | |
2964 | C<("string", $variable) ||= 1> (which used to be an error). Since the | |
2965 | left-hand side of C<||=> is evaluated in scalar context, that's a scalar | |
2966 | comma operator, which gives all but the last item void context. There is | |
2967 | no such thing as void lvalue context, so it was a mistake for Perl to try | |
2968 | to force it [perl #96942]. | |
2969 | ||
2970 | =item * | |
2971 | ||
2972 | Every subroutine has a filename associated with it, that the debugger uses. | |
2973 | The one associated with constant subroutines used to be misallocated when | |
2974 | cloned under threads. Consequently, debugging threaded applications could | |
2975 | result in memory corruption [perl #96126]. | |
2976 | ||
2977 | =item * | |
2978 | ||
2979 | C<caller> no longer leaks memory when called from the DB package if | |
2980 | C<@DB::args> was assigned to after the first call to C<caller>. L<Carp> | |
2981 | was triggering this bug [perl #97010]. | |
2982 | ||
4bbade93 | 2983 | =item * |
30682cc3 | 2984 | |
4bbade93 RS |
2985 | C<defined(${"..."})>, C<defined(*{"..."})>, etc., used to |
2986 | return true for most, but not all built-in variables, if | |
2987 | they had not been used yet. Many times that new built-in | |
2988 | variables were added in past versions, this construct was | |
2989 | not taken into account, so this affected C<${^GLOBAL_PHASE}> and | |
2990 | C<${^UTF8CACHE}>, among others. It also used to return false if the | |
2991 | package name was given as well (C<${"::!"}>) and for subroutines in the | |
2992 | CORE package [perl #97978] [perl #97492] [perl #97484]. | |
2993 | ||
2994 | =item * | |
2995 | ||
2996 | Perl 5.10.0 introduced a similar bug: C<defined(*{"foo"})> where "foo" | |
2997 | represents the name of a built-in global variable used to return false if | |
2998 | the variable had never been used before, but only on the I<first> call. | |
2999 | This, too, has been fixed. | |
3000 | ||
3001 | =item * | |
3002 | ||
3003 | Various functions that take a filehandle argument in rvalue context | |
3004 | (C<close>, C<readline>, etc.) used to call C<FETCH> multiple times, if it | |
3005 | was a tied variable, and warn twice, if it was C<undef> [perl #97482]. | |
3006 | ||
3007 | =item * | |
3008 | ||
3009 | C<close> and similar filehandle functions, when called on built-in global | |
3010 | variables (like C<$+>), used to die if the variable happened to hold the | |
3011 | undefined value, instead of producing the usual "Use of uninitialized | |
3012 | value" warning. | |
3013 | ||
3014 | =item * | |
3015 | ||
3016 | When autovivified file handles were introduced in Perl 5.6.0, C<readline> | |
3017 | was inadvertently made to autovivify when called as C<readline($foo)> (but | |
3018 | not as C<E<lt>$fooE<gt>>). It has now been fixed never to autovivify. | |
3019 | ||
3020 | =item * | |
3021 | ||
3022 | C<defined ${ $tied_variable }> used to call C<FETCH> multiple times, but | |
3023 | now calls it just once. | |
3024 | ||
3025 | =item * | |
3026 | ||
3027 | Some cases of dereferencing a complex expression, such as | |
3028 | C<${ (), $tied } = 1>, used to call C<FETCH> multiple times, but now call | |
3029 | it once. | |
3030 | ||
3031 | =item * | |
3032 | ||
3033 | For a tied variable returning a package name, C<$tied-E<gt>method> used to | |
3034 | call C<FETCH> multiple times (even up to six!), and sometimes would | |
3035 | fail to call the method, due to memory corruption. | |
3036 | ||
3037 | =item * | |
3038 | ||
3039 | Calling an undefined anonymous subroutine (e.g., what $x holds after | |
3040 | C<undef &{$x = sub{}}>) used to cause a "Not a CODE reference" error, which | |
3041 | has been corrected to "Undefined subroutine called" [perl #71154]. | |
3042 | ||
3043 | =item * | |
3044 | ||
3045 | Causing C<@DB::args> to be freed between uses of C<caller> no longer | |
3046 | results in a crash [perl #93320]. | |
3047 | ||
3048 | =item * | |
3049 | ||
3050 | Since 5.6.0, C<*{ ... }> has been inconsistent in how it treats undefined | |
3051 | values. It would die in strict mode or lvalue context for most undefined | |
3052 | values, but would be treated as the empty string (with a warning) for the | |
3053 | specific scalar return by C<undef()> (C<&PL_sv_undef> internally). This | |
3054 | has been corrected. C<undef()> is now treated like other undefined | |
3055 | scalars, as in Perl 5.005. | |
3056 | ||
3057 | =item * | |
3058 | ||
3059 | It used to be possible to free the typeglob of a localised array or hash | |
3060 | (e.g., C<local @{"x"}; delete $::{x}>), resulting in a crash on scope exit. | |
3061 | ||
3062 | =item * | |
3063 | ||
3064 | C<setpgrp($foo)> used to be equivalent to C<($foo, setpgrp)>, because | |
3065 | C<setpgrp> was ignoring its argument if there was just one. Now it is | |
3066 | equivalent to C<setpgrp($foo,0)>. | |
3067 | ||
3068 | =item * | |
30682cc3 | 3069 | |
4bbade93 RS |
3070 | Assignments like C<*$tied = \&{"..."}> and C<*glob = $tied> now call FETCH |
3071 | only once. | |
30682cc3 | 3072 | |
4bbade93 RS |
3073 | =item * |
3074 | ||
3075 | C<chdir>, C<chmod>, C<chown>, C<utime>, C<truncate>, C<stat>, C<lstat> and | |
3076 | the filetest ops (C<-r>, C<-x>, etc.) now always call FETCH if passed a tied | |
3077 | variable as the last argument. They used to ignore tiedness if the last | |
3078 | thing return from or assigned to the variable was a typeglob or reference | |
3079 | to a typeglob. | |
3080 | ||
3081 | =item * | |
3082 | ||
4bbade93 RS |
3083 | If things were arranged in memory the right way, it was possible for |
3084 | thread joining to emit "Attempt to free unreferenced scalar" warnings if | |
3085 | C<caller> had been used from the C<DB> package prior to thread creation, | |
3086 | due to the way pads were reference-counted and cloned [perl #98092]. | |
3087 | ||
3088 | =item * | |
3089 | ||
3090 | CORE:: subs were introduced in the previous development release, but | |
3091 | C<defined &{"CORE::..."}> did not return true. That has been rectified | |
3092 | [perl #97484]. | |
3093 | ||
3094 | =item * | |
3095 | ||
4bbade93 RS |
3096 | A bug has been fixed that occurs when a tied variable is used as a |
3097 | subroutine reference: if the last thing assigned to or returned from the | |
3098 | variable was a reference or typeglob, the C<\&$tied> could either crash or | |
3099 | return the wrong subroutine. The reference case is a regression introduced | |
3100 | in Perl 5.10.0. For typeglobs, it has probably never worked till now. | |
3101 | ||
3102 | =item * | |
30682cc3 | 3103 | |
4bbade93 RS |
3104 | C<given> was not scoping its implicit $_ properly, resulting in memory |
3105 | leaks or "Variable is not available" warnings [perl #94682]. | |
3106 | ||
3107 | =item * | |
3108 | ||
3109 | C<-l> followed by a bareword no longer "eats" the previous argument to | |
3110 | the list operator in whose argument list it resides. In less convoluted | |
3111 | English: C<print "bar", -l foo> now actually prints "bar", because C<-l> | |
3112 | on longer eats it. | |
3113 | ||
3114 | =item * | |
3115 | ||
3116 | In 5.14.0, filetest ops (C<-r>, C<-x>, etc.) started calling FETCH on a | |
3117 | tied argument belonging to the previous argument to a list operator, if | |
3118 | called with a bareword argument or no argument at all. This has been | |
3119 | fixed, so C<push @foo, $tied, -r> no longer calls FETCH on C<$tied>. | |
3120 | ||
3121 | =item * | |
3122 | ||
3123 | C<shmread> was not setting the scalar flags correctly when reading from | |
3124 | shared memory, causing the existing cached numeric representation in the | |
3125 | scalar to persist [perl #98480]. | |
3126 | ||
3127 | =item * | |
3128 | ||
3129 | Weakening the first argument to an automatically-invoked C<DESTROY> method | |
3130 | could result in erroneous "DESTROY created new reference" errors or | |
3131 | crashes. Now it is an error to weaken a read-only reference. | |
3132 | ||
3133 | =item * | |
3134 | ||
3135 | Under miniperl (used to configure modules when perl itself is built), | |
3136 | C<glob> now clears %ENV before calling csh, since the latter croaks on some | |
3137 | systems if it does not like the contents of the LS_COLORS enviroment | |
3138 | variable [perl #98662]. | |
3139 | ||
3140 | =item * | |
3141 | ||
3142 | C<++> and C<--> now work on copies of globs, instead of dying. | |
3143 | ||
3144 | =item * | |
3145 | ||
3146 | The subroutines in the CORE:: namespace that were introduced in the | |
3147 | previous development release run with the lexical hints (strict, warnings) | |
3148 | of the caller, just as though the built-in function had been called. But | |
3149 | this was not the case for C<goto &CORE::sub>. The CORE sub would end up | |
3150 | running with the lexical hints of the subroutine it replaced, instead of | |
3151 | that subroutine's caller. This has been fixed. | |
3152 | ||
3153 | =item * | |
3154 | ||
3155 | Stacked C<-l> (followed immediately by other filetest operators) did not | |
3156 | work previously; now it does. It is only permitted when the rightmost | |
3157 | filetest op has the special "_" handle for its argument and the most | |
3158 | recent C<stat>/C<lstat> call was an C<lstat>. | |
3159 | ||
3160 | =item * | |
3161 | ||
3162 | In Perl 5.6, C<-l> followed by anything other than a bareword would treat | |
3163 | its argument as a file name. That was changed in 5.8 for glob references | |
3164 | (C<\*foo>), but not for globs themselves (C<*foo>). C<-l> started | |
3165 | returning C<undef> for glob references without setting the last | |
3166 | stat buffer that the "_" handle uses, but only if warnings | |
3167 | were turned on. With warnings off, it was the same as 5.6. | |
3168 | In other words, it was simply buggy and inconsistent. Now the 5.6 | |
3169 | behaviour has been restored. | |
3170 | ||
021c503d RS |
3171 | =item * |
3172 | ||
3173 | C<splice()> doesn't warn when truncating | |
3174 | ||
3175 | You can now limit the size of an array using C<splice(@a,MAX_LEN)> without | |
3176 | worrying about warnings. | |
3177 | ||
4bbade93 RS |
3178 | =back |
3179 | ||
3180 | =head1 Known Problems | |
30682cc3 RS |
3181 | |
3182 | =over 4 | |
3183 | ||
3184 | =item * | |
3185 | ||
4bbade93 RS |
3186 | We have a failing test in F<op/sigdispatch.t> on i386-netbsd 3.1 |
3187 | ||
3188 | =item * | |
3189 | ||
3190 | On Solaris, we have two kinds of failure. | |
3191 | ||
3192 | If F<make> is Sun's F<make≥>, we get an error about a badly formed macro | |
3193 | assignment in the F<Makefile>. That happens when F<./Configure> tries to | |
3194 | make depends. F<Configure> then exits 0, but further F<make>-ing fails. | |
3195 | ||
3196 | If F<make> is F<gmake>, F<Configure> completes, then we get errors related | |
3197 | to F</usr/include/stdbool.h> | |
30682cc3 RS |
3198 | |
3199 | =back | |
3200 | ||
3201 | =head1 Obituary | |
3202 | ||
3203 | XXX If any significant core contributor has died, we've added a short obituary | |
3204 | here. | |
3205 | ||
3206 | =head1 Acknowledgements | |
3207 | ||
3208 | XXX Generate this with: | |
3209 | ||
021c503d | 3210 | perl Porting/acknowledgements.pl v5.14.0..HEAD |
30682cc3 RS |
3211 | |
3212 | =head1 Reporting Bugs | |
3213 | ||
3214 | If you find what you think is a bug, you might check the articles | |
3215 | recently posted to the comp.lang.perl.misc newsgroup and the perl | |
021c503d RS |
3216 | bug database at L<http://rt.perl.org/perlbug/>. There may also be |
3217 | information at L<http://www.perl.org/>, the Perl Home Page. | |
30682cc3 RS |
3218 | |
3219 | If you believe you have an unreported bug, please run the L<perlbug> | |
3220 | program included with your release. Be sure to trim your bug down | |
3221 | to a tiny but sufficient test case. Your bug report, along with the | |
3222 | output of C<perl -V>, will be sent off to perlbug@perl.org to be | |
3223 | analysed by the Perl porting team. | |
3224 | ||
3225 | If the bug you are reporting has security implications, which make it | |
021c503d RS |
3226 | inappropriate to send to a publicly archived mailing list, then please |
3227 | send it to perl5-security-report@perl.org. This points to a closed | |
3228 | subscription unarchived mailing list, which includes all the core | |
3229 | committers, who will be able to help assess the impact of issues, figure | |
3230 | out a resolution, and help co-ordinate the release of patches to | |
3231 | mitigate or fix the problem across all platforms on which Perl is | |
3232 | supported. Please only use this address for security issues in the Perl | |
3233 | core, not for modules independently distributed on CPAN. | |
30682cc3 RS |
3234 | |
3235 | =head1 SEE ALSO | |
3236 | ||
3237 | The F<Changes> file for an explanation of how to view exhaustive details | |
3238 | on what changed. | |
3239 | ||
3240 | The F<INSTALL> file for how to build Perl. | |
3241 | ||
3242 | The F<README> file for general stuff. | |
3243 | ||
3244 | The F<Artistic> and F<Copying> files for copyright information. | |
3245 | ||
3246 | =cut |