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