Commit | Line | Data |
---|---|---|
44691e6f AB |
1 | =encoding utf8 |
2 | ||
3 | =head1 NAME | |
4 | ||
05c8f9ed | 5 | perldelta - what is new for perl v5.16.0 |
2630d42b | 6 | |
05c8f9ed RS |
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 | As described in L<perlpolicy>, the release of Perl 5.16.0 marks the | |
19 | official end of support for Perl 5.12. Users of Perl 5.12 or earlier | |
20 | should consider upgrading to a more recent release of Perl. | |
21 | ||
22 | =head1 Core Enhancements | |
23 | ||
24 | =head2 C<use I<VERSION>> | |
25 | ||
26 | As of this release, version declarations like C<use v5.16> now disable | |
27 | all features before enabling the new feature bundle. This means that | |
28 | the following holds true: | |
29 | ||
30 | use 5.016; | |
31 | # only 5.16 features enabled here | |
32 | use 5.014; | |
33 | # only 5.14 features enabled here (not 5.16) | |
34 | ||
35 | C<use v5.12> and higher continue to enable strict, but explicit C<use | |
36 | strict> and C<no strict> now override the version declaration, even | |
37 | when they come first: | |
38 | ||
39 | no strict; | |
40 | use 5.012; | |
41 | # no strict here | |
42 | ||
43 | There is a new ":default" feature bundle that represents the set of | |
44 | features enabled before any version declaration or C<use feature> has | |
45 | been seen. Version declarations below 5.10 now enable the ":default" | |
46 | feature set. This does not actually change the behaviour of C<use | |
47 | v5.8>, because features added to the ":default" set are those that were | |
48 | traditionally enabled by default, before they could be turned off. | |
49 | ||
50 | C<< no feature >> now resets to the default feature set. To disable all | |
51 | features (which is likely to be a pretty special-purpose request, since | |
52 | it presumably won't match any named set of semantics) you can now | |
53 | write C<< no feature ':all' >>. | |
54 | ||
55 | C<$[> is now disabled under C<use v5.16>. It is part of the default | |
56 | feature set and can be turned on or off explicitly with C<use feature | |
57 | 'array_base'>. | |
58 | ||
59 | =head2 C<__SUB__> | |
60 | ||
61 | The new C<__SUB__> token, available under the C<current_sub> feature | |
62 | (see L<feature>) or C<use v5.16>, returns a reference to the current | |
63 | subroutine, making it easier to write recursive closures. | |
64 | ||
65 | =head2 New and Improved Built-ins | |
66 | ||
67 | =head3 More consistent C<eval> | |
68 | ||
69 | The C<eval> operator sometimes treats a string argument as a sequence of | |
70 | characters and sometimes as a sequence of bytes, depending on the | |
71 | internal encoding. The internal encoding is not supposed to make any | |
72 | difference, but there is code that relies on this inconsistency. | |
73 | ||
74 | The new C<unicode_eval> and C<evalbytes> features (enabled under C<use | |
75 | 5.16.0>) resolve this. The C<unicode_eval> feature causes C<eval | |
76 | $string> to treat the string always as Unicode. The C<evalbytes> | |
77 | features provides a function, itself called C<evalbytes>, which | |
78 | evaluates its argument always as a string of bytes. | |
79 | ||
80 | These features also fix oddities with source filters leaking to outer | |
81 | dynamic scopes. | |
82 | ||
83 | See L<feature> for more detail. | |
84 | ||
85 | =head3 C<substr> lvalue revamp | |
86 | ||
87 | =for comment Does this belong here, or under Incomptable Changes? | |
88 | ||
89 | When C<substr> is called in lvalue or potential lvalue context with two | |
90 | or three arguments, a special lvalue scalar is returned that modifies | |
91 | the original string (the first argument) when assigned to. | |
92 | ||
93 | Previously, the offsets (the second and third arguments) passed to | |
94 | C<substr> would be converted immediately to match the string, negative | |
95 | offsets being translated to positive and offsets beyond the end of the | |
96 | string being truncated. | |
97 | ||
98 | Now, the offsets are recorded without modification in the special | |
99 | lvalue scalar that is returned, and the original string is not even | |
100 | looked at by C<substr> itself, but only when the returned lvalue is | |
101 | read or modified. | |
102 | ||
103 | These changes result in an incompatible change: | |
104 | ||
105 | If the original string changes length after the call to C<substr> but | |
106 | before assignment to its return value, negative offsets will remember | |
107 | their position from the end of the string, affecting code like this: | |
108 | ||
109 | my $string = "string"; | |
110 | my $lvalue = \substr $string, -4, 2; | |
111 | print $lvalue, "\n"; # prints "ri" | |
112 | $string = "bailing twine"; | |
113 | print $lvalue, "\n"; # prints "wi"; used to print "il" | |
114 | ||
115 | The same thing happens with an omitted third argument. The returned | |
116 | lvalue will always extend to the end of the string, even if the string | |
117 | becomes longer. | |
118 | ||
119 | Since this change also allowed many bugs to be fixed (see | |
120 | L</The C<substr> operator>), and since the behaviour | |
121 | of negative offsets has never been specified, so the | |
122 | change was deemed acceptable. | |
123 | ||
124 | =head3 Return value of C<tied> | |
125 | ||
126 | The value returned by C<tied> on a tied variable is now the actual | |
127 | scalar that holds the object to which the variable is tied. This | |
128 | allows ties to be weakened with C<Scalar::Util::weaken(tied | |
129 | $tied_variable)>. | |
130 | ||
131 | =head2 Unicode Support | |
132 | ||
133 | =head3 Supports (I<almost>) Unicode 6.1 | |
134 | ||
135 | Besides the addition of whole new scripts, and new characters in | |
136 | existing scripts, this new version of Unicode, as always, makes some | |
137 | changes to existing characters. One change that may trip up some | |
138 | applications is that the General Category of two characters in the | |
139 | Latin-1 range, PILCROW SIGN and SECTION SIGN, has been changed from | |
140 | Other_Symbol to Other_Punctuation. The same change has been made for | |
141 | a character in each of Tibetan, Ethiopic, and Aegean. | |
142 | The code points U+3248..U+324F (CIRCLED NUMBER TEN ON BLACK SQUARE | |
143 | through CIRCLED NUMBER EIGHTY ON BLACK SQUARE) have had their General | |
144 | Category changed from Other_Symbol to Other_Numeric. The Line Break | |
145 | property has changes for Hebrew and Japanese; and as a consequence of | |
146 | other changes in 6.1, the Perl regular expression construct C<\X> now | |
147 | works differently for some characters in Thai and Lao. | |
148 | ||
149 | New aliases (synonyms) have been defined for many property values; | |
150 | these, along with the previously existing ones, are all cross-indexed in | |
151 | L<perluniprops>. | |
152 | ||
153 | The return value of C<charnames::viacode()> is affected by other | |
154 | changes: | |
155 | ||
156 | Code point Old Name New Name | |
157 | U+000A LINE FEED (LF) LINE FEED | |
158 | U+000C FORM FEED (FF) FORM FEED | |
159 | U+000D CARRIAGE RETURN (CR) CARRIAGE RETURN | |
160 | U+0085 NEXT LINE (NEL) NEXT LINE | |
161 | U+008E SINGLE-SHIFT 2 SINGLE-SHIFT-2 | |
162 | U+008F SINGLE-SHIFT 3 SINGLE-SHIFT-3 | |
163 | U+0091 PRIVATE USE 1 PRIVATE USE-1 | |
164 | U+0092 PRIVATE USE 2 PRIVATE USE-2 | |
165 | U+2118 SCRIPT CAPITAL P WEIERSTRASS ELLIPTIC FUNCTION | |
166 | ||
167 | Perl will accept any of these names as input, but | |
168 | C<charnames::viacode()> now returns the new name of each pair. The | |
169 | change for U+2118 is considered by Unicode to be a correction, that is | |
170 | the original name was a mistake (but again, it will remain forever valid | |
171 | to use it to refer to U+2118). But most of these changes are the | |
172 | fallout of the mistake Unicode 6.0 made in naming a character used in | |
173 | Japanese cell phones to be "BELL", which conflicts with the longstanding | |
174 | industry use of (and Unicode's recommendation to use) that name | |
175 | to mean the ASCII control character at U+0007. As a result, that name | |
176 | has been deprecated in Perl since v5.14; and any use of it will raise a | |
177 | warning message (unless turned off). The name "ALERT" is now the | |
178 | preferred name for this code point, with "BEL" being an acceptable short | |
179 | form. The name for the new cell phone character, at code point U+1F514, | |
180 | remains undefined in this version of Perl (hence we don't quite | |
181 | implement all of Unicode 6.1), but starting in v5.18, BELL will mean | |
182 | this character, and not U+0007. | |
183 | ||
184 | Unicode has taken steps to make sure that this sort of mistake does not | |
185 | happen again. The Standard now includes all the generally accepted | |
186 | names and abbreviations for control characters, whereas previously it | |
187 | didn't (though there were recommended names for most of them, which Perl | |
188 | used). This means that most of those recommended names are now | |
189 | officially in the Standard. Unicode did not recommend names for the | |
190 | four code points listed above between U+008E and U+008F, and in | |
191 | standardizing them Unicode subtly changed the names that Perl had | |
192 | previously given them, by replacing the final blank in each name by a | |
193 | hyphen. Unicode also officially accepts names that Perl had deprecated, | |
194 | such as FILE SEPARATOR. Now the only deprecated name is BELL. | |
195 | Finally, Perl now uses the new official names instead of the old | |
196 | (now considered obsolete) names for the first four code points in the | |
197 | list above (the ones which have the parentheses in them). | |
198 | ||
199 | Now that the names have been placed in the Unicode standard, these kinds | |
200 | of changes should not happen again, though corrections, such as to | |
201 | U+2118, are still possible. | |
202 | ||
203 | Unicode also added some name abbreviations, which Perl now accepts: | |
204 | SP for SPACE; | |
205 | TAB for CHARACTER TABULATION; | |
206 | NEW LINE, END OF LINE, NL, and EOL for LINE FEED; | |
207 | LOCKING-SHIFT ONE for SHIFT OUT; | |
208 | LOCKING-SHIFT ZERO for SHIFT IN; | |
209 | and ZWNBSP for ZERO WIDTH NO-BREAK SPACE. | |
210 | ||
211 | More details on this version of Unicode are provided in | |
212 | L<http://www.unicode.org/versions/Unicode6.1.0/>. | |
213 | ||
214 | =head3 C<use charnames> is no longer needed for C<\N{I<name>}> | |
215 | ||
216 | When C<\N{I<name>}> is encountered, the C<charnames> module is now | |
217 | automatically loaded when needed as if the C<:full> and C<:short> | |
218 | options had been specified. See L<charnames> for more information. | |
219 | ||
220 | =head3 C<\N{...}> can now have Unicode loose name matching | |
221 | ||
222 | This is described in the C<charnames> item in | |
223 | L</Updated Modules and Pragmata> below. | |
224 | ||
225 | =head3 Unicode Symbol Names | |
226 | ||
227 | Perl now has proper support for Unicode in symbol names. It used to be | |
228 | that C<*{$foo}> would ignore the internal UTF8 flag and use the bytes of | |
229 | the underlying representation to look up the symbol. That meant that | |
230 | C<*{"\x{100}"}> and C<*{"\xc4\x80"}> would return the same thing. All | |
231 | these parts of Perl have been fixed to account for Unicode: | |
232 | ||
233 | =over | |
234 | ||
235 | =item * | |
236 | ||
237 | Method names (including those passed to C<use overload>) | |
238 | ||
239 | =item * | |
240 | ||
241 | Typeglob names (including names of variables, subroutines and filehandles) | |
242 | ||
243 | =item * | |
244 | ||
245 | Package names | |
246 | ||
247 | =item * | |
248 | ||
249 | C<goto> | |
250 | ||
251 | =item * | |
252 | ||
253 | Symbolic dereferencing | |
254 | ||
255 | =item * | |
256 | ||
257 | Second argument to C<bless()> and C<tie()> | |
258 | ||
259 | =item * | |
260 | ||
261 | Return value of C<ref()> | |
262 | ||
263 | =item * | |
264 | ||
265 | Subroutine prototypes | |
266 | ||
267 | =item * | |
268 | ||
269 | Attributes | |
270 | ||
271 | =item * | |
272 | ||
273 | Various warnings and error messages that mention variable names or values, | |
274 | methods, etc. | |
275 | ||
276 | =back | |
277 | ||
278 | In addition, a parsing bug has been fixed that prevented C<*{é}> from | |
279 | implicitly quoting the name, but instead interpreted it as C<*{+é}>, which | |
280 | would cause a strict violation. | |
281 | ||
282 | C<*{"*a::b"}> automatically strips off the * if it is followed by an ASCII | |
283 | letter. That has been extended to all Unicode identifier characters. | |
284 | ||
285 | One-character non-ASCII non-punctuation variables (like C<$é>) are now | |
286 | subject to "Used only once" warnings. They used to be exempt, as they | |
287 | was treated as punctuation variables. | |
288 | ||
289 | Also, single-character Unicode punctuation variables (like C<$‰>) are now | |
290 | supported [perl #69032]. | |
291 | ||
292 | =head3 Improved ability to mix locales and Unicode, including UTF-8 locales | |
293 | ||
294 | An optional parameter has been added to C<use locale> | |
295 | ||
296 | use locale ':not_characters'; | |
297 | ||
298 | which tells Perl to use all but the C<LC_CTYPE> and C<LC_COLLATE> | |
299 | portions of the current locale. Instead, the character set is assumed | |
300 | to be Unicode. This allows locales and Unicode to be seamlessly mixed, | |
301 | including the increasingly frequent UTF-8 locales. When using this | |
302 | hybrid form of locales, the C<:locale> layer to the L<open> pragma can | |
303 | be used to interface with the file system, and there are CPAN modules | |
304 | available for ARGV and environment variable conversions. | |
305 | ||
306 | Full details are in L<perllocale>. | |
307 | ||
308 | =head3 New function C<fc> and corresponding escape sequence C<\F> for Unicode foldcase | |
309 | ||
310 | Unicode foldcase is an extension to lowercase that gives better results | |
311 | when comparing two strings case-insensitively. It has long been used | |
312 | internally in regular expression C</i> matching. Now it is available | |
313 | explicitly through the new C<fc> function call (enabled by | |
314 | S<C<"use feature 'fc'">>, or C<use v5.16>, or explicitly callable via | |
315 | C<CORE::fc>) or through the new C<\F> sequence in double-quotish | |
316 | strings. | |
317 | ||
318 | Full details are in L<perlfunc/fc>. | |
319 | ||
320 | =head3 The Unicode C<Script_Extensions> property is now supported. | |
321 | ||
322 | New in Unicode 6.0, this is an improved C<Script> property. Details | |
323 | are in L<perlunicode/Scripts>. | |
324 | ||
325 | =head2 XS Changes | |
326 | ||
327 | =head3 Improved typemaps for Some Builtin Types | |
328 | ||
329 | Most XS authors will be aware that there is a longstanding bug in the | |
330 | OUTPUT typemap for T_AVREF (C<AV*>), T_HVREF (C<HV*>), T_CVREF (C<CV*>), | |
331 | and T_SVREF (C<SVREF> or C<\$foo>) that requires manually decrementing | |
332 | the reference count of the return value instead of the typemap taking | |
333 | care of this. For backwards-compatibility, this cannot be changed in the | |
334 | default typemaps. But we now provide additional typemaps | |
335 | C<T_AVREF_REFCOUNT_FIXED>, etc. that do not exhibit this bug. Using | |
336 | them in your extension is as simple as having one line in your | |
337 | C<TYPEMAP> section: | |
338 | ||
339 | HV* T_HVREF_REFCOUNT_FIXED | |
340 | ||
341 | =head3 C<is_utf8_char()> | |
342 | ||
343 | The XS-callable function C<is_utf8_char()>, when presented with | |
344 | malformed UTF-8 input, can read up to 12 bytes beyond the end of the | |
345 | string. This cannot be fixed without changing its API. It is not | |
346 | called from CPAN. The documentation now describes how to use it | |
347 | safely. | |
348 | ||
349 | =head3 Added C<is_utf8_char_buf()> | |
350 | ||
351 | This function is designed to replace the deprecated L</is_utf8_char()> | |
352 | function. It includes an extra parameter to make sure it doesn't read | |
353 | past the end of the input buffer. | |
354 | ||
355 | =head3 Other C<is_utf8_foo()> functions, as well as C<utf8_to_foo()>, etc. | |
356 | ||
357 | Most of the other XS-callable functions that take UTF-8 encoded input | |
358 | implicitly assume that the UTF-8 is valid (not malformed) in regards to | |
359 | buffer length. Do not do things such as change a character's case or | |
360 | see if it is alphanumeric without first being sure that it is valid | |
361 | UTF-8. This can be safely done for a whole string by using one of the | |
362 | functions C<is_utf8_string()>, C<is_utf8_string_loc()>, and | |
363 | C<is_utf8_string_loclen()>. | |
364 | ||
365 | =head3 New Pad API | |
366 | ||
367 | Many new functions have been added to the API for manipulating lexical | |
368 | pads. See L<perlapi/Pad Data Structures> for more information. | |
369 | ||
370 | =head2 Changes to Special Variables | |
371 | ||
372 | =head3 C<$$> can be assigned to | |
373 | ||
374 | C<$$> was made read-only in Perl 5.8.0. But only sometimes: C<local $$> | |
375 | would make it writable again. Some CPAN modules were using C<local $$> or | |
376 | XS code to bypass the read-only check, so there is no reason to keep C<$$> | |
377 | read-only. (This change also allowed a bug to be fixed while maintaining | |
378 | backward compatibility.) | |
379 | ||
380 | =head3 C<$^X> converted to an absolute path on FreeBSD, OS X and Solaris | |
381 | ||
382 | C<$^X> is now converted to an absolute path on OS X, FreeBSD (without | |
383 | needing F</proc> mounted) and Solaris 10 and 11. This augments the | |
384 | previous approach of using F</proc> on Linux, FreeBSD and NetBSD | |
385 | (in all cases, where mounted). | |
386 | ||
387 | This makes relocatable perl installations more useful on these platforms. | |
388 | (See "Relocatable @INC" in F<INSTALL>) | |
389 | ||
390 | =head2 Debugger Changes | |
391 | ||
392 | =head3 Features inside the debugger | |
393 | ||
394 | The current Perl's L<feature> bundle is now enabled for commands entered | |
395 | in the interactive debugger. | |
396 | ||
397 | =head3 New option for the debugger's B<t> command | |
398 | ||
399 | The B<t> command in the debugger, which toggles tracing mode, now | |
400 | accepts a numeric argument that determines how many levels of subroutine | |
401 | calls to trace. | |
402 | ||
403 | =head3 C<enable> and C<disable> | |
404 | ||
405 | The debugger now has C<disable> and C<enable> commands for disabling | |
406 | existing breakpoints and re-enabling them. See L<perldebug>. | |
407 | ||
408 | =head3 Breakpoints with file names | |
409 | ||
410 | The debugger's "b" command for setting breakpoints now allows a line | |
411 | number to be prefixed with a file name. See | |
412 | L<perldebug/"b [file]:[line] [condition]">. | |
413 | ||
414 | =head2 The C<CORE> Namespace | |
415 | ||
416 | =head3 The C<CORE::> prefix | |
417 | ||
418 | The C<CORE::> prefix can now be used on keywords enabled by | |
419 | L<feature.pm|feature>, even outside the scope of C<use feature>. | |
420 | ||
421 | =head3 Subroutines in the C<CORE> namespace | |
422 | ||
423 | Many Perl keywords are now available as subroutines in the CORE namespace. | |
424 | This allows them to be aliased: | |
425 | ||
426 | BEGIN { *entangle = \&CORE::tie } | |
427 | entangle $variable, $package, @args; | |
428 | ||
429 | And for prototypes to be bypassed: | |
430 | ||
431 | sub mytie(\[%$*@]$@) { | |
432 | my ($ref, $pack, @args) = @_; | |
433 | ... do something ... | |
434 | goto &CORE::tie; | |
435 | } | |
436 | ||
437 | Some of these cannot be called through references or via C<&foo> syntax, | |
438 | but must be called as barewords. | |
439 | ||
440 | See L<CORE> for details. | |
441 | ||
442 | =head2 Other Changes | |
443 | ||
444 | =head3 Anonymous handles | |
445 | ||
446 | Automatically generated file handles are now named __ANONIO__ when the | |
447 | variable name cannot be determined, rather than $__ANONIO__. | |
448 | ||
449 | =head3 Autoloaded sort Subroutines | |
450 | ||
451 | Custom sort subroutines can now be autoloaded [perl #30661]: | |
452 | ||
453 | sub AUTOLOAD { ... } | |
454 | @sorted = sort foo @list; # uses AUTOLOAD | |
455 | ||
456 | =head3 C<continue> no longer requires the "switch" feature | |
457 | ||
458 | The C<continue> keyword has two meanings. It can introduce a C<continue> | |
459 | block after a loop, or it can exit the current C<when> block. Up till now, | |
460 | the latter meaning was only valid with the "switch" feature enabled, and | |
461 | was a syntax error otherwise. Since the main purpose of feature.pm is to | |
462 | avoid conflicts with user-defined subroutines, there is no reason for | |
463 | C<continue> to depend on it. | |
464 | ||
465 | =head3 DTrace probes for interpreter phase change | |
466 | ||
467 | The C<phase-change> probes will fire when the interpreter's phase | |
468 | changes, which tracks the C<${^GLOBAL_PHASE}> variable. C<arg0> is | |
469 | the new phase name; C<arg1> is the old one. This is useful mostly | |
470 | for limiting your instrumentation to one or more of: compile time, | |
471 | run time, destruct time. | |
472 | ||
473 | =head3 C<__FILE__()> Syntax | |
474 | ||
475 | The C<__FILE__>, C<__LINE__> and C<__PACKAGE__> tokens can now be written | |
476 | with an empty pair of parentheses after them. This makes them parse the | |
477 | same way as C<time>, C<fork> and other built-in functions. | |
478 | ||
479 | =head3 The C<\$> prototype accepts any scalar lvalue | |
480 | ||
481 | The C<\$> and C<\[$]> subroutine prototypes now accept any scalar lvalue | |
482 | argument. Previously they only accepted scalars beginning with C<$> and | |
483 | hash and array elements. This change makes them consistent with the way | |
484 | the built-in C<read> and C<recv> functions (among others) parse their | |
485 | arguments. This means that one can override the built-in functions with | |
486 | custom subroutines that parse their arguments the same way. | |
487 | ||
488 | =head3 C<_> in subroutine prototypes | |
489 | ||
490 | The C<_> character in subroutine prototypes is now allowed before C<@> or | |
491 | C<%>. | |
492 | ||
493 | =head1 Security | |
494 | ||
495 | =head2 Use C<is_utf8_char_buf()> and not C<is_utf8_char()> | |
496 | ||
497 | The latter function is now deprecated because its API is insufficient to | |
498 | guarantee that it doesn't read (up to 12 bytes in the worst case) beyond | |
499 | the end of its input string. See | |
500 | L<is_utf8_char_buf()|/Added is_utf8_char_buf()>. | |
501 | ||
502 | =head2 Malformed UTF-8 input could cause attempts to read beyond the end of the buffer | |
503 | ||
504 | Two new XS-accessible functions, C<utf8_to_uvchr_buf()> and | |
505 | C<utf8_to_uvuni_buf()> are now available to prevent this, and the Perl | |
506 | core has been converted to use them. | |
507 | See L</Internal Changes>. | |
508 | ||
509 | =head2 C<File::Glob::bsd_glob()> memory error with GLOB_ALTDIRFUNC (CVE-2011-2728). | |
510 | ||
511 | Calling C<File::Glob::bsd_glob> with the unsupported flag | |
512 | GLOB_ALTDIRFUNC would cause an access violation / segfault. A Perl | |
513 | program that accepts a flags value from an external source could expose | |
514 | itself to denial of service or arbitrary code execution attacks. There | |
515 | are no known exploits in the wild. The problem has been corrected by | |
516 | explicitly disabling all unsupported flags and setting unused function | |
517 | pointers to null. Bug reported by Clément Lecigne. | |
518 | ||
519 | =head2 Privileges are now set correctly when assigning to C<$(> | |
520 | ||
521 | A hypothetical bug (probably non-exploitable in practice) due to the | |
522 | incorrect setting of the effective group ID while setting C<$(> has been | |
523 | fixed. The bug would only have affected systems that have C<setresgid()> | |
524 | but not C<setregid()>, but no such systems are known of. | |
525 | ||
526 | =head1 Deprecations | |
527 | ||
528 | =head2 Don't read the Unicode data base files in F<lib/unicore> | |
529 | ||
530 | It is now deprecated to directly read the Unicode data base files. | |
531 | These are stored in the F<lib/unicore> directory. Instead, you should | |
532 | use the new functions in L<Unicode::UCD>. These provide a stable API, | |
533 | and give complete information. | |
534 | ||
535 | Perl may at some point in the future change or remove the files. The | |
536 | file most likely for applications to have used is | |
537 | F<lib/unicore/ToDigit.pl>. L<Unicode::UCD/prop_invmap()> can be used to | |
538 | get at its data instead. | |
539 | ||
540 | =head2 XS functions C<is_utf8_char()>, C<utf8_to_uvchr()> and | |
541 | C<utf8_to_uvuni()> | |
542 | ||
543 | This function is deprecated because it could read beyond the end of the | |
544 | input string. Use the new L<is_utf8_char_buf()|/Added is_utf8_char_buf()>, | |
545 | C<utf8_to_uvchr_buf()> and C<utf8_to_uvuni_buf()> instead. | |
546 | ||
547 | =head1 Future Deprecations | |
548 | ||
549 | This section serves as a notice of features that are I<likely> to be | |
550 | removed or L<deprecated|perlpolicy/deprecated> in the next release of | |
551 | perl (5.18.0). If your code depends on these features, you should | |
552 | contact the Perl 5 Porters via the L<mailing | |
553 | list|http://lists.perl.org/list/perl5-porters.html> or L<perlbug> to | |
554 | explain your use case and inform the deprecation process. | |
555 | ||
556 | =head2 Core Modules | |
557 | ||
558 | These modules may be marked as deprecated I<from the core>. This only | |
559 | means that they will no longer be installed by default with the core | |
560 | distribution, but will remain available on the CPAN. | |
561 | ||
562 | =over | |
563 | ||
564 | =item * | |
565 | ||
566 | CPANPLUS | |
567 | ||
568 | =item * | |
569 | ||
570 | Filter::Simple | |
571 | ||
572 | =item * | |
573 | ||
574 | PerlIO::mmap | |
575 | ||
576 | =item * | |
577 | ||
578 | Pod::Parser, Pod::LaTeX | |
579 | ||
580 | =item * | |
581 | ||
582 | SelfLoader | |
583 | ||
584 | =item * | |
585 | ||
586 | Text::Soundex | |
587 | ||
588 | =item * | |
589 | ||
590 | Thread.pm | |
591 | ||
592 | =back | |
593 | ||
594 | =head2 Platforms with no supporting programmers: | |
595 | ||
596 | These platforms will probably have their | |
597 | special build support removed during the | |
598 | 5.17.0 development series. | |
599 | ||
600 | =over | |
601 | ||
602 | =item * | |
603 | ||
604 | BeOS | |
605 | ||
606 | =item * | |
607 | ||
608 | djgpp | |
609 | ||
610 | =item * | |
611 | ||
612 | dgux | |
613 | ||
614 | =item * | |
615 | ||
616 | EPOC | |
617 | ||
618 | =item * | |
619 | ||
620 | MPE/iX | |
621 | ||
622 | =item * | |
623 | ||
624 | Rhapsody | |
625 | ||
626 | =item * | |
627 | ||
628 | UTS | |
629 | ||
630 | =item * | |
631 | ||
632 | VM/ESA | |
633 | ||
634 | =back | |
635 | ||
636 | =head2 Other Future Deprecations | |
637 | ||
638 | =over | |
639 | ||
640 | =item * | |
641 | ||
642 | Swapping of $< and $> | |
643 | ||
644 | For more information about this future deprecation, see L<the relevant RT | |
645 | ticket|https://rt.perl.org/rt3/Ticket/Display.html?id=96212>. | |
646 | ||
647 | =item * | |
648 | ||
649 | sfio, stdio | |
650 | ||
e57f4500 LT |
651 | Perl supports being built without PerlIO proper, using a stdio or sfio |
652 | wrapper instead. A perl build like this will not support IO layers and | |
653 | thus Unicode IO, making it rather handicapped. | |
654 | ||
655 | PerlIO supports a C<stdio> layer if stdio use is desired, and similarly a | |
656 | sfio layer could be produced. | |
657 | ||
05c8f9ed RS |
658 | =item * |
659 | ||
660 | Unescaped literal C<< "{" >> in regular expressions. | |
661 | ||
662 | It is planned starting in v5.20 to require a literal C<"{"> to be | |
663 | escaped by, for example, preceding it with a backslash. In v5.18, a | |
664 | deprecated warning message will be emitted for all such uses. Note that | |
665 | this only affects patterns which are to match a literal C<"{">. Other | |
666 | uses of this character, such as part of a quantifier or sequence like in | |
667 | the ones below are completely unaffected: | |
668 | ||
669 | /foo{3,5}/ | |
670 | /\p{Alphabetic}/ | |
671 | /\N{DIGIT ZERO} | |
672 | ||
673 | The removal of this will allow extensions to pattern syntax, and better | |
674 | error checking of existing syntax. See L<perlre/Quantifiers> for an | |
675 | example. | |
676 | ||
677 | =back | |
678 | ||
679 | =head1 Incompatible Changes | |
680 | ||
681 | =head2 Special blocks called in void context | |
682 | ||
683 | Special blocks (C<BEGIN>, C<CHECK>, C<INIT>, C<UNITCHECK>, C<END>) are now | |
684 | called in void context. This avoids wasteful copying of the result of the | |
685 | last statement [perl #108794]. | |
686 | ||
687 | =head2 The C<overloading> pragma and regexp objects | |
688 | ||
689 | With C<no overloading>, regular expression objects returned by C<qr//> are | |
690 | now stringified as "Regexp=REGEXP(0xbe600d)" instead of the regular | |
691 | expression itself [perl #108780]. | |
692 | ||
693 | =head2 Two XS typemap Entries removed | |
694 | ||
695 | Two presumably unused XS typemap entries have been removed from the | |
696 | core typemap: T_DATAUNIT and T_CALLBACK. If you are, against all odds, | |
697 | a user of these, please see the instructions on how to regain them | |
698 | in L<perlxstypemap>. | |
699 | ||
700 | =head2 Unicode 6.1 has incompatibilities with Unicode 6.0 | |
701 | ||
702 | These are detailed in L</Supports (almost) Unicode 6.1> above. | |
703 | You can compile this version of Perl to use Unicode 6.0. See | |
704 | L<perlunicode/Hacking Perl to work on earlier Unicode versions (for very serious hackers only)>. | |
705 | ||
706 | =head2 Borland compiler | |
707 | ||
708 | All support for the Borland compiler has been dropped. The code had not | |
709 | worked for a long time anyway. | |
710 | ||
711 | =head2 Certain deprecated Unicode properties are no longer supported by default | |
712 | ||
713 | Perl should never have exposed certain Unicode properties that are used | |
714 | by Unicode internally and not meant to be publicly available. Use of | |
715 | these has generated deprecated warning messages since Perl 5.12. The | |
716 | removed properties are Other_Alphabetic, | |
717 | Other_Default_Ignorable_Code_Point, Other_Grapheme_Extend, | |
718 | Other_ID_Continue, Other_ID_Start, Other_Lowercase, Other_Math, and | |
719 | Other_Uppercase. | |
720 | ||
721 | Perl may be recompiled to include any or all of them; instructions are | |
722 | given in | |
723 | L<perluniprops/Unicode character properties that are NOT accepted by Perl>. | |
724 | ||
725 | =head2 Dereferencing IO thingies as typeglobs | |
726 | ||
727 | The C<*{...}> operator, when passed a reference to an IO thingy (as in | |
728 | C<*{*STDIN{IO}}>), creates a new typeglob containing just that IO object. | |
729 | Previously, it would stringify as an empty string, but some operators would | |
730 | treat it as undefined, producing an "uninitialized" warning. | |
731 | Now it stringifies as __ANONIO__ [perl #96326]. | |
732 | ||
733 | =head2 User-defined case-changing operations | |
734 | ||
735 | This feature was deprecated in Perl 5.14, and has now been removed. | |
736 | The CPAN module L<Unicode::Casing> provides better functionality without | |
737 | the drawbacks that this feature had, as are detailed in the 5.14 | |
738 | documentation: | |
739 | L<http://perldoc.perl.org/5.14.0/perlunicode.html#User-Defined-Case-Mappings-%28for-serious-hackers-only%29> | |
740 | ||
741 | =head2 XSUBs are now 'static' | |
742 | ||
743 | XSUB C functions are now 'static', that is, they are not visible from | |
744 | outside the compilation unit. Users can use the new C<XS_EXTERNAL(name)> | |
745 | and C<XS_INTERNAL(name)> macros to pick the desired linking behaviour. | |
746 | The ordinary C<XS(name)> declaration for XSUBs will continue to declare | |
747 | non-'static' XSUBs for compatibility, but the XS compiler, | |
748 | C<ExtUtils::ParseXS> (C<xsubpp>) will emit 'static' XSUBs by default. | |
749 | C<ExtUtils::ParseXS>'s behaviour can be reconfigured from XS using the | |
750 | C<EXPORT_XSUB_SYMBOLS> keyword. See L<perlxs> for details. | |
751 | ||
752 | =head2 Weakening read-only references | |
753 | ||
754 | Weakening read-only references is no longer permitted. It should never | |
755 | have worked anyway, and in some cases could result in crashes. | |
756 | ||
757 | =head2 Tying scalars that hold typeglobs | |
758 | ||
759 | Attempting to tie a scalar after a typeglob was assigned to it would | |
760 | instead tie the handle in the typeglob's IO slot. This meant that it was | |
761 | impossible to tie the scalar itself. Similar problems affected C<tied> and | |
762 | C<untie>: C<tied $scalar> would return false on a tied scalar if the last | |
763 | thing returned was a typeglob, and C<untie $scalar> on such a tied scalar | |
764 | would do nothing. | |
765 | ||
766 | We fixed this problem before Perl 5.14.0, but it caused problems with some | |
767 | CPAN modules, so we put in a deprecation cycle instead. | |
768 | ||
769 | Now the deprecation has been removed and this bug has been fixed. So | |
770 | C<tie $scalar> will always tie the scalar, not the handle it holds. To tie | |
771 | the handle, use C<tie *$scalar> (with an explicit asterisk). The same | |
772 | applies to C<tied *$scalar> and C<untie *$scalar>. | |
773 | ||
774 | =head2 IPC::Open3 no longer provides C<xfork()>, C<xclose_on_exec()> | |
775 | and C<xpipe_anon()> | |
776 | ||
777 | All three functions were private, undocumented and unexported. They do | |
778 | not appear to be used by any code on CPAN. Two have been inlined and one | |
779 | deleted entirely. | |
780 | ||
781 | =head2 C<$$> no longer caches PID | |
782 | ||
783 | Previously, if one called fork(3) from C, Perl's | |
784 | notion of C<$$> could go out of sync with what getpid() returns. By always | |
785 | fetching the value of C<$$> via getpid(), this potential bug is eliminated. | |
786 | Code that depends on the caching behavior will break. As described in | |
787 | L<Core Enhancements|/C<$$> can be assigned to>, | |
788 | C<$$> is now writable, but it will be reset during a | |
789 | fork. | |
790 | ||
791 | =head2 C<$$> and C<getppid()> no longer emulate POSIX semantics under LinuxThreads | |
792 | ||
793 | The POSIX emulation of C<$$> and C<getppid()> under the obsolete | |
794 | LinuxThreads implementation has been removed. | |
795 | This only impacts users of Linux 2.4 and | |
796 | users of Debian GNU/kFreeBSD up to and including 6.0, not the vast | |
797 | majority of Linux installations that use NPTL threads. | |
798 | ||
799 | This means that C<getppid()>, like C<$$>, is now always guaranteed to | |
800 | return the OS's idea of the current state of the process, not perl's | |
801 | cached version of it. | |
802 | ||
803 | See the documentation for L<$$|perlvar/$$> for details. | |
804 | ||
805 | =head2 C<< $< >>, C<< $> >>, C<$(> and C<$)> are no longer cached | |
806 | ||
807 | Similarly to the changes to C<$$> and C<getppid()>, the internal | |
808 | caching of C<< $< >>, C<< $> >>, C<$(> and C<$)> has been removed. | |
809 | ||
810 | When we cached these values our idea of what they were would drift out | |
811 | of sync with reality if someone (e.g., someone embedding perl) called | |
812 | C<sete?[ug]id()> without updating C<PL_e?[ug]id>. Having to deal with | |
813 | this complexity wasn't worth it given how cheap the C<gete?[ug]id()> | |
814 | system call is. | |
815 | ||
816 | This change will break a handful of CPAN modules that use the XS-level | |
817 | C<PL_uid>, C<PL_gid>, C<PL_euid> or C<PL_egid> variables. | |
818 | ||
819 | The fix for those breakages is to use C<PerlProc_gete?[ug]id()> to | |
820 | retrieve them (e.g. C<PerlProc_getuid()>), and not to assign to | |
821 | C<PL_e?[ug]id> if you change the UID/GID/EUID/EGID. There is no longer | |
822 | any need to do so since perl will always retrieve the up-to-date | |
823 | version of those values from the OS. | |
824 | ||
825 | =head2 Which Non-ASCII characters get quoted by C<quotemeta> and C<\Q> has changed | |
826 | ||
827 | This is unlikely to result in a real problem, as Perl does not attach | |
828 | special meaning to any non-ASCII character, so it is currently | |
829 | irrelevant which are quoted or not. This change fixes bug [perl #77654] and | |
830 | bring Perl's behavior more into line with Unicode's recommendations. | |
831 | See L<perlfunc/quotemeta>. | |
832 | ||
833 | =head1 Performance Enhancements | |
834 | ||
835 | =over | |
836 | ||
837 | =item * | |
838 | ||
839 | Improved performance for Unicode properties in regular expressions | |
840 | ||
841 | =for comment Can this be compacted some? -- rjbs, 2012-02-20 | |
842 | ||
843 | Matching a code point against a Unicode property is now done via a | |
844 | binary search instead of linear. This means for example that the worst | |
845 | case for a 1000 item property is 10 probes instead of 1000. This | |
846 | inefficiency has been compensated for in the past by permanently storing | |
847 | in a hash the results of a given probe plus the results for the adjacent | |
848 | 64 code points, under the theory that near-by code points are likely to | |
849 | be searched for. A separate hash was used for each mention of a Unicode | |
850 | property in each regular expression. Thus, C<qr/\p{foo}abc\p{foo}/> | |
851 | would generate two hashes. Any probes in one instance would be unknown | |
852 | to the other, and the hashes could expand separately to be quite large | |
853 | if the regular expression were used on many different widely-separated | |
854 | code points. This can lead to running out of memory in extreme cases. | |
855 | Now, however, there is just one hash shared by all instances of a given | |
856 | property. This means that if C<\p{foo}> is matched against "A" in one | |
857 | regular expression in a thread, the result will be known immediately to | |
858 | all regular expressions, and the relentless march of using up memory is | |
859 | slowed considerably. | |
860 | ||
861 | =item * | |
862 | ||
863 | Version declarations with the C<use> keyword (e.g., C<use 5.012>) are now | |
864 | faster, as they enable features without loading F<feature.pm>. | |
865 | ||
866 | =item * | |
867 | ||
868 | C<local $_> is faster now, as it no longer iterates through magic that it | |
869 | is not going to copy anyway. | |
870 | ||
871 | =item * | |
872 | ||
873 | Perl 5.12.0 sped up the destruction of objects whose classes define | |
874 | empty C<DESTROY> methods (to prevent autoloading), by simply not | |
875 | calling such empty methods. This release takes this optimisation a | |
876 | step further, by not calling any C<DESTROY> method that begins with a | |
877 | C<return> statement. This can be useful for destructors that are only | |
878 | used for debugging: | |
879 | ||
880 | use constant DEBUG => 1; | |
881 | sub DESTROY { return unless DEBUG; ... } | |
882 | ||
883 | Constant-folding will reduce the first statement to C<return;> if DEBUG | |
884 | is set to 0, triggering this optimisation. | |
885 | ||
886 | =item * | |
887 | ||
888 | Assigning to a variable that holds a typeglob or copy-on-write scalar | |
889 | is now much faster. Previously the typeglob would be stringified or | |
890 | the copy-on-write scalar would be copied before being clobbered. | |
891 | ||
892 | =item * | |
893 | ||
894 | Assignment to C<substr> in void context is now more than twice its | |
895 | previous speed. Instead of creating and returning a special lvalue | |
896 | scalar that is then assigned to, C<substr> modifies the original string | |
897 | itself. | |
898 | ||
899 | =item * | |
900 | ||
901 | C<substr> no longer calculates a value to return when called in void | |
902 | context. | |
903 | ||
904 | =item * | |
905 | ||
906 | Due to changes in L<File::Glob>, Perl's C<glob> function and its C<< | |
907 | <...> >> equivalent are now much faster. The splitting of the pattern | |
908 | into words has been rewritten in C, resulting in speed-ups of 20% in | |
909 | some cases. | |
910 | ||
911 | This does not affect C<glob> on VMS, as it does not use File::Glob. | |
912 | ||
913 | =item * | |
914 | ||
915 | The short-circuiting operators C<&&>, C<||>, and C<//>, when chained | |
916 | (such as C<$a || $b || $c>), are now considerably faster to short-circuit, | |
917 | due to reduced optree traversal. | |
918 | ||
919 | =item * | |
920 | ||
921 | The implementation of C<s///r> makes one fewer copy of the scalar's value. | |
922 | ||
923 | =item * | |
924 | ||
925 | C<study> is now a no-op. | |
926 | ||
927 | =item * | |
928 | ||
929 | Recursive calls to lvalue subroutines in lvalue scalar context use less | |
930 | memory. | |
931 | ||
932 | =back | |
933 | ||
934 | =head1 Modules and Pragmata | |
935 | ||
936 | =head2 Deprecated Modules | |
937 | ||
938 | =over | |
939 | ||
940 | =item L<Version::Requirements> | |
941 | ||
942 | Version::Requirements is now DEPRECATED, use L<CPAN::Meta::Requirements>, | |
943 | which is a drop-in replacement. It will be deleted from perl.git blead | |
944 | in v5.17.0. | |
945 | ||
946 | =back | |
947 | ||
948 | =head2 New Modules and Pragmata | |
949 | ||
950 | =over 4 | |
951 | ||
952 | =item * | |
953 | ||
954 | L<arybase> -- this new module implements the C<$[> variable. | |
955 | ||
956 | =item * | |
957 | ||
958 | C<PerlIO::mmap> 0.010 has been added to the Perl core. | |
959 | ||
960 | The C<mmap> PerlIO layer is no longer implemented by perl itself, but has | |
961 | been moved out into the new L<PerlIO::mmap> module. | |
962 | ||
963 | =back | |
964 | ||
965 | =head2 Updated Modules and Pragmata | |
966 | ||
b7f87eaf RS |
967 | This is only an overview of selected module updates. For a complete list of |
968 | updates, run: | |
969 | ||
970 | $ corelist --diff 5.14.0 5.16.0 | |
971 | ||
972 | You can substitute your favorite version in place of 5.14.0, too. | |
973 | ||
05c8f9ed RS |
974 | =over 4 |
975 | ||
976 | =item * | |
977 | ||
978 | L<XXX> has been upgraded from version 0.69 to version 0.70. | |
979 | ||
980 | =back | |
981 | ||
982 | =head2 Removed Modules and Pragmata | |
983 | ||
984 | As promised in Perl 5.14.0's release notes, the following modules have | |
985 | been removed from the core distribution, and if needed should be installed | |
986 | from CPAN instead. | |
987 | ||
988 | =over | |
989 | ||
990 | =item * | |
991 | ||
992 | C<Devel::DProf> has been removed from the Perl core. Prior version was | |
993 | 20110228.00. | |
994 | ||
995 | =item * | |
996 | ||
997 | C<Shell> has been removed from the Perl core. Prior version was 0.72_01. | |
998 | ||
999 | =back | |
1000 | ||
1001 | =head1 Documentation | |
1002 | ||
1003 | =head2 New Documentation | |
1004 | ||
1005 | =head3 L<perldtrace> | |
1006 | ||
1007 | L<perldtrace> describes Perl's DTrace support, listing the provided probes | |
1008 | and gives examples of their use. | |
1009 | ||
1010 | =head3 L<perlexperiment> | |
1011 | ||
1012 | This document is intended to provide a list of experimental features in | |
1013 | Perl. It is still a work in progress. | |
1014 | ||
1015 | =head3 L<perlootut> | |
1016 | ||
1017 | This a new OO tutorial. It focuses on basic OO concepts, and then recommends | |
1018 | that readers choose an OO framework from CPAN. | |
1019 | ||
1020 | =head3 L<perlxstypemap> | |
1021 | ||
1022 | The new manual describes the XS typemapping mechanism in unprecedented | |
1023 | detail and combines new documentation with information extracted from | |
1024 | L<perlxs> and the previously unofficial list of all core typemaps. | |
1025 | ||
1026 | =head2 Changes to Existing Documentation | |
1027 | ||
1028 | =head3 L<perlapi> | |
1029 | ||
1030 | =over 4 | |
1031 | ||
1032 | =item * | |
1033 | ||
1034 | The HV API has long accepted negative lengths to indicate that the key is | |
1035 | in UTF8. Now this is documented. | |
1036 | ||
1037 | =item * | |
1038 | ||
1039 | The C<boolSV()> macro is now documented. | |
1040 | ||
1041 | =back | |
1042 | ||
1043 | =head3 L<perlfunc> | |
1044 | ||
1045 | =over 4 | |
1046 | ||
1047 | =item * | |
1048 | ||
1049 | C<dbmopen> treats a 0 mode as a special case, that prevents a nonexistent | |
1050 | file from being created. This has been the case since Perl 5.000, but was | |
1051 | never documented anywhere. Now the perlfunc entry mentions it | |
1052 | [perl #90064]. | |
1053 | ||
1054 | =item * | |
1055 | ||
1056 | As an accident of history, C<open $fh, "<:", ...> applies the default | |
1057 | layers for the platform (C<:raw> on Unix, C<:crlf> on Windows), ignoring | |
1058 | whatever is declared by L<open.pm|open>. This seems such a useful feature | |
1059 | it has been documented in L<perlfunc|perlfunc/open> and L<open>. | |
1060 | ||
1061 | =item * | |
1062 | ||
1063 | The entry for C<split> has been rewritten. It is now far clearer than | |
1064 | before. | |
1065 | ||
1066 | =back | |
1067 | ||
1068 | =head3 L<perlguts> | |
1069 | ||
1070 | =over 4 | |
1071 | ||
1072 | =item * | |
1073 | ||
1074 | A new section, L<Autoloading with XSUBs|perlguts/Autoloading with XSUBs>, | |
1075 | has been added, which explains the two APIs for accessing the name of the | |
1076 | autoloaded sub. | |
1077 | ||
1078 | =item * | |
1079 | ||
1080 | Some of the function descriptions in L<perlguts> were confusing, as it was | |
1081 | not clear whether they referred to the function above or below the | |
1082 | description. This has been clarified [perl #91790]. | |
1083 | ||
1084 | =back | |
1085 | ||
1086 | =head3 L<perlobj> | |
1087 | ||
1088 | =over 4 | |
1089 | ||
1090 | =item * | |
1091 | ||
1092 | This document has been rewritten from scratch, and its coverage of various OO | |
1093 | concepts has been expanded. | |
1094 | ||
1095 | =back | |
1096 | ||
1097 | =head3 L<perlop> | |
1098 | ||
1099 | =over 4 | |
1100 | ||
1101 | =item * | |
1102 | ||
1103 | Documentation of the smartmatch operator has been reworked and moved from | |
1104 | perlsyn to perlop where it belongs. | |
1105 | ||
1106 | It has also been corrected for the case of C<undef> on the left-hand | |
1107 | side. The list of different smart match behaviours had an item in the | |
1108 | wrong place. | |
1109 | ||
1110 | =item * | |
1111 | ||
1112 | Documentation of the ellipsis statement (C<...>) has been reworked and | |
1113 | moved from perlop to perlsyn. | |
1114 | ||
1115 | =item * | |
1116 | ||
1117 | The explanation of bitwise operators has been expanded to explain how they | |
1118 | work on Unicode strings (5.14.1). | |
1119 | ||
1120 | =item * | |
1121 | ||
1122 | More examples for C<m//g> have been added (5.14.1). | |
1123 | ||
1124 | =item * | |
1125 | ||
1126 | The C<<< <<\FOO >>> here-doc syntax has been documented (5.14.1). | |
1127 | ||
1128 | =back | |
1129 | ||
1130 | =head3 L<perlpragma> | |
1131 | ||
1132 | =over 4 | |
1133 | ||
1134 | =item * | |
1135 | ||
1136 | There is now a standard convention for naming keys in the C<%^H>, | |
1137 | documented under L<Key naming|perlpragma/Key naming>. | |
1138 | ||
1139 | =back | |
1140 | ||
1141 | =head3 L<perlsec/Laundering and Detecting Tainted Data> | |
1142 | ||
1143 | =over 4 | |
1144 | ||
1145 | =item * | |
1146 | ||
1147 | The example function for checking for taintedness contained a subtle | |
1148 | error. C<$@> needs to be localized to prevent its changing this | |
1149 | global's value outside the function. The preferred method to check for | |
1150 | this remains L<Scalar::Util/tainted>. | |
1151 | ||
1152 | =back | |
1153 | ||
1154 | =head3 L<perllol> | |
1155 | ||
1156 | =over | |
1157 | ||
1158 | =item * | |
1159 | ||
1160 | L<perllol> has been expanded with examples using the new C<push $scalar> | |
1161 | syntax introduced in Perl 5.14.0 (5.14.1). | |
1162 | ||
1163 | =back | |
1164 | ||
1165 | =head3 L<perlmod> | |
1166 | ||
1167 | =over | |
1168 | ||
1169 | =item * | |
1170 | ||
1171 | L<perlmod> now states explicitly that some types of explicit symbol table | |
1172 | manipulation are not supported. This codifies what was effectively already | |
1173 | the case [perl #78074]. | |
1174 | ||
1175 | =back | |
1176 | ||
1177 | =head3 L<perlpodstyle> | |
1178 | ||
1179 | =over 4 | |
1180 | ||
1181 | =item * | |
1182 | ||
1183 | The tips on which formatting codes to use have been corrected and greatly | |
1184 | expanded. | |
1185 | ||
1186 | =item * | |
1187 | ||
1188 | There are now a couple of example one-liners for previewing POD files after | |
1189 | they have been edited. | |
1190 | ||
1191 | =back | |
1192 | ||
1193 | =head3 L<perlre> | |
1194 | ||
1195 | =over | |
1196 | ||
1197 | =item * | |
1198 | ||
1199 | The C<(*COMMIT)> directive is now listed in the right section | |
1200 | (L<Verbs without an argument|perlre/Verbs without an argument>). | |
1201 | ||
1202 | =back | |
1203 | ||
1204 | =head3 L<perlrun> | |
1205 | ||
1206 | =over | |
1207 | ||
1208 | =item * | |
1209 | ||
1210 | L<perlrun> has undergone a significant clean-up. Most notably, the | |
1211 | B<-0x...> form of the B<-0> flag has been clarified, and the final section | |
1212 | on environment variables has been corrected and expanded (5.14.1). | |
1213 | ||
1214 | =back | |
1215 | ||
1216 | =head3 L<perlsub> | |
1217 | ||
1218 | =over | |
1219 | ||
1220 | =item * | |
1221 | ||
1222 | The ($;) prototype syntax, which has existed for rather a long time, is now | |
1223 | documented in L<perlsub>. It allows a unary function to have the same | |
1224 | precedence as a list operator. | |
1225 | ||
1226 | =back | |
1227 | ||
1228 | =head3 L<perltie> | |
1229 | ||
1230 | =over | |
1231 | ||
1232 | =item * | |
1233 | ||
1234 | The required syntax for tying handles has been documented. | |
1235 | ||
1236 | =back | |
1237 | ||
1238 | =head3 L<perlvar> | |
1239 | ||
1240 | =over | |
1241 | ||
1242 | =item * | |
1243 | ||
1244 | The documentation for L<$!|perlvar/$!> has been corrected and clarified. | |
1245 | It used to state that $! could be C<undef>, which is not the case. It was | |
1246 | also unclear as to whether system calls set C's C<errno> or Perl's C<$!> | |
1247 | [perl #91614]. | |
1248 | ||
1249 | =item * | |
1250 | ||
1251 | Documentation for L<$$|perlvar/$$> has been amended with additional | |
1252 | cautions regarding changing the process ID. | |
1253 | ||
1254 | =back | |
1255 | ||
1256 | =head3 Other Changes | |
1257 | ||
1258 | =over 4 | |
1259 | ||
1260 | =item * | |
1261 | ||
1262 | L<perlxs> was extended with documentation on inline typemaps. | |
1263 | ||
1264 | =item * | |
1265 | ||
1266 | L<perlref> has a new L<Circular References|perlref/Circular References> | |
1267 | section explaining how circularities may not be freed and how to solve that | |
1268 | with weak references. | |
1269 | ||
1270 | =item * | |
1271 | ||
1272 | Parts of L<perlapi> were clarified, and Perl equivalents of some C | |
1273 | functions have been added as an additional mode of exposition. | |
1274 | ||
1275 | =item * | |
1276 | ||
1277 | A few parts of L<perlre> and L<perlrecharclass> were clarified. | |
1278 | ||
1279 | =back | |
1280 | ||
1281 | =head2 Removed Documentation | |
1282 | ||
1283 | =head3 Old OO Documentation | |
1284 | ||
1285 | All the old OO tutorials, perltoot, perltooc, and perlboot, have been | |
1286 | removed. The perlbot (bag of object tricks) document has been removed | |
1287 | as well. | |
1288 | ||
1289 | =head3 Development Deltas | |
1290 | ||
1291 | The perldelta files for development releases are no longer packaged with | |
1292 | perl. These can still be found in the perl source code repository. | |
1293 | ||
1294 | =head1 Diagnostics | |
1295 | ||
1296 | The following additions or changes have been made to diagnostic output, | |
1297 | including warnings and fatal error messages. For the complete list of | |
1298 | diagnostic messages, see L<perldiag>. | |
1299 | ||
1300 | =head2 New Diagnostics | |
1301 | ||
1302 | =head3 New Errors | |
1303 | ||
1304 | =over 4 | |
1305 | ||
1306 | =item * | |
1307 | ||
1308 | L<Cannot set tied @DB::args|perldiag/"Cannot set tied @DB::args"> | |
1309 | ||
1310 | This error occurs when C<caller> tries to set C<@DB::args> but finds it | |
1311 | tied. Before this error was added, it used to crash instead. | |
1312 | ||
1313 | =item * | |
1314 | ||
1315 | L<Cannot tie unreifiable array|perldiag/"Cannot tie unreifiable array"> | |
1316 | ||
1317 | This error is part of a safety check that the C<tie> operator does before | |
1318 | tying a special array like C<@_>. You should never see this message. | |
1319 | ||
1320 | =item * | |
1321 | ||
1322 | L<&CORE::%s cannot be called directly|perldiag/"&CORE::%s cannot be called directly"> | |
1323 | ||
1324 | This occurs when a subroutine in the C<CORE::> namespace is called | |
1325 | with C<&foo> syntax or through a reference. Some subroutines | |
1326 | in this package cannot yet be called that way, but must be | |
1327 | called as barewords. See L</Subroutines in the C<CORE> namespace>, above. | |
1328 | ||
1329 | =item * | |
1330 | ||
1331 | L<Source filters apply only to byte streams|perldiag/"Source filters apply only to byte streams"> | |
1332 | ||
1333 | This new error occurs when you try to activate a source filter (usually by | |
1334 | loading a source filter module) within a string passed to C<eval> under the | |
1335 | C<unicode_eval> feature. | |
1336 | ||
1337 | =back | |
1338 | ||
1339 | =head3 New Warnings | |
1340 | ||
1341 | =over 4 | |
1342 | ||
1343 | =item * | |
1344 | ||
1345 | L<defined(@array) is deprecated|perldiag/"defined(@array) is deprecated"> | |
1346 | ||
1347 | The long-deprecated C<defined(@array)> now also warns for package variables. | |
1348 | Previously it only issued a warning for lexical variables. | |
1349 | ||
1350 | =item * | |
1351 | ||
1352 | L<length() used on %s|perldiag/length() used on %s> | |
1353 | ||
1354 | This new warning occurs when C<length> is used on an array or hash, instead | |
1355 | of C<scalar(@array)> or C<scalar(keys %hash)>. | |
1356 | ||
1357 | =item * | |
1358 | ||
1359 | L<lvalue attribute %s already-defined subroutine|perldiag/"lvalue attribute %s already-defined subroutine"> | |
1360 | ||
1361 | L<attributes.pm|attributes> now emits this warning when the :lvalue | |
1362 | attribute is applied to a Perl subroutine that has already been defined, as | |
1363 | doing so can have unexpected side-effects. | |
1364 | ||
1365 | =item * | |
1366 | ||
1367 | L<overload arg '%s' is invalid|perldiag/"overload arg '%s' is invalid"> | |
1368 | ||
1369 | This warning, in the "overload" category, is produced when the overload | |
1370 | pragma is given an argument it doesn't recognize, presumably a mistyped | |
1371 | operator. | |
1372 | ||
1373 | =item * | |
1374 | ||
1375 | L<$[ used in %s (did you mean $] ?)|perldiag/"$[ used in %s (did you mean $] ?)"> | |
1376 | ||
1377 | This new warning exists to catch the mistaken use of C<$[> in version | |
1378 | checks. C<$]>, not C<$[>, contains the version number. | |
1379 | ||
1380 | =item * | |
1381 | ||
1382 | L<Useless assignment to a temporary|perldiag/"Useless assignment to a temporary"> | |
1383 | ||
1384 | Assigning to a temporary scalar returned | |
1385 | from an lvalue subroutine now produces this | |
1386 | warning [perl #31946]. | |
1387 | ||
1388 | =item * | |
1389 | ||
1390 | L<Useless use of \E|perldiag/"Useless use of \E"> | |
1391 | ||
1392 | C<\E> does nothing unless preceded by C<\Q>, C<\L> or C<\U>. | |
1393 | ||
1394 | =back | |
1395 | ||
1396 | =head2 Removed Errors | |
1397 | ||
1398 | =over | |
1399 | ||
1400 | =item * | |
1401 | ||
1402 | "sort is now a reserved word" | |
1403 | ||
1404 | This error used to occur when C<sort> was called without arguments, | |
1405 | followed by C<;> or C<)>. (E.g., C<sort;> would die, but C<{sort}> was | |
1406 | OK.) This error message was added in Perl 3 to catch code like | |
1407 | C<close(sort)> which would no longer work. More than two decades later, | |
1408 | this message is no longer appropriate. Now C<sort> without arguments is | |
1409 | always allowed, and returns an empty list, as it did in those cases | |
1410 | where it was already allowed [perl #90030]. | |
1411 | ||
1412 | =back | |
1413 | ||
1414 | =head2 Changes to Existing Diagnostics | |
1415 | ||
1416 | =over 4 | |
1417 | ||
1418 | =item * | |
1419 | ||
1420 | The "Applying pattern match..." or similar warning produced when an | |
1421 | array or hash is on the left-hand side of the C<=~> operator now | |
1422 | mentions the name of the variable. | |
1423 | ||
1424 | =item * | |
1425 | ||
1426 | The "Attempt to free non-existent shared string" has had the spelling | |
1427 | of "non-existent" corrected to "nonexistent". It was already listed | |
1428 | with the correct spelling in L<perldiag>. | |
1429 | ||
1430 | =item * | |
1431 | ||
1432 | The error messages for using C<default> and C<when> outside of a | |
1433 | topicalizer have been standardised to match the messages for C<continue> | |
1434 | and loop controls. They now read 'Can't "default" outside a | |
1435 | topicalizer' and 'Can't "when" outside a topicalizer'. They both used | |
1436 | to be 'Can't use when() outside a topicalizer' [perl #91514]. | |
1437 | ||
1438 | =item * | |
1439 | ||
1440 | The message, "Code point 0x%X is not Unicode, no properties match it; | |
1441 | all inverse properties do" has been changed to "Code point 0x%X is not | |
1442 | Unicode, all \p{} matches fail; all \P{} matches succeed". | |
1443 | ||
1444 | =item * | |
1445 | ||
1446 | Redefinition warnings for constant subroutines used to be mandatory, | |
1447 | even occurring under C<no warnings>. Now they respect the L<warnings> | |
1448 | pragma. | |
1449 | ||
1450 | =item * | |
1451 | ||
1452 | The "glob failed" warning message is now suppressible via C<no warnings> | |
1453 | [perl #111656]. | |
1454 | ||
1455 | =item * | |
1456 | ||
1457 | The L<Invalid version format|perldiag/"Invalid version format (%s)"> | |
1458 | error message now says "negative version number" within the parentheses, | |
1459 | rather than "non-numeric data", for negative numbers. | |
1460 | ||
1461 | =item * | |
1462 | ||
1463 | The two warnings | |
1464 | L<Possible attempt to put comments in qw() list|perldiag/"Possible attempt to put comments in qw() list"> | |
1465 | and | |
1466 | L<Possible attempt to separate words with commas|perldiag/"Possible attempt to separate words with commas"> | |
1467 | are no longer mutually exclusive: the same C<qw> construct may produce | |
1468 | both. | |
1469 | ||
1470 | =item * | |
1471 | ||
1472 | The uninitialized warning for C<y///r> when C<$_> is implicit and | |
1473 | undefined now mentions the variable name, just like the non-/r variation | |
1474 | of the operator. | |
1475 | ||
1476 | =item * | |
1477 | ||
1478 | The 'Use of "foo" without parentheses is ambiguous' warning has been | |
1479 | extended to apply also to user-defined subroutines with a (;$) | |
1480 | prototype, and not just to built-in functions. | |
1481 | ||
1482 | =item * | |
1483 | ||
1484 | Warnings that mention the names of lexical (C<my>) variables with | |
1485 | Unicode characters in them now respect the presence or absence of the | |
1486 | C<:utf8> layer on the output handle, instead of outputting UTF8 | |
1487 | regardless. Also, the correct names are included in the strings passed | |
1488 | to C<$SIG{__WARN__}> handlers, rather than the raw UTF8 bytes. | |
1489 | ||
1490 | =back | |
1491 | ||
1492 | =head1 Utility Changes | |
1493 | ||
1494 | =head3 L<h2ph> | |
1495 | ||
1496 | =over 4 | |
1497 | ||
1498 | =item * | |
1499 | ||
1500 | L<h2ph> used to generate code of the form | |
1501 | ||
1502 | unless(defined(&FOO)) { | |
1503 | sub FOO () {42;} | |
1504 | } | |
1505 | ||
1506 | But the subroutine is a compile-time declaration, and is hence unaffected | |
1507 | by the condition. It has now been corrected to emit a string C<eval> | |
1508 | around the subroutine [perl #99368]. | |
1509 | ||
1510 | =back | |
1511 | ||
1512 | =head3 L<splain> | |
1513 | ||
1514 | =over 4 | |
1515 | ||
1516 | =item * | |
1517 | ||
1518 | F<splain> no longer emits backtraces with the first line number repeated. | |
1519 | ||
1520 | This: | |
1521 | ||
1522 | Uncaught exception from user code: | |
1523 | Cannot fwiddle the fwuddle at -e line 1. | |
1524 | at -e line 1 | |
1525 | main::baz() called at -e line 1 | |
1526 | main::bar() called at -e line 1 | |
1527 | main::foo() called at -e line 1 | |
1528 | ||
1529 | has become this: | |
1530 | ||
1531 | Uncaught exception from user code: | |
1532 | Cannot fwiddle the fwuddle at -e line 1. | |
1533 | main::baz() called at -e line 1 | |
1534 | main::bar() called at -e line 1 | |
1535 | main::foo() called at -e line 1 | |
1536 | ||
1537 | =item * | |
1538 | ||
1539 | Some error messages consist of multiple lines that are listed as separate | |
1540 | entries in L<perldiag>. splain has been taught to find the separate | |
1541 | entries in these cases, instead of simply failing to find the message. | |
1542 | ||
1543 | =back | |
1544 | ||
1545 | =head3 L<zipdetails> | |
1546 | ||
1547 | =over 4 | |
1548 | ||
1549 | =item * | |
1550 | ||
1551 | This is a new utility, included as part of an | |
1552 | L<IO::Compress::Base> upgrade. | |
1553 | ||
1554 | L<zipdetails> displays information about the internal record structure | |
1555 | of the zip file. It is not concerned with displaying any details of | |
1556 | the compressed data stored in the zip file. | |
1557 | ||
1558 | =back | |
1559 | ||
1560 | =head1 Configuration and Compilation | |
1561 | ||
1562 | =over 4 | |
1563 | ||
1564 | =item * | |
1565 | ||
1566 | F<regexp.h> has been modified for compatibility with GCC's B<-Werror> | |
1567 | option, as used by some projects that include perl's header files (5.14.1). | |
1568 | ||
1569 | =item * | |
1570 | ||
1571 | C<USE_LOCALE{,_COLLATE,_CTYPE,_NUMERIC}> have been added the output of perl -V | |
1572 | as they have affect the behaviour of the interpreter binary (albeit only | |
1573 | in a small area). | |
1574 | ||
1575 | =item * | |
1576 | ||
1577 | The code and tests for L<IPC::Open2> have been moved from F<ext/IPC-Open2> | |
1578 | into F<ext/IPC-Open3>, as C<IPC::Open2::open2()> is implemented as a thin | |
1579 | wrapper around C<IPC::Open3::_open3()>, and hence is very tightly coupled to | |
1580 | it. | |
1581 | ||
1582 | =item * | |
1583 | ||
1584 | The magic types and magic vtables are now generated from data in a new script | |
1585 | F<regen/mg_vtable.pl>, instead of being maintained by hand. As different | |
1586 | EBCDIC variants can't agree on the code point for '~', the character to code | |
1587 | point conversion is done at build time by F<generate_uudmap> to a new generated | |
1588 | header F<mg_data.h>. C<PL_vtbl_bm> and C<PL_vtbl_fm> are now defined by the | |
1589 | pre-processor as C<PL_vtbl_regexp>, instead of being distinct C variables. | |
1590 | C<PL_vtbl_sig> has been removed. | |
1591 | ||
1592 | =item * | |
1593 | ||
1594 | Building with C<-DPERL_GLOBAL_STRUCT> works again. This configuration is not | |
1595 | generally used. | |
1596 | ||
1597 | =item * | |
1598 | ||
1599 | Perl configured with I<MAD> now correctly frees C<MADPROP> structures when | |
1600 | OPs are freed. C<MADPROP>s are now allocated with C<PerlMemShared_malloc()> | |
1601 | ||
1602 | =item * | |
1603 | ||
1604 | F<makedef.pl> has been refactored. This should have no noticeable affect on | |
1605 | any of the platforms that use it as part of their build (AIX, VMS, Win32). | |
1606 | ||
1607 | =item * | |
1608 | ||
1609 | C<useperlio> can no longer be disabled. | |
1610 | ||
1611 | =item * | |
1612 | ||
1613 | The file F<global.sym> is no longer needed, and has been removed. It | |
1614 | contained a list of all exported functions, one of the files generated by | |
1615 | F<regen/embed.pl> from data in F<embed.fnc> and F<regen/opcodes>. The code | |
1616 | has been refactored so that the only user of F<global.sym>, F<makedef.pl>, | |
1617 | now reads F<embed.fnc> and F<regen/opcodes> directly, removing the need to | |
1618 | store the list of exported functions in an intermediate file. | |
1619 | ||
1620 | As F<global.sym> was never installed, this change should not be visible | |
1621 | outside the build process. | |
1622 | ||
1623 | =item * | |
1624 | ||
1625 | F<pod/buildtoc>, used by the build process to build L<perltoc>, has been | |
1626 | refactored and simplified. It now only contains code to build L<perltoc>; | |
1627 | the code to regenerate Makefiles has been moved to F<Porting/pod_rules.pl>. | |
1628 | It's a bug if this change has any material effect on the build process. | |
1629 | ||
1630 | =item * | |
1631 | ||
1632 | F<pod/roffitall> is now built by F<pod/buildtoc>, instead of being | |
1633 | shipped with the distribution. Its list of manpages is now generated | |
1634 | (and therefore current). See also RT #103202 for an unresolved related | |
1635 | issue. | |
1636 | ||
1637 | =item * | |
1638 | ||
1639 | The man page for C<XS::Typemap> is no longer installed. C<XS::Typemap> | |
1640 | is a test module which is not installed, hence installing its | |
1641 | documentation makes no sense. | |
1642 | ||
1643 | =item * | |
1644 | ||
1645 | The -Dusesitecustomize and -Duserelocatableinc options now work | |
1646 | together properly. | |
1647 | ||
1648 | =back | |
1649 | ||
1650 | =head1 Platform Support | |
1651 | ||
1652 | =head2 Platform-Specific Notes | |
1653 | ||
1654 | =head3 Cygwin | |
1655 | ||
1656 | =over 4 | |
1657 | ||
1658 | =item * | |
1659 | ||
1660 | Since version 1.7, Cygwin supports native UTF-8 paths. If Perl is built | |
1661 | under that environment, directory and filenames will be UTF-8 encoded. | |
1662 | ||
1663 | Cygwin does not initialize all original Win32 environment variables. See | |
1664 | F<README.cygwin> for a discussion of the newly-added | |
1665 | C<Cygwin::sync_winenv()> function [perl #110190] and for | |
1666 | further links. | |
1667 | ||
1668 | =back | |
1669 | ||
1670 | =head3 HP-UX | |
1671 | ||
1672 | =over 4 | |
1673 | ||
1674 | =item * | |
1675 | ||
1676 | HP-UX PA-RISC/64 now supports gcc-4.x | |
1677 | ||
1678 | A fix to correct the socketsize now makes the test suite pass on HP-UX | |
1679 | PA-RISC for 64bitall builds. | |
1680 | ||
1681 | =back | |
1682 | ||
1683 | =head3 VMS | |
1684 | ||
1685 | =over 4 | |
1686 | ||
1687 | =item * | |
1688 | ||
1689 | Remove unnecessary includes, fix miscellaneous compiler warnings and | |
1690 | close some unclosed comments on F<vms/vms.c>. | |
1691 | ||
1692 | Remove sockadapt layer from the VMS build. | |
1693 | ||
1694 | =item * | |
1695 | ||
1696 | Explicit support for VMS versions prior to v7.0 and DEC C versions | |
1697 | prior to v6.0 has been removed. | |
1698 | ||
1699 | =item * | |
1700 | ||
1701 | Since Perl 5.10.1, the home-grown C<stat> wrapper has been unable to | |
1702 | distinguish between a directory name containing an underscore and an | |
1703 | otherwise-identical filename containing a dot in the same position | |
1704 | (e.g., t/test_pl as a directory and t/test.pl as a file). This problem | |
1705 | has been corrected. | |
1706 | ||
1707 | =item * | |
1708 | ||
1709 | The build on VMS now allows names of the resulting symbols in C code for | |
1710 | Perl longer than 31 characters. Symbols like | |
1711 | C<Perl__it_was_the_best_of_times_it_was_the_worst_of_times> can now be | |
1712 | created freely without causing the VMS linker to seize up. | |
1713 | ||
1714 | =back | |
1715 | ||
1716 | =head3 GNU/Hurd | |
1717 | ||
1718 | Numerous build and test failures on GNU/Hurd have been resolved with hints | |
1719 | for building DBM modules, detection of the library search path, and enabling | |
1720 | of large file support. | |
1721 | ||
1722 | =head3 OpenVOS | |
1723 | ||
1724 | Perl is now built with dynamic linking on OpenVOS, the minimum supported | |
1725 | version of which is now Release 17.1.0. | |
1726 | ||
1727 | =head3 SunOS | |
1728 | ||
1729 | The CC workshop C++ compiler is now detected and used on systems that ship | |
1730 | without cc. | |
1731 | ||
1732 | =head1 Internal Changes | |
1733 | ||
1734 | =over 4 | |
1735 | ||
1736 | =item * | |
1737 | ||
1738 | The compiled representation of formats is now stored via the C<mg_ptr> of | |
1739 | their C<PERL_MAGIC_fm>. Previously it was stored in the string buffer, | |
1740 | beyond C<SvLEN()>, the regular end of the string. C<SvCOMPILED()> and | |
1741 | C<SvCOMPILED_{on,off}()> now exist solely for compatibility for XS code. | |
1742 | The first is always 0, the other two now no-ops. (5.14.1) | |
1743 | ||
1744 | =item * | |
1745 | ||
1746 | Some global variables have been marked C<const>, members in the interpreter | |
1747 | structure have been re-ordered, and the opcodes have been re-ordered. The | |
1748 | op C<OP_AELEMFAST> has been split into C<OP_AELEMFAST> and C<OP_AELEMFAST_LEX>. | |
1749 | ||
1750 | =item * | |
1751 | ||
1752 | When empting a hash of its elements (e.g. via undef(%h), or %h=()), HvARRAY | |
1753 | field is no longer temporarily zeroed. Any destructors called on the freed | |
1754 | elements see the remaining elements. Thus, %h=() becomes more like | |
1755 | C<delete $h{$_} for keys %h>. | |
1756 | ||
1757 | =item * | |
1758 | ||
1759 | Boyer-Moore compiled scalars are now PVMGs, and the Boyer-Moore tables are now | |
1760 | stored via the mg_ptr of their C<PERL_MAGIC_bm>. | |
1761 | Previously they were PVGVs, with the tables stored in | |
1762 | the string buffer, beyond C<SvLEN()>. This eliminates | |
1763 | the last place where the core stores data beyond C<SvLEN()>. | |
1764 | ||
1765 | =item * | |
1766 | ||
1767 | Simplified logic in C<Perl_sv_magic()> introduces a small change of | |
1768 | behaviour for error cases involving unknown magic types. Previously, if | |
1769 | C<Perl_sv_magic()> was passed a magic type unknown to it, it would | |
1770 | ||
1771 | =over | |
1772 | ||
1773 | =item 1. | |
1774 | ||
1775 | Croak "Modification of a read-only value attempted" if read only | |
1776 | ||
1777 | =item 2. | |
1778 | ||
1779 | Return without error if the SV happened to already have this magic | |
1780 | ||
1781 | =item 3. | |
1782 | ||
1783 | otherwise croak "Don't know how to handle magic of type \\%o" | |
1784 | ||
1785 | =back | |
1786 | ||
1787 | Now it will always croak "Don't know how to handle magic of type \\%o", even | |
1788 | on read only values, or SVs which already have the unknown magic type. | |
1789 | ||
1790 | =item * | |
1791 | ||
1792 | The experimental C<fetch_cop_label> function has been renamed to | |
1793 | C<cop_fetch_label>. | |
1794 | ||
1795 | =item * | |
1796 | ||
1797 | The C<cop_store_label> function has been added to the API, but is | |
1798 | experimental. | |
1799 | ||
1800 | =item * | |
1801 | ||
1802 | F<embedvar.h> has been simplified, and one level of macro indirection for | |
1803 | PL_* variables has been removed for the default (non-multiplicity) | |
1804 | configuration. PERLVAR*() macros now directly expand their arguments to | |
1805 | tokens such as C<PL_defgv>, instead of expanding to C<PL_Idefgv>, with | |
1806 | F<embedvar.h> defining a macro to map C<PL_Idefgv> to C<PL_defgv>. XS code | |
1807 | which has unwarranted chumminess with the implementation may need updating. | |
1808 | ||
1809 | =item * | |
1810 | ||
1061b56a FC |
1811 | A C<coreargs> opcode has been added, to be used by C<&CORE::foo> subs to sort |
1812 | out C<@_>. | |
1813 | ||
1814 | =item * | |
1815 | ||
05c8f9ed RS |
1816 | An API has been added to explicitly choose whether or not to export XSUB |
1817 | symbols. More detail can be found in the comments for commit e64345f8. | |
1818 | ||
1819 | =item * | |
1820 | ||
1821 | The C<is_gv_magical_sv> function has been eliminated and merged with | |
1822 | C<gv_fetchpvn_flags>. It used to be called to determine whether a GV | |
1823 | should be autovivified in rvalue context. Now it has been replaced with a | |
1824 | new C<GV_ADDMG> flag (not part of the API). | |
1825 | ||
1826 | =item * | |
1827 | ||
1828 | The returned code point from the function C<utf8n_to_uvuni()> | |
449d5120 RS |
1829 | when the input is malformed UTF-8, malformations are allowed, and |
1830 | C<utf8> warnings are off is now the Unicode REPLACEMENT CHARACTER | |
1831 | whenever the malformation is such that no well-defined code point can be | |
1832 | computed. Previously the returned value was essentially garbage. The | |
1833 | only malformations that have well-defined values are a zero-length | |
1834 | string (0 is the return), and overlong UTF-8 sequences. | |
1835 | ||
1836 | =item * | |
1837 | ||
1838 | The returned code point from the function C<utf8n_to_uvuni()> | |
05c8f9ed RS |
1839 | when the input is malformed UTF-8, malformations are allowed, and |
1840 | C<utf8> warnings are off is now the Unicode REPLACEMENT CHARACTER | |
1841 | whenever the malformation is such that no well-defined code point can be | |
1842 | computed. Previously the returned value was essentially garbage. The | |
1843 | only malformations that have well-defined values are a zero-length | |
1844 | string (0 is the return), and overlong UTF-8 sequences. | |
1845 | ||
1846 | =item * | |
1847 | ||
1848 | Padlists are now marked C<AvREAL>; i.e., reference-counted. They have | |
1849 | always been reference-counted, but were not marked real, because F<pad.c> | |
1850 | did its own clean-up, instead of using the usual clean-up code in F<sv.c>. | |
1851 | That caused problems in thread cloning, so now the C<AvREAL> flag is on, | |
1852 | but is turned off in F<pad.c> right before the padlist is freed (after | |
1853 | F<pad.c> has done its custom freeing of the pads). | |
1854 | ||
1855 | =item * | |
1856 | ||
1857 | All the C files that make up the Perl core have been converted to UTF-8. | |
1858 | ||
1859 | =item * | |
1860 | ||
1861 | These new functions have been added as part of the work on Unicode symbols: | |
1862 | ||
1863 | HvNAMELEN | |
1864 | HvNAMEUTF8 | |
1865 | HvENAMELEN | |
1866 | HvENAMEUTF8 | |
1867 | gv_init_pv | |
1868 | gv_init_pvn | |
1869 | gv_init_pvsv | |
1870 | gv_fetchmeth_pv | |
1871 | gv_fetchmeth_pvn | |
1872 | gv_fetchmeth_sv | |
1873 | gv_fetchmeth_pv_autoload | |
1874 | gv_fetchmeth_pvn_autoload | |
1875 | gv_fetchmeth_sv_autoload | |
1876 | gv_fetchmethod_pv_flags | |
1877 | gv_fetchmethod_pvn_flags | |
1878 | gv_fetchmethod_sv_flags | |
1879 | gv_autoload_pv | |
1880 | gv_autoload_pvn | |
1881 | gv_autoload_sv | |
1882 | newGVgen_flags | |
1883 | sv_derived_from_pv | |
1884 | sv_derived_from_pvn | |
1885 | sv_derived_from_sv | |
1886 | sv_does_pv | |
1887 | sv_does_pvn | |
1888 | sv_does_sv | |
1889 | whichsig_pv | |
1890 | whichsig_pvn | |
1891 | whichsig_sv | |
1892 | newCONSTSUB_flags | |
1893 | ||
1894 | The gv_fetchmethod_*_flags functions, like gv_fetchmethod_flags, are | |
1895 | experimental and may change in a future release. | |
1896 | ||
1897 | =item * | |
1898 | ||
1899 | The following functions were added. These are I<not> part of the API: | |
1900 | ||
1901 | GvNAMEUTF8 | |
1902 | GvENAMELEN | |
1903 | GvENAME_HEK | |
1904 | CopSTASH_flags | |
1905 | CopSTASH_flags_set | |
1906 | PmopSTASH_flags | |
1907 | PmopSTASH_flags_set | |
1908 | sv_sethek | |
1909 | HEKfARG | |
1910 | ||
1911 | There is also a C<HEKf> macro corresponding to C<SVf>, for | |
1912 | interpolating HEKs in formatted strings. | |
1913 | ||
1914 | =item * | |
1915 | ||
1916 | C<sv_catpvn_flags> takes a couple of new internal-only flags, | |
1917 | C<SV_CATBYTES> and C<SV_CATUTF8>, which tell it whether the char array to | |
1918 | be concatenated is UTF8. This allows for more efficient concatenation than | |
1919 | creating temporary SVs to pass to C<sv_catsv>. | |
1920 | ||
1921 | =item * | |
1922 | ||
1923 | For XS AUTOLOAD subs, $AUTOLOAD is set once more, as it was in 5.6.0. This | |
1924 | is in addition to setting C<SvPVX(cv)>, for compatibility with 5.8 to 5.14. | |
1925 | See L<perlguts/Autoloading with XSUBs>. | |
1926 | ||
1927 | =item * | |
1928 | ||
1929 | Perl now checks whether the array (the linearised isa) returned by a MRO | |
1930 | plugin begins with the name of the class itself, for which the array was | |
1931 | created, instead of assuming that it does. This prevents the first element | |
1932 | from being skipped during method lookup. It also means that | |
1933 | C<mro::get_linear_isa> may return an array with one more element than the | |
1934 | MRO plugin provided [perl #94306]. | |
1935 | ||
1936 | =item * | |
1937 | ||
1938 | C<PL_curstash> is now reference-counted. | |
1939 | ||
1940 | =item * | |
1941 | ||
1942 | There are now feature bundle hints in C<PL_hints> (C<$^H>) that version | |
1943 | declarations use, to avoid having to load F<feature.pm>. One setting of | |
1944 | the hint bits indicates a "custom" feature bundle, which means that the | |
1945 | entries in C<%^H> still apply. F<feature.pm> uses that. | |
1946 | ||
1947 | The C<HINT_FEATURE_MASK> macro is defined in F<perl.h> along with other | |
1948 | hints. Other macros for setting and testing features and bundles are in | |
1949 | the new F<feature.h>. C<FEATURE_IS_ENABLED> (which has moved to | |
1950 | F<feature.h>) is no longer used throughout the codebase, but more specific | |
1951 | macros, e.g., C<FEATURE_SAY_IS_ENABLED>, that are defined in F<feature.h>. | |
1952 | ||
1953 | =item * | |
1954 | ||
1955 | F<lib/feature.pm> is now a generated file, created by the new | |
1956 | F<regen/feature.pl> script, which also generates F<feature.h>. | |
1957 | ||
1958 | =item * | |
1959 | ||
1960 | Tied arrays are now always C<AvREAL>. If C<@_> or C<DB::args> is tied, it | |
1961 | is reified first, to make sure this is always the case. | |
1962 | ||
1963 | =item * | |
1964 | ||
1965 | Two new functions C<utf8_to_uvchr_buf()> and C<utf8_to_uvuni_buf()> have | |
1966 | been added. These are the same as C<utf8_to_uvchr> and | |
1967 | C<utf8_to_uvuni> (which are now deprecated), but take an extra parameter | |
1968 | that is used to guard against reading beyond the end of the input | |
1969 | string. | |
1970 | See L<perlapi/utf8_to_uvchr_buf> and L<perlapi/utf8_to_uvuni_buf>. | |
1971 | ||
1972 | =item * | |
1973 | ||
1974 | The regular expression engine now does TRIE case insensitive matches | |
1975 | under Unicode. This may change the output of C<< use re 'debug'; >>, | |
1976 | and will speed up various things. | |
1977 | ||
1978 | =item * | |
1979 | ||
1980 | There is a new C<wrap_op_checker()> function, which provides a thread-safe | |
1981 | alternative to writing to C<PL_check> directly. | |
1982 | ||
1983 | =back | |
1984 | ||
1985 | =head1 Selected Bug Fixes | |
1986 | ||
1987 | =head2 Array and hash | |
1988 | ||
1989 | =over | |
1990 | ||
1991 | =item * | |
1992 | ||
1993 | A bug has been fixed that would cause a "Use of freed value in iteration" | |
1994 | error if the next two hash elements that would be iterated over are | |
1995 | deleted [perl #85026]. (5.14.1) | |
1996 | ||
1997 | =item * | |
1998 | ||
1999 | Deleting the current hash iterator (the hash element that would be returend | |
2000 | by the next call to C<each>) in void context used not to free it | |
2001 | [perl #85026]. | |
2002 | ||
2003 | =item * | |
2004 | ||
2005 | Deletion of methods via C<delete $Class::{method}> syntax used to update | |
2006 | method caches if called in void context, but not scalar or list context. | |
2007 | ||
2008 | =item * | |
2009 | ||
2010 | When hash elements are deleted in void context, the internal hash entry is | |
2011 | now freed before the value is freed, to prevent destructors called by that | |
2012 | latter freeing from seeing the hash in an inconsistent state. It was | |
2013 | possible to cause double-frees if the destructor freed the hash itself | |
2014 | [perl #100340]. | |
2015 | ||
2016 | =item * | |
2017 | ||
2018 | A C<keys> optimisation in Perl 5.12.0 to make it faster on empty hashes | |
2019 | caused C<each> not to reset the iterator if called after the last element | |
2020 | was deleted. | |
2021 | ||
2022 | =item * | |
2023 | ||
2024 | Freeing deeply nested hashes no longer crashes [perl #44225]. | |
2025 | ||
2026 | =item * | |
2027 | ||
2028 | It is possible from XS code to create hashes with elements that have no | |
2029 | values. The hash element and slice operators used to crash | |
2030 | when handling these in lvalue context. They now | |
2031 | produce a "Modification of non-creatable hash value attempted" error | |
2032 | message. | |
2033 | ||
2034 | =item * | |
2035 | ||
2036 | If list assignment to a hash or array triggered destructors that freed the | |
2037 | hash or array itself, a crash would ensue. This is no longer the case | |
2038 | [perl #107440]. | |
2039 | ||
2040 | =item * | |
2041 | ||
2042 | It used to be possible to free the typeglob of a localised array or hash | |
2043 | (e.g., C<local @{"x"}; delete $::{x}>), resulting in a crash on scope exit. | |
2044 | ||
2045 | =item * | |
2046 | ||
2047 | Some core bugs affecting L<Hash::Util> have been fixed: locking a hash | |
2048 | element that is a glob copy no longer causes subsequent assignment to it to | |
2049 | corrupt the glob, and unlocking a hash element that holds a copy-on-write | |
2050 | scalar no longer causes modifications to that scalar to modify other | |
2051 | scalars that were sharing the same string buffer. | |
2052 | ||
2053 | =back | |
2054 | ||
2055 | =head2 C API fixes | |
2056 | ||
2057 | =over | |
2058 | ||
2059 | =item * | |
2060 | ||
2061 | The C<newHVhv> XS function now works on tied hashes, instead of crashing or | |
2062 | returning an empty hash. | |
2063 | ||
2064 | =item * | |
2065 | ||
2066 | The C<SvIsCOW> C macro now returns false for read-only copies of typeglobs, | |
2067 | such as those created by: | |
2068 | ||
2069 | $hash{elem} = *foo; | |
2070 | Hash::Util::lock_value %hash, 'elem'; | |
2071 | ||
2072 | It used to return true. | |
2073 | ||
2074 | =item * | |
2075 | ||
2076 | The C<SvPVutf8> C function no longer tries to modify its argument, | |
2077 | resulting in errors [perl #108994]. | |
2078 | ||
2079 | =item * | |
2080 | ||
2081 | C<SvPVutf8> now works properly with magical variables. | |
2082 | ||
2083 | =item * | |
2084 | ||
2085 | C<SvPVbyte> now works properly non-PVs. | |
2086 | ||
2087 | =item * | |
2088 | ||
2089 | When presented with malformed UTF-8 input, the XS-callable functions | |
2090 | C<is_utf8_string()>, C<is_utf8_string_loc()>, and | |
2091 | C<is_utf8_string_loclen()> could read beyond the end of the input | |
2092 | string by up to 12 bytes. This no longer happens. [perl #32080]. | |
2093 | However, currently, C<is_utf8_char()> still has this defect, see | |
2094 | L</is_utf8_char()> above. | |
2095 | ||
2096 | =item * | |
2097 | ||
2098 | The C-level C<pregcomp> function could become confused as to whether the | |
2099 | pattern was in UTF8 if the pattern was an overloaded, tied, or otherwise | |
2100 | magical scalar [perl #101940]. | |
2101 | ||
2102 | =back | |
2103 | ||
2104 | =head2 Compile-time hints | |
2105 | ||
2106 | =over | |
2107 | ||
2108 | =item * | |
2109 | ||
2110 | Tying C<%^H> no longer causes perl to crash or ignore the contents of | |
2111 | C<%^H> when entering a compilation scope [perl #106282]. | |
2112 | ||
2113 | =item * | |
2114 | ||
2115 | C<eval $string> and C<require> used not to | |
2116 | localise C<%^H> during compilation if it | |
2117 | was empty at the time the C<eval> call itself was compiled. This could | |
2118 | lead to scary side effects, like C<use re "/m"> enabling other flags that | |
2119 | the surrounding code was trying to enable for its caller [perl #68750]. | |
2120 | ||
2121 | =item * | |
2122 | ||
2123 | C<eval $string> and C<require> no longer localise hints (C<$^H> and C<%^H>) | |
2124 | at run time, but only during compilation of the $string or required file. | |
2125 | This makes C<BEGIN { $^H{foo}=7 }> equivalent to | |
2126 | C<BEGIN { eval '$^H{foo}=7' }> [perl #70151]. | |
2127 | ||
2128 | =item * | |
2129 | ||
2130 | Creating a BEGIN block from XS code (via C<newXS> or C<newATTRSUB>) would, | |
2131 | on completion, make the hints of the current compiling code the current | |
2132 | hints. This could cause warnings to occur in a non-warning scope. | |
2133 | ||
2134 | =back | |
2135 | ||
2136 | =head2 Copy-on-write scalars | |
2137 | ||
2138 | Copy-on-write or shared hash key scalars | |
2139 | were introduced in 5.8.0, but most Perl code | |
2140 | did not encounter them (they were used mostly internally). Perl | |
2141 | 5.10.0 extended them, such that assigning C<__PACKAGE__> or a | |
2142 | hash key to a scalar would make it copy-on-write. Several parts | |
2143 | of Perl were not updated to account for them, but have now been fixed. | |
2144 | ||
2145 | =over | |
2146 | ||
2147 | =item * | |
2148 | ||
2149 | C<utf8::decode> had a nasty bug that would modify copy-on-write scalars' | |
2150 | string buffers in place (i.e., skipping the copy). This could result in | |
2151 | hashes having two elements with the same key [perl #91834]. | |
2152 | ||
2153 | =item * | |
2154 | ||
2155 | Lvalue subroutines were not allowing COW scalars to be returned. This was | |
2156 | fixed for lvalue scalar context in Perl 5.12.3 and 5.14.0, but list context | |
2157 | was not fixed until this release. | |
2158 | ||
2159 | =item * | |
2160 | ||
2161 | Elements of restricted hashes (see the L<fields> pragma) containing | |
2162 | copy-on-write values couldn't be deleted, nor could such hashes be cleared | |
2163 | (C<%hash = ()>). | |
2164 | ||
2165 | =item * | |
2166 | ||
2167 | Localising a tied variable used to make it read-only if it contained a | |
2168 | copy-on-write string. | |
2169 | ||
2170 | =item * | |
2171 | ||
2172 | Assigning a copy-on-write string to a stash | |
2173 | element no longer causes a double free. Regardless of this change, the | |
2174 | results of such assignments are still undefined. | |
2175 | ||
2176 | =item * | |
2177 | ||
2178 | Assigning a copy-on-write string to a tied variable no longer stops that | |
2179 | variable from being tied if it happens to be a PVMG or PVLV internally. | |
2180 | ||
2181 | =item * | |
2182 | ||
2183 | Doing a substitution on a tied variable returning a copy-on-write | |
2184 | scalar used to cause an assertion failure or an "Attempt to free | |
2185 | nonexistent shared string" warning. | |
2186 | ||
2187 | =item * | |
2188 | ||
2189 | This one is a regression from 5.12: In 5.14.0, the bitwise assignment | |
2190 | operators C<|=>, C<^=> and C<&=> started leaving the left-hand side | |
2191 | undefined if it happened to be a copy-on-write string [perl #108480]. | |
2192 | ||
2193 | =item * | |
2194 | ||
2195 | L<Storable>, L<Devel::Peek> and L<PerlIO::scalar> had similar problems. | |
2196 | See L</Updated Modules and Pragmata>, above. | |
2197 | ||
2198 | =back | |
2199 | ||
2200 | =head2 The debugger | |
2201 | ||
2202 | =over | |
2203 | ||
2204 | =item * | |
2205 | ||
2206 | F<dumpvar.pl>, and consequently the C<x> command in the debugger, have been | |
2207 | fixed to handle objects blessed into classes whose names contain "=". The | |
2208 | contents of such objects used not to be dumped [perl #101814]. | |
2209 | ||
2210 | =item * | |
2211 | ||
2212 | The "R" command for restarting a debugger session has been fixed to work on | |
2213 | Windows, or any other system lacking a C<POSIX::_SC_OPEN_MAX> constant | |
2214 | [perl #87740]. | |
2215 | ||
2216 | =item * | |
2217 | ||
2218 | The C<#line 42 foo> directive used not to update the arrays of lines used | |
2219 | by the debugger if it occurred in a string eval. This was partially fixed | |
2220 | in 5.14, but it only worked for a single C<#line 42 foo> in each eval. Now | |
2221 | it works for multiple. | |
2222 | ||
2223 | =item * | |
2224 | ||
2225 | When subroutine calls are intercepted by the debugger, the name of the | |
2226 | subroutine or a reference to it is stored in C<$DB::sub>, for the debugger | |
2227 | to access. In some cases (such as C<$foo = *bar; undef *bar; &$foo>) | |
2228 | C<$DB::sub> would be set to a name that could not be used to find the | |
2229 | subroutine, and so the debugger's attempt to call it would fail. Now the | |
2230 | check to see whether a reference is needed is more robust, so those | |
2231 | problems should not happen anymore [rt.cpan.org #69862]. | |
2232 | ||
2233 | =item * | |
2234 | ||
2235 | Every subroutine has a filename associated with it that the debugger uses. | |
2236 | The one associated with constant subroutines used to be misallocated when | |
2237 | cloned under threads. Consequently, debugging threaded applications could | |
2238 | result in memory corruption [perl #96126]. | |
2239 | ||
2240 | =back | |
2241 | ||
2242 | =head2 Dereferencing operators | |
2243 | ||
2244 | =over | |
2245 | ||
2246 | =item * | |
2247 | ||
2248 | C<defined(${"..."})>, C<defined(*{"..."})>, etc., used to | |
2249 | return true for most, but not all built-in variables, if | |
2250 | they had not been used yet. This bug affected C<${^GLOBAL_PHASE}> and | |
2251 | C<${^UTF8CACHE}>, among others. It also used to return false if the | |
2252 | package name was given as well (C<${"::!"}>) [perl #97978, #97492]. | |
2253 | ||
2254 | =item * | |
2255 | ||
2256 | Perl 5.10.0 introduced a similar bug: C<defined(*{"foo"})> where "foo" | |
2257 | represents the name of a built-in global variable used to return false if | |
2258 | the variable had never been used before, but only on the I<first> call. | |
2259 | This, too, has been fixed. | |
2260 | ||
2261 | =item * | |
2262 | ||
2263 | Since 5.6.0, C<*{ ... }> has been inconsistent in how it treats undefined | |
2264 | values. It would die in strict mode or lvalue context for most undefined | |
2265 | values, but would be treated as the empty string (with a warning) for the | |
2266 | specific scalar return by C<undef()> (C<&PL_sv_undef> internally). This | |
2267 | has been corrected. C<undef()> is now treated like other undefined | |
2268 | scalars, as in Perl 5.005. | |
2269 | ||
2270 | =back | |
2271 | ||
2272 | =head2 Filehandle, last-accessed | |
2273 | ||
2274 | Perl has an internal variable that stores the last filehandle to be | |
2275 | accessed. It is used by C<$.> and by C<tell> and C<eof> without | |
2276 | arguments. | |
2277 | ||
2278 | =over | |
2279 | ||
2280 | =item * | |
2281 | ||
2282 | It used to be possible to set this internal variable to a glob copy and | |
2283 | then modify that glob copy to be something other than a glob, and still | |
2284 | have the last-accessed filehandle associated with the variable after | |
2285 | assigning a glob to it again: | |
2286 | ||
2287 | my $foo = *STDOUT; # $foo is a glob copy | |
2288 | <$foo>; # $foo is now the last-accessed handle | |
2289 | $foo = 3; # no longer a glob | |
2290 | $foo = *STDERR; # still the last-accessed handle | |
2291 | ||
2292 | Now the C<$foo = 3> assignment unsets that internal variable, so there | |
2293 | is no last-accessed filehandle, just as if C<< <$foo> >> had never | |
2294 | happened. | |
2295 | ||
2296 | This also prevents some unrelated handle from becoming the last-accessed | |
2297 | handle if $foo falls out of scope and the same internal SV gets used for | |
2298 | another handle [perl #97988]. | |
2299 | ||
2300 | =item * | |
2301 | ||
2302 | A regression in 5.14 caused these statements not to set that internal | |
2303 | variable: | |
2304 | ||
2305 | my $fh = *STDOUT; | |
2306 | tell $fh; | |
2307 | eof $fh; | |
2308 | seek $fh, 0,0; | |
2309 | tell *$fh; | |
2310 | eof *$fh; | |
2311 | seek *$fh, 0,0; | |
2312 | readline *$fh; | |
2313 | ||
2314 | This is now fixed, but C<tell *{ *$fh }> still has the problem, and it | |
2315 | is not clear how to fix it [perl #106536]. | |
2316 | ||
2317 | =back | |
2318 | ||
2319 | =head2 Filetests and C<stat> | |
2320 | ||
2321 | The term "filetests" refers to the operators that consist of a hyphen | |
2322 | followed by a single letter: C<-r>, C<-x>, C<-M>, etc. The term "stacked" | |
2323 | when applied to filetests means followed by another filetest operator | |
2324 | sharing the same operand, as in C<-r -x -w $fooo>. | |
2325 | ||
2326 | =over | |
2327 | ||
2328 | =item * | |
2329 | ||
2330 | C<stat> produces more consistent warnings. It no longer warns for "_" | |
2331 | [perl #71002] and no longer skips the warning at times for other unopened | |
2332 | handles. It no longer warns about an unopened handle when the operating | |
2333 | system's C<fstat> function fails. | |
2334 | ||
2335 | =item * | |
2336 | ||
2337 | C<stat> would sometimes return negative numbers for large inode numbers, | |
2338 | because it was using the wrong internal C type. [perl #84590] | |
2339 | ||
2340 | =item * | |
2341 | ||
2342 | C<lstat> is documented to fall back to C<stat> (with a warning) when given | |
2343 | a filehandle. When passed an IO reference, it was actually doing the | |
2344 | equivalent of S<C<stat _>> and ignoring the handle. | |
2345 | ||
2346 | =item * | |
2347 | ||
2348 | C<-T _> with no preceding C<stat> used to produce a | |
2349 | confusing "uninitialized" warning, even though there | |
2350 | is no visible uninitialized value to speak of. | |
2351 | ||
2352 | =item * | |
2353 | ||
2354 | C<-T>, C<-B>, C<-l> and C<-t> now work | |
2355 | when stacked with other filetest operators | |
2356 | [perl #77388]. | |
2357 | ||
2358 | =item * | |
2359 | ||
2360 | In 5.14.0, filetest ops (C<-r>, C<-x>, etc.) started calling FETCH on a | |
2361 | tied argument belonging to the previous argument to a list operator, if | |
2362 | called with a bareword argument or no argument at all. This has been | |
2363 | fixed, so C<push @foo, $tied, -r> no longer calls FETCH on C<$tied>. | |
2364 | ||
2365 | =item * | |
2366 | ||
2367 | In Perl 5.6, C<-l> followed by anything other than a bareword would treat | |
2368 | its argument as a file name. That was changed in 5.8 for glob references | |
2369 | (C<\*foo>), but not for globs themselves (C<*foo>). C<-l> started | |
2370 | returning C<undef> for glob references without setting the last | |
2371 | stat buffer that the "_" handle uses, but only if warnings | |
2372 | were turned on. With warnings off, it was the same as 5.6. | |
2373 | In other words, it was simply buggy and inconsistent. Now the 5.6 | |
2374 | behaviour has been restored. | |
2375 | ||
2376 | =item * | |
2377 | ||
2378 | C<-l> followed by a bareword no longer "eats" the previous argument to | |
2379 | the list operator in whose argument list it resides. Hence, | |
2380 | C<print "bar", -l foo> now actually prints "bar", because C<-l> | |
2381 | on longer eats it. | |
2382 | ||
2383 | =item * | |
2384 | ||
2385 | Perl keeps several internal variables to keep track of the last stat | |
2386 | buffer, from which file(handle) it originated, what type it was, and | |
2387 | whether the last stat succeeded. | |
2388 | ||
2389 | There were various cases where these could get out of synch, resulting in | |
2390 | inconsistent or erratic behaviour in edge cases (every mention of C<-T> | |
2391 | applies to C<-B> as well): | |
2392 | ||
2393 | =over | |
2394 | ||
2395 | =item * | |
2396 | ||
2397 | C<-T I<HANDLE>>, even though it does a C<stat>, was not resetting the last | |
2398 | stat type, so an C<lstat _> following it would merrily return the wrong | |
2399 | results. Also, it was not setting the success status. | |
2400 | ||
2401 | =item * | |
2402 | ||
2403 | Freeing the handle last used by C<stat> or a filetest could result in | |
2404 | S<C<-T _>> using an unrelated handle. | |
2405 | ||
2406 | =item * | |
2407 | ||
2408 | C<stat> with an IO reference would not reset the stat type or record the | |
2409 | filehandle for S<C<-T _>> to use. | |
2410 | ||
2411 | =item * | |
2412 | ||
2413 | Fatal warnings could cause the stat buffer not to be reset | |
2414 | for a filetest operator on an unopened filehandle or C<-l> on any handle. | |
2415 | Fatal warnings also stopped C<-T> from setting C<$!>. | |
2416 | ||
2417 | =item * | |
2418 | ||
2419 | When the last stat was on an unreadable file, C<-T _> is supposed to | |
2420 | return C<undef>, leaving the last stat buffer unchanged. But it was | |
2421 | setting the stat type, causing C<lstat _> to stop working. | |
2422 | ||
2423 | =item * | |
2424 | ||
2425 | C<-T I<FILENAME>> was not resetting the internal stat buffers for | |
2426 | unreadable files. | |
2427 | ||
2428 | =back | |
2429 | ||
2430 | These have all been fixed. | |
2431 | ||
2432 | =back | |
2433 | ||
2434 | =head2 Formats | |
2435 | ||
2436 | =over | |
2437 | ||
2438 | =item * | |
2439 | ||
2440 | A number of edge cases have been fixed with formats and C<formline>; | |
2441 | in particular, where the format itself is potentially variable (such as | |
2442 | with ties and overloading), and where the format and data differ in their | |
2443 | encoding. In both these cases, it used to possible for the output to be | |
2444 | corrupted [perl #91032]. | |
2445 | ||
2446 | =item * | |
2447 | ||
2448 | C<formline> no longer converts its argument into a string in-place. So | |
2449 | passing a reference to C<formline> no longer destroys the reference | |
2450 | [perl #79532]. | |
2451 | ||
2452 | =item * | |
2453 | ||
2454 | Assignment to C<$^A> (the format output accumulator) now recalculates | |
2455 | the number of lines output. | |
2456 | ||
2457 | =back | |
2458 | ||
2459 | =head2 C<given> and C<when> | |
2460 | ||
2461 | =over | |
2462 | ||
2463 | =item * | |
2464 | ||
2465 | C<given> was not scoping its implicit $_ properly, resulting in memory | |
2466 | leaks or "Variable is not available" warnings [perl #94682]. | |
2467 | ||
2468 | =item * | |
2469 | ||
2470 | C<given> was not calling set-magic on the implicit lexical C<$_> that it | |
2471 | uses. This meant, for example, that C<pos> would be remembered from one | |
2472 | execution of the same C<given> block to the next, even if the input were a | |
2473 | different variable [perl #84526]. | |
2474 | ||
2475 | =item * | |
2476 | ||
2477 | C<when> blocks are now capable of returning variables declared inside the | |
2478 | enclosing C<given> block [perl #93548]. | |
2479 | ||
2480 | =back | |
2481 | ||
2482 | =head2 The C<glob> operator | |
2483 | ||
2484 | =over | |
2485 | ||
2486 | =item * | |
2487 | ||
2488 | On OSes other than VMS, Perl's C<glob> operator (and the C<< <...> >> form) | |
2489 | use L<File::Glob> underneath. L<File::Glob> splits the pattern into words, | |
2490 | before feeding each word to its C<bsd_glob> function. | |
2491 | ||
2492 | There were several inconsistencies in the way the split was done. Now | |
2493 | quotation marks (' and ") are always treated as shell-style word delimiters | |
2494 | (that allow whitespace as part of a word) and backslashes are always | |
2495 | preserved, unless they exist to escape quotation marks. Before, those | |
2496 | would only sometimes be the case, depending on whether the pattern | |
2497 | contained whitespace. Also, escaped whitespace at the end of the pattern | |
2498 | is no longer stripped [perl #40470]. | |
2499 | ||
2500 | =item * | |
2501 | ||
2502 | C<CORE::glob> now works as a way to call the default globbing function. It | |
2503 | used to respect overrides, despite the C<CORE::> prefix. | |
2504 | ||
2505 | =item * | |
2506 | ||
2507 | Under miniperl (used to configure modules when perl itself is built), | |
2508 | C<glob> now clears %ENV before calling csh, since the latter croaks on some | |
2509 | systems if it does not like the contents of the LS_COLORS enviroment | |
2510 | variable [perl #98662]. | |
2511 | ||
2512 | =back | |
2513 | ||
2514 | =head2 Lvalue subroutines | |
2515 | ||
2516 | =over | |
2517 | ||
2518 | =item * | |
2519 | ||
2520 | Explicit return now returns the actual argument passed to return, instead | |
2521 | of copying it [perl #72724, #72706]. | |
2522 | ||
2523 | =item * | |
2524 | ||
2525 | Lvalue subroutines used to enforce lvalue syntax (i.e., whatever can go on | |
2526 | the left-hand side of C<=>) for the last statement and the arguments to | |
2527 | return. Since lvalue subroutines are not always called in lvalue context, | |
2528 | this restriction has been lifted. | |
2529 | ||
2530 | =item * | |
2531 | ||
2532 | Lvalue subroutines are less restrictive as to what values can be returned. | |
2533 | It used to croak on values returned by C<shift> and C<delete> and from | |
2534 | other subroutines, but no longer does so [perl #71172]. | |
2535 | ||
2536 | =item * | |
2537 | ||
2538 | Empty lvalue subroutines (C<sub :lvalue {}>) used to return C<@_> in list | |
2539 | context. In fact, all subroutines used to, but regular subs were fixed in | |
2540 | Perl 5.8.2. Now lvalue subroutines have been likewise fixed. | |
2541 | ||
2542 | =item * | |
2543 | ||
2544 | Autovivification now works on values returned from lvalue subroutines | |
2545 | [perl #7946], as does returning C<keys> in lvalue context. | |
2546 | ||
2547 | =item * | |
2548 | ||
2549 | Lvalue subroutines used to copy their return values in rvalue context. Not | |
2550 | only was this a waste of CPU cycles, but it also caused bugs. A C<($)> | |
2551 | prototype would cause an lvalue sub to copy its return value [perl #51408], | |
2552 | and C<while(lvalue_sub() =~ m/.../g) { ... }> would loop endlessly | |
2553 | [perl #78680]. | |
2554 | ||
2555 | =item * | |
2556 | ||
2557 | When called in potential lvalue context | |
2558 | (e.g., subroutine arguments or a list | |
2559 | passed to C<for>), lvalue subroutines used to copy | |
2560 | any read-only value that was returned. E.g., C< sub :lvalue { $] } > | |
2561 | would not return C<$]>, but a copy of it. | |
2562 | ||
2563 | =item * | |
2564 | ||
2565 | When called in potential lvalue context, an lvalue subroutine returning | |
2566 | arrays or hashes used to bind the arrays or hashes to scalar variables, | |
2567 | resulting in bugs. This was fixed in 5.14.0 if an array were the first | |
2568 | thing returned from the subroutine (but not for C<$scalar, @array> or | |
2569 | hashes being returned). Now a more general fix has been applied | |
2570 | [perl #23790]. | |
2571 | ||
2572 | =item * | |
2573 | ||
2574 | Method calls whose arguments were all surrounded with C<my()> or C<our()> | |
2575 | (as in C<< $object->method(my($a,$b)) >>) used to force lvalue context on | |
2576 | the subroutine. This would prevent lvalue methods from returning certain | |
2577 | values. | |
2578 | ||
2579 | =item * | |
2580 | ||
2581 | Lvalue sub calls that are not determined to be such at compile time | |
2582 | (C<&$name> or &{"name"}) are no longer exempt from strict refs if they | |
2583 | occur in the last statement of an lvalue subroutine [perl #102486]. | |
2584 | ||
2585 | =item * | |
2586 | ||
2587 | Sub calls whose subs are not visible at compile time, if | |
2588 | they occurred in the last statement of an lvalue subroutine, | |
2589 | would reject non-lvalue subroutines and die with "Can't modify non-lvalue | |
2590 | subroutine call" [perl #102486]. | |
2591 | ||
2592 | Non-lvalue sub calls whose subs I<are> visible at compile time exhibited | |
2593 | the opposite bug. If the call occurred in the last statement of an lvalue | |
2594 | subroutine, there would be no error when the lvalue sub was called in | |
2595 | lvalue context. Perl would blindly assign to the temporary value returned | |
2596 | by the non-lvalue subroutine. | |
2597 | ||
2598 | =item * | |
2599 | ||
2600 | C<AUTOLOAD> routines used to take precedence over the actual sub being | |
2601 | called (i.e., when autoloading wasn't needed), for sub calls in lvalue or | |
2602 | potential lvalue context, if the subroutine was not visible at compile | |
2603 | time. | |
2604 | ||
2605 | =item * | |
2606 | ||
2607 | Applying the C<:lvalue> attribute to an XSUB or to an aliased subroutine | |
2608 | stub with C<< sub foo :lvalue; >> syntax stopped working in Perl 5.12. | |
2609 | This has been fixed. | |
2610 | ||
2611 | =item * | |
2612 | ||
2613 | Applying the :lvalue attribute to subroutine that is already defined does | |
2614 | not work properly, as the attribute changes the way the sub is compiled. | |
2615 | Hence, Perl 5.12 began warning when an attempt is made to apply the | |
2616 | attribute to an already defined sub. In such cases, the attribute is | |
2617 | discarded. | |
2618 | ||
2619 | But the change in 5.12 missed the case where custom attributes are also | |
2620 | present: that case still silently and ineffectively applied the attribute. | |
2621 | That omission has now been corrected. C<sub foo :lvalue :Whatever> (when | |
2622 | C<foo> is already defined) now warns about the :lvalue attribute, and does | |
2623 | not apply it. | |
2624 | ||
2625 | =item * | |
2626 | ||
2627 | A bug affecting lvalue context propagation through nested lvalue subroutine | |
2628 | calls has been fixed. Previously, returning a value in nested rvalue | |
2629 | context would be treated as lvalue context by the inner subroutine call, | |
2630 | resulting in some values (such as read-only values) being rejected. | |
2631 | ||
2632 | =back | |
2633 | ||
2634 | =head2 Overloading | |
2635 | ||
2636 | =over | |
2637 | ||
2638 | =item * | |
2639 | ||
2640 | Arithmetic assignment (C<$left += $right>) involving overloaded objects | |
2641 | that rely on the 'nomethod' override no longer segfault when the left | |
2642 | operand is not overloaded. | |
2643 | ||
2644 | =item * | |
2645 | ||
2646 | Errors that occur when methods cannot be found during overloading now | |
2647 | mention the correct package name, as they did in 5.8.x, instead of | |
2648 | erroneously mentioning the "overload" package, as they have since 5.10.0. | |
2649 | ||
2650 | =item * | |
2651 | ||
2652 | Undefining C<%overload::> no longer causes a crash. | |
2653 | ||
2654 | =back | |
2655 | ||
2656 | =head2 Prototypes of built-in keywords | |
2657 | ||
2658 | =over | |
2659 | ||
2660 | =item * | |
2661 | ||
2662 | The C<prototype> function no longer dies for the C<__FILE__>, C<__LINE__> | |
2663 | and C<__PACKAGE__> directives. It now returns an empty-string prototype | |
2664 | for them, because they are syntactically indistinguishable from nullary | |
2665 | functions like C<time>. | |
2666 | ||
2667 | =item * | |
2668 | ||
2669 | C<prototype> now returns C<undef> for all overridable infix operators, | |
2670 | such as C<eq>, which are not callable in any way resembling functions. | |
2671 | It used to return incorrect prototypes for some and die for others | |
2672 | [perl #94984]. | |
2673 | ||
2674 | =item * | |
2675 | ||
2676 | The prototypes of several built-in functions--C<getprotobynumber>, C<lock>, | |
2677 | C<not> and C<select>--have been corrected, or at least are now closer to | |
2678 | reality than before. | |
2679 | ||
2680 | =back | |
2681 | ||
2682 | =head2 Regular expressions | |
2683 | ||
2684 | =for comment Is it possible to merge some of these items? | |
2685 | ||
2686 | =over 4 | |
2687 | ||
2688 | =item * | |
2689 | ||
2690 | C</[[:ascii:]]/> and C</[[:blank:]]/> now use locale rules under | |
2691 | C<use locale> when the platform supports that. Previously, they used | |
2692 | the platform's native character set. | |
2693 | ||
2694 | =item * | |
2695 | ||
2696 | C<m/[[:ascii:]]/i> and C</\p{ASCII}/i> now match identically (when not | |
2697 | under a differing locale). This fixes a regression introduced in 5.14 | |
2698 | in which the first expression could match characters outside of ASCII, | |
2699 | such as the KELVIN SIGN. | |
2700 | ||
2701 | =item * | |
2702 | ||
2703 | C</.*/g> would sometimes refuse to match at the end of a string that ends | |
2704 | with "\n". This has been fixed [perl #109206]. | |
2705 | ||
2706 | =item * | |
2707 | ||
2708 | Starting with 5.12.0, Perl used to get its internal bookkeeping muddled up | |
2709 | after assigning C<${ qr// }> to a hash element and locking it with | |
2710 | L<Hash::Util>. This could result in double frees, crashes or erratic | |
2711 | behaviour. | |
2712 | ||
2713 | =item * | |
2714 | ||
2715 | The new (in 5.14.0) regular expression modifier C</a> when repeated like | |
2716 | C</aa> forbids the characters outside the ASCII range that match | |
2717 | characters inside that range from matching under C</i>. This did not | |
2718 | work under some circumstances, all involving alternation, such as: | |
2719 | ||
2720 | "\N{KELVIN SIGN}" =~ /k|foo/iaa; | |
2721 | ||
2722 | succeeded inappropriately. This is now fixed. | |
2723 | ||
2724 | =item * | |
2725 | ||
2726 | 5.14.0 introduced some memory leaks in regular expression character | |
2727 | classes such as C<[\w\s]>, which have now been fixed. (5.14.1) | |
2728 | ||
2729 | =item * | |
2730 | ||
2731 | An edge case in regular expression matching could potentially loop. | |
2732 | This happened only under C</i> in bracketed character classes that have | |
2733 | characters with multi-character folds, and the target string to match | |
2734 | against includes the first portion of the fold, followed by another | |
2735 | character that has a multi-character fold that begins with the remaining | |
2736 | portion of the fold, plus some more. | |
2737 | ||
2738 | "s\N{U+DF}" =~ /[\x{DF}foo]/i | |
2739 | ||
2740 | is one such case. C<\xDF> folds to C<"ss">. (5.14.1) | |
2741 | ||
2742 | =item * | |
2743 | ||
2744 | A few characters in regular expression pattern matches did not | |
2745 | match correctly in some circumstances, all involving C</i>. The | |
2746 | affected characters are: | |
2747 | COMBINING GREEK YPOGEGRAMMENI, | |
2748 | GREEK CAPITAL LETTER IOTA, | |
2749 | GREEK CAPITAL LETTER UPSILON, | |
2750 | GREEK PROSGEGRAMMENI, | |
2751 | GREEK SMALL LETTER IOTA WITH DIALYTIKA AND OXIA, | |
2752 | GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS, | |
2753 | GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND OXIA, | |
2754 | GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS, | |
2755 | LATIN SMALL LETTER LONG S, | |
2756 | LATIN SMALL LIGATURE LONG S T, | |
2757 | and | |
2758 | LATIN SMALL LIGATURE ST. | |
2759 | ||
2760 | =item * | |
2761 | ||
2762 | A memory leak regression in regular expression compilation | |
2763 | under threading has been fixed. | |
2764 | ||
2765 | =item * | |
2766 | ||
2767 | A regression introduced in 5.13.6 has | |
2768 | been fixed. This involved an inverted | |
2769 | bracketed character class in a regular expression that consisted solely | |
2770 | of a Unicode property. That property wasn't getting inverted outside the | |
2771 | Latin1 range. | |
2772 | ||
2773 | =item * | |
2774 | ||
2775 | Three problematic Unicode characters now work better in regex pattern matching under C</i> | |
2776 | ||
2777 | In the past, three Unicode characters: | |
2778 | LATIN SMALL LETTER SHARP S, | |
2779 | GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS, | |
2780 | and | |
2781 | GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS, | |
2782 | along with the sequences that they fold to | |
2783 | (including "ss" in the case of LATIN SMALL LETTER SHARP S), | |
2784 | did not properly match under C</i>. 5.14.0 fixed some of these cases, | |
2785 | but introduced others, including a panic when one of the characters or | |
2786 | sequences was used in the C<(?(DEFINE)> regular expression predicate. | |
2787 | The known bugs that were introduced in 5.14 have now been fixed; as well | |
2788 | as some other edge cases that have never worked until now. All these | |
2789 | involve using the characters and sequences outside bracketed character | |
2790 | classes under C</i>. This closes [perl #98546]. | |
2791 | ||
2792 | There remain known problems when using certain characters with | |
2793 | multi-character folds inside bracketed character classes, including such | |
2794 | constructs as C<qr/[\N{LATIN SMALL LETTER SHARP}a-z]/i>. These | |
2795 | remaining bugs are addressed in [perl #89774]. | |
2796 | ||
2797 | =item * | |
2798 | ||
2799 | RT #78266: The regex engine has been leaking memory when accessing | |
2800 | named captures that weren't matched as part of a regex ever since 5.10 | |
2801 | when they were introduced, e.g. this would consume over a hundred MB of | |
2802 | memory: | |
2803 | ||
2804 | for (1..10_000_000) { | |
2805 | if ("foo" =~ /(foo|(?<capture>bar))?/) { | |
2806 | my $capture = $+{capture} | |
2807 | } | |
2808 | } | |
2809 | system "ps -o rss $$"' | |
2810 | ||
2811 | =item * | |
2812 | ||
2813 | In 5.14, C</[[:lower:]]/i> and C</[[:upper:]]/i> no longer matched the | |
2814 | opposite case. This has been fixed [perl #101970]. | |
2815 | ||
2816 | =item * | |
2817 | ||
2818 | A regular expression match with an overloaded object on the right-hand side | |
2819 | would in some cases stringify the object too many times. | |
2820 | ||
2821 | =item * | |
2822 | ||
2823 | A regression has been fixed that was introduced in 5.14, in C</i> | |
2824 | regular expression matching, in which a match improperly fails if the | |
2825 | pattern is in UTF-8, the target string is not, and a Latin-1 character | |
2826 | precedes a character in the string that should match the pattern. | |
2827 | [perl #101710] | |
2828 | ||
2829 | =item * | |
2830 | ||
2831 | In case-insensitive regular expression pattern matching, no longer on | |
2832 | UTF-8 encoded strings does the scan for the start of match only look at | |
2833 | the first possible position. This caused matches such as | |
2834 | C<"f\x{FB00}" =~ /ff/i> to fail. | |
2835 | ||
2836 | =item * | |
2837 | ||
2838 | The regexp optimiser no longer crashes on debugging builds when merging | |
2839 | fixed-string nodes with inconvenient contents. | |
2840 | ||
2841 | =item * | |
2842 | ||
2843 | A panic involving the combination of the regular expression modifiers | |
2844 | C</aa> and the C<\b> escape sequence introduced in 5.14.0 has been | |
2845 | fixed [perl #95964]. | |
2846 | ||
2847 | =item * | |
2848 | ||
2849 | The combination of the regular expression modifiers C</aa> and the C<\b> | |
2850 | and C<\B> escape sequences did not work properly on UTF-8 encoded | |
2851 | strings. All non-ASCII characters under C</aa> should be treated as | |
2852 | non-word characters, but what was happening was that Unicode rules were | |
2853 | used to determine wordness/non-wordness for non-ASCII characters. This | |
2854 | is now fixed [perl #95968]. | |
2855 | ||
2856 | =item * | |
2857 | ||
2858 | C<< (?foo: ...) >> no longer loses passed in character set. | |
2859 | ||
2860 | =item * | |
2861 | ||
2862 | The trie optimisation used to have problems with alternations containing | |
2863 | an empty C<(?:)>, causing C<< "x" =~ /\A(?>(?:(?:)A|B|C?x))\z/ >> not to | |
2864 | match, whereas it should [perl #111842]. | |
2865 | ||
2866 | =item * | |
2867 | ||
2868 | Use of lexical (C<my>) variables in code blocks embedded in regular | |
2869 | expressions will no longer result in memory corruption or crashes. | |
2870 | ||
2871 | Nevertheless, these code blocks are still experimental, as there are still | |
2872 | problems with the wrong variables being closed over (in loops for instance) | |
2873 | and with abnormal exiting (e.g., C<die>) causing memory corruption. | |
2874 | ||
2875 | =item * | |
2876 | ||
2877 | The C<\h>, C<\H>, C<\v> and C<\V> regular expression metacharacters used to | |
2878 | cause a panic error message when attempting to match at the end of the | |
2879 | string [perl #96354]. | |
2880 | ||
2881 | =item * | |
2882 | ||
2883 | The abbreviations for four C1 control characters C<MW> C<PM>, C<RI>, and | |
2884 | C<ST> were previously unrecognized by C<\N{}>, vianame(), and | |
2885 | string_vianame(). | |
2886 | ||
2887 | =item * | |
2888 | ||
2889 | Mentioning a variable named "&" other than C<$&> (i.e., C<@&> or C<%&>) no | |
2890 | longer stops C<$&> from working. The same applies to variables named "'" | |
2891 | and "`" [perl #24237]. | |
2892 | ||
2893 | =item * | |
2894 | ||
2895 | Creating a C<UNIVERSAL::AUTOLOAD> sub no longer stops C<%+>, C<%-> and | |
2896 | C<%!> from working some of the time [perl #105024]. | |
2897 | ||
2898 | =back | |
2899 | ||
2900 | =head2 Smartmatching | |
2901 | ||
2902 | =over | |
2903 | ||
2904 | =item * | |
2905 | ||
2906 | C<~~> now correctly handles the precedence of Any~~Object, and is not tricked | |
2907 | by an overloaded object on the left-hand side. | |
2908 | ||
2909 | =item * | |
2910 | ||
2911 | In Perl 5.14.0, C<$tainted ~~ @array> stopped working properly. Sometimes | |
2912 | it would erroneously fail (when C<$tainted> contained a string that occurs | |
2913 | in the array I<after> the first element) or erroneously succeed (when | |
2914 | C<undef> occurred after the first element) [perl #93590]. | |
2915 | ||
2916 | =back | |
2917 | ||
2918 | =head2 The C<sort> operator | |
2919 | ||
2920 | =over | |
2921 | ||
2922 | =item * | |
2923 | ||
2924 | C<sort> was not treating C<sub {}> and C<sub {()}> as equivalent when | |
2925 | such a sub was provided as the comparison routine. It used to croak on | |
2926 | C<sub {()}>. | |
2927 | ||
2928 | =item * | |
2929 | ||
2930 | C<sort> now works once more with custom sort routines that are XSUBs. It | |
2931 | stopped working in 5.10.0. | |
2932 | ||
2933 | =item * | |
2934 | ||
2935 | C<sort> with a constant for a custom sort routine, although it produces | |
2936 | unsorted results, no longer crashes. It started crashing in 5.10.0. | |
2937 | ||
2938 | =item * | |
2939 | ||
2940 | Warnings emitted by C<sort> when a custom comparison routine returns a | |
2941 | non-numeric value now contain "in sort" and show the line number of the | |
2942 | C<sort> operator, rather than the last line of the comparison routine. The | |
2943 | warnings also occur now only if warnings are enabled in the scope where | |
2944 | C<sort> occurs. Previously the warnings would occur if enabled in the | |
2945 | comparison routine's scope. | |
2946 | ||
2947 | =item * | |
2948 | ||
2949 | C<< sort { $a <=> $b } >>, which is optimised internally, now produces | |
2950 | "uninitialized" warnings for NaNs (not-a-number values), since C<< <=> >> | |
2951 | returns C<undef> for those. This brings it in line with | |
2952 | S<C<< sort { 1; $a <=> $b } >>> and other more complex cases, which are not | |
2953 | optimised [perl #94390]. | |
2954 | ||
2955 | =back | |
2956 | ||
2957 | =head2 The C<substr> operator | |
2958 | ||
2959 | =over | |
2960 | ||
2961 | =item * | |
88c5c971 | 2962 | |
05c8f9ed RS |
2963 | Tied (and otherwise magical) variables are no longer exempt from the |
2964 | "Attempt to use reference as lvalue in substr" warning. | |
8f12b018 | 2965 | |
05c8f9ed | 2966 | =item * |
8f12b018 | 2967 | |
05c8f9ed RS |
2968 | That warning now occurs when the returned lvalue is assigned to, not |
2969 | when C<substr> itself is called. This only makes a difference if the | |
2970 | return value of C<substr> is referenced and assigned to later. | |
26afcec5 | 2971 | |
05c8f9ed | 2972 | =item * |
8f12b018 | 2973 | |
05c8f9ed RS |
2974 | Passing a substring of a read-only value or a typeglob to a function |
2975 | (potential lvalue context) no longer causes an immediate "Can't coerce" | |
2976 | or "Modification of a read-only value" error. That error only occurs | |
2977 | if and when the value passed is assigned to. | |
d7fbd56d | 2978 | |
05c8f9ed RS |
2979 | The same thing happens with the "substr outside of string" error. If |
2980 | the lvalue is only read, not written to, it is now just a warning, as | |
2981 | with rvalue C<substr>. | |
d7fbd56d | 2982 | |
05c8f9ed | 2983 | =item * |
d5dc7001 | 2984 | |
05c8f9ed RS |
2985 | C<substr> assignments no longer call FETCH twice if the first argument |
2986 | is a tied variable, just once. | |
d5dc7001 | 2987 | |
05c8f9ed | 2988 | =back |
711a3903 | 2989 | |
05c8f9ed | 2990 | =head2 Support for embedded nulls |
977c1d31 | 2991 | |
05c8f9ed RS |
2992 | Some parts of Perl did not work correctly with nulls (C<chr 0>) embedded in |
2993 | strings. That meant that, for instance, C<< $m = "a\0b"; foo->$m >> would | |
2994 | call the "a" method, instead of the actual method name contained in $m. | |
2995 | These parts of perl have been fixed to support nulls: | |
27f00e3d | 2996 | |
05c8f9ed | 2997 | =over |
6ba817f3 | 2998 | |
05c8f9ed | 2999 | =item * |
2630d42b | 3000 | |
05c8f9ed | 3001 | Method names |
7620cb10 | 3002 | |
05c8f9ed | 3003 | =item * |
d7c042c9 | 3004 | |
05c8f9ed | 3005 | Typeglob names (including filehandle and subroutine names) |
d7c042c9 | 3006 | |
05c8f9ed | 3007 | =item * |
d7c042c9 | 3008 | |
05c8f9ed | 3009 | Package names, including the return value of C<ref()> |
985213f2 | 3010 | |
05c8f9ed | 3011 | =item * |
977c1d31 | 3012 | |
05c8f9ed | 3013 | Typeglob elements (C<*foo{"THING\0stuff"}>) |
977c1d31 | 3014 | |
05c8f9ed | 3015 | =item * |
985213f2 | 3016 | |
05c8f9ed | 3017 | Signal names |
985213f2 | 3018 | |
204b72a4 | 3019 | =item * |
2e2b2571 | 3020 | |
05c8f9ed RS |
3021 | Various warnings and error messages that mention variable names or values, |
3022 | methods, etc. | |
2e2b2571 | 3023 | |
204b72a4 | 3024 | =back |
b240fc0f | 3025 | |
05c8f9ed RS |
3026 | One side effect of these changes is that blessing into "\0" no longer |
3027 | causes C<ref()> to return false. | |
27f00e3d | 3028 | |
05c8f9ed | 3029 | =head2 Threading bugs |
27f00e3d | 3030 | |
05c8f9ed | 3031 | =over |
cadced9f | 3032 | |
05c8f9ed | 3033 | =item * |
cadced9f | 3034 | |
05c8f9ed RS |
3035 | Typeglobs returned from threads are no longer cloned if the parent thread |
3036 | already has a glob with the same name. This means that returned | |
3037 | subroutines will now assign to the right package variables [perl #107366]. | |
3038 | ||
3039 | =item * | |
3040 | ||
3041 | Some cases of threads crashing due to memory allocation during cloning have | |
3042 | been fixed [perl #90006]. | |
632c5d30 NC |
3043 | |
3044 | =item * | |
3045 | ||
05c8f9ed RS |
3046 | Thread joining would sometimes emit "Attempt to free unreferenced scalar" |
3047 | warnings if C<caller> had been used from the C<DB> package prior to thread | |
3048 | creation [perl #98092]. | |
3049 | ||
3050 | =item * | |
3051 | ||
3052 | Locking a subroutine (via C<lock &sub>) is no longer a compile-time error | |
3053 | for regular subs. For lvalue subroutines, it no longer tries to return the | |
3054 | sub as a scalar, resulting in strange side effects like C<ref \$_> | |
3055 | returning "CODE" in some instances. | |
3056 | ||
3057 | C<lock &sub> is now a run-time error if L<threads::shared> is loaded (a | |
3058 | no-op otherwise), but that may be rectified in a future version. | |
95ce428c | 3059 | |
2630d42b | 3060 | =back |
95ce428c | 3061 | |
05c8f9ed | 3062 | =head2 Tied variables |
4e6e9b23 | 3063 | |
05c8f9ed | 3064 | =over |
4e6e9b23 | 3065 | |
c88a046d | 3066 | =item * |
4e6e9b23 | 3067 | |
05c8f9ed RS |
3068 | Various cases in which FETCH was being ignored or called too many times |
3069 | have been fixed: | |
1887da8c | 3070 | |
05c8f9ed | 3071 | =over |
58856662 | 3072 | |
05c8f9ed | 3073 | =item * |
c88a046d | 3074 | |
05c8f9ed | 3075 | C<PerlIO::get_layers> [perl #97956] |
58856662 NC |
3076 | |
3077 | =item * | |
3078 | ||
05c8f9ed RS |
3079 | C<$tied =~ y/a/b/>, C<chop $tied> and C<chomp $tied> when $tied holds a |
3080 | reference. | |
d333a655 | 3081 | |
05c8f9ed | 3082 | =item * |
589c1691 | 3083 | |
05c8f9ed | 3084 | When calling C<local $_> [perl #105912] |
fae9e8f4 | 3085 | |
05c8f9ed | 3086 | =item * |
fae9e8f4 | 3087 | |
05c8f9ed | 3088 | Four-argument C<select> |
58856662 | 3089 | |
05c8f9ed RS |
3090 | =item * |
3091 | ||
3092 | A tied buffer passed to C<sysread> | |
c11980ad | 3093 | |
05c8f9ed | 3094 | =item * |
c11980ad | 3095 | |
05c8f9ed | 3096 | C<< $tied .= <> >> |
c88a046d | 3097 | |
05c8f9ed | 3098 | =item * |
c88a046d | 3099 | |
05c8f9ed RS |
3100 | Three-argument C<open>, the third being a tied file handle |
3101 | (as in C<< open $fh, ">&", $tied >>) | |
2630d42b | 3102 | |
05c8f9ed | 3103 | =item * |
c88a046d | 3104 | |
05c8f9ed | 3105 | C<sort> with a reference to a tied glob for the comparison routine. |
c88a046d A |
3106 | |
3107 | =item * | |
3108 | ||
05c8f9ed | 3109 | C<..> and C<...> in list context [perl #53554]. |
c88a046d | 3110 | |
05c8f9ed | 3111 | =item * |
c88a046d | 3112 | |
05c8f9ed RS |
3113 | C<${$tied}>, C<@{$tied}>, C<%{$tied}> and C<*{$tied}> where the tied |
3114 | variable returns a string (C<&{}> was unaffected) | |
c88a046d | 3115 | |
05c8f9ed | 3116 | =item * |
c88a046d | 3117 | |
05c8f9ed RS |
3118 | C<defined ${ $tied_variable }> |
3119 | ||
3120 | =item * | |
c88a046d | 3121 | |
05c8f9ed RS |
3122 | Various functions that take a filehandle argument in rvalue context |
3123 | (C<close>, C<readline>, etc.) [perl #97482] | |
c88a046d | 3124 | |
05c8f9ed | 3125 | =item * |
c11980ad | 3126 | |
05c8f9ed RS |
3127 | Some cases of dereferencing a complex expression, such as |
3128 | C<${ (), $tied } = 1>, used to call C<FETCH> multiple times, but now call | |
3129 | it once. | |
c11980ad | 3130 | |
05c8f9ed | 3131 | =item * |
c88a046d | 3132 | |
05c8f9ed RS |
3133 | C<$tied-E<gt>method> where $tied returns a package name--even resulting in |
3134 | a failure to call the method, due to memory corruption | |
6c69e197 | 3135 | |
05c8f9ed | 3136 | =item * |
c88a046d | 3137 | |
05c8f9ed | 3138 | Assignments like C<*$tied = \&{"..."}> and C<*glob = $tied> |
c88a046d A |
3139 | |
3140 | =item * | |
3141 | ||
05c8f9ed RS |
3142 | C<chdir>, C<chmod>, C<chown>, C<utime>, C<truncate>, C<stat>, C<lstat> and |
3143 | the filetest ops (C<-r>, C<-x>, etc.) | |
c88a046d | 3144 | |
2630d42b | 3145 | =back |
c88a046d | 3146 | |
05c8f9ed | 3147 | =item * |
2630d42b | 3148 | |
05c8f9ed RS |
3149 | C<caller> sets C<@DB::args> to the subroutine arguments when called from |
3150 | the DB package. It used to crash when doing so if C<@DB::args> happened to | |
3151 | be tied. Now it croaks instead. | |
84ecb73f | 3152 | |
fae9e8f4 A |
3153 | =item * |
3154 | ||
05c8f9ed RS |
3155 | Tying an element of %ENV or C<%^H> and then deleting that element would |
3156 | result in a call to the tie object's DELETE method, even though tying the | |
3157 | element itself is supposed to be equivalent to tying a scalar (the element | |
3158 | is, of course, a scalar) [perl #67490]. | |
fae9e8f4 | 3159 | |
05c8f9ed | 3160 | =item * |
a3cc0403 | 3161 | |
05c8f9ed RS |
3162 | When Perl autovivifies an element of a tied array or hash (which entails |
3163 | calling STORE with a new reference), it now calls FETCH immediately after | |
3164 | the STORE, instead of assuming that FETCH would have returned the same | |
3165 | reference. This can make it easier to implement tied objects [perl #35865, #43011]. | |
c88a046d | 3166 | |
05c8f9ed | 3167 | =item * |
75ff5956 | 3168 | |
05c8f9ed RS |
3169 | Four-argument C<select> no longer produces its "Non-string passed as |
3170 | bitmask" warning on tied or tainted variables that are strings. | |
3171 | ||
3172 | =item * | |
3173 | ||
3174 | Localising a tied scalar that returns a typeglob no longer stops it from | |
3175 | being tied till the end of the scope. | |
3176 | ||
3177 | =item * | |
3178 | ||
3179 | Attempting to C<goto> out of a tied handle method used to cause memory | |
3180 | corruption or crashes. Now it produces an error message instead | |
3181 | [perl #8611]. | |
75ff5956 | 3182 | |
2630d42b | 3183 | =item * |
c11980ad | 3184 | |
05c8f9ed RS |
3185 | A bug has been fixed that occurs when a tied variable is used as a |
3186 | subroutine reference: if the last thing assigned to or returned from the | |
3187 | variable was a reference or typeglob, the C<\&$tied> could either crash or | |
3188 | return the wrong subroutine. The reference case is a regression introduced | |
3189 | in Perl 5.10.0. For typeglobs, it has probably never worked till now. | |
843331c7 | 3190 | |
2630d42b | 3191 | =back |
c11980ad | 3192 | |
05c8f9ed | 3193 | =head2 Version objects and vstrings |
2a7afa74 | 3194 | |
05c8f9ed | 3195 | =over |
ecd144ea | 3196 | |
05c8f9ed | 3197 | =item * |
c11980ad | 3198 | |
05c8f9ed RS |
3199 | The bitwise complement operator (and possibly other operators, too) when |
3200 | passed a vstring would leave vstring magic attached to the return value, | |
3201 | even though the string had changed. This meant that | |
3202 | C<< version->new(~v1.2.3) >> would create a version looking like "v1.2.3" | |
3203 | even though the string passed to C<< version->new >> was actually | |
3204 | "\376\375\374". This also caused L<B::Deparse> to deparse C<~v1.2.3> | |
3205 | incorrectly, without the C<~> [perl #29070]. | |
c11980ad | 3206 | |
05c8f9ed RS |
3207 | =item * |
3208 | ||
3209 | Assigning a vstring to a magic (e.g., tied, C<$!>) variable and then | |
3210 | assigning something else used to blow away all the magic. This meant that | |
3211 | tied variables would come undone, C<$!> would stop getting updated on | |
3212 | failed system calls, C<$|> would stop setting autoflush, and other | |
3213 | mischief would take place. This has been fixed. | |
3214 | ||
3215 | =item * | |
3216 | ||
3217 | C<< version->new("version") >> and C<printf "%vd", "version"> no longer | |
3218 | crash [perl #102586]. | |
ecd144ea FC |
3219 | |
3220 | =item * | |
3221 | ||
05c8f9ed RS |
3222 | Version comparisons, such as those that happen implicitly with C<use |
3223 | v5.43>, no longer cause locale settings to change [perl #105784]. | |
3224 | ||
3225 | =item * | |
3226 | ||
3227 | Version objects no longer cause memory leaks in boolean context | |
3228 | [perl #109762]. | |
9dea6244 | 3229 | |
204b72a4 | 3230 | =back |
9dea6244 | 3231 | |
05c8f9ed | 3232 | =head2 Warnings, redefinition |
c11980ad | 3233 | |
05c8f9ed | 3234 | =over |
2a7afa74 | 3235 | |
05c8f9ed | 3236 | =item * |
e9e4ee62 | 3237 | |
05c8f9ed RS |
3238 | Subroutines from the C<autouse> namespace are once more exempt from |
3239 | redefinition warnings. This used to work in 5.005, but was broken in | |
3240 | 5.6 for most subroutines. For subs created via XS that redefine | |
3241 | subroutines from the C<autouse> package, this stopped working in 5.10. | |
937a45d0 | 3242 | |
ef337e16 CBW |
3243 | =item * |
3244 | ||
05c8f9ed RS |
3245 | New XSUBs now produce redefinition warnings if they overwrite existing |
3246 | subs, as they did in 5.8.x. (The C<autouse> logic was reversed in | |
3247 | 5.10-14. Only subroutines from the C<autouse> namespace would warn | |
3248 | when clobbered.) | |
ef337e16 | 3249 | |
05c8f9ed | 3250 | =item * |
679b54e7 | 3251 | |
05c8f9ed RS |
3252 | C<newCONSTSUB> used to use compile-time warning hints, instead of |
3253 | run-time hints. The following code should never produce a redefinition | |
3254 | warning, but it used to, if C<newCONSTSUB> redefined an existing | |
3255 | subroutine: | |
39de7394 | 3256 | |
05c8f9ed RS |
3257 | use warnings; |
3258 | BEGIN { | |
3259 | no warnings; | |
3260 | some_XS_function_that_calls_new_CONSTSUB(); | |
3261 | } | |
2630d42b | 3262 | |
05c8f9ed | 3263 | =item * |
2630d42b | 3264 | |
05c8f9ed RS |
3265 | Redefinition warnings for constant subroutines are on by default (what |
3266 | are known as severe warnings in L<perldiag>). This was only the case | |
3267 | when it was a glob assignment or declaration of a Perl subroutine that | |
3268 | caused the warning. If the creation of XSUBs triggered the warning, it | |
3269 | was not a default warning. This has been corrected. | |
52272450 | 3270 | |
84ecb73f S |
3271 | =item * |
3272 | ||
05c8f9ed RS |
3273 | The internal check to see whether a redefinition warning should occur |
3274 | used to emit "uninitialized" warnings in cases like this: | |
3275 | ||
3276 | use warnings "uninitialized"; | |
3277 | use constant {u => undef, v => undef}; | |
3278 | sub foo(){u} | |
3279 | sub foo(){v} | |
84ecb73f | 3280 | |
52deee2e | 3281 | =back |
5dd80d85 | 3282 | |
05c8f9ed | 3283 | =head2 Warnings, "Uninitialized" |
52272450 | 3284 | |
05c8f9ed | 3285 | =over |
249950d7 | 3286 | |
05c8f9ed RS |
3287 | =item * |
3288 | ||
3289 | Various functions that take a filehandle argument in rvalue context | |
3290 | (C<close>, C<readline>, etc.) used to warn twice for an undefined handle | |
3291 | [perl #97482]. | |
a1d95121 | 3292 | |
05c8f9ed | 3293 | =item * |
977c1d31 | 3294 | |
05c8f9ed RS |
3295 | C<dbmopen> now only warns once, rather than three times, if the mode |
3296 | argument is C<undef> [perl #90064]. | |
977c1d31 | 3297 | |
05c8f9ed RS |
3298 | =item * |
3299 | ||
3300 | The C<+=> operator does not usually warn when the left-hand side is | |
3301 | C<undef>, but it was doing so for tied variables. This has been fixed | |
3302 | [perl #44895]. | |
3303 | ||
3304 | =item * | |
977c1d31 | 3305 | |
05c8f9ed RS |
3306 | A bug fix in Perl 5.14 introduced a new bug, causing "uninitialized" |
3307 | warnings to report the wrong variable if the operator in question had | |
3308 | two operands and one was C<%{...}> or C<@{...}>. This has been fixed | |
3309 | [perl #103766]. | |
39ea6a4b | 3310 | |
05c8f9ed RS |
3311 | =item * |
3312 | ||
3313 | C<..> and C<...> in list context now mention the name of the variable in | |
3314 | "uninitialized" warnings for string (as opposed to numeric) ranges. | |
39ea6a4b | 3315 | |
977c1d31 | 3316 | =back |
ea317ccb | 3317 | |
05c8f9ed | 3318 | =head2 Weak references |
a7bff800 | 3319 | |
05c8f9ed | 3320 | =over |
0aae26c1 | 3321 | |
05c8f9ed RS |
3322 | =item * |
3323 | ||
3324 | Weakening the first argument to an automatically-invoked C<DESTROY> method | |
3325 | could result in erroneous "DESTROY created new reference" errors or | |
3326 | crashes. Now it is an error to weaken a read-only reference. | |
3327 | ||
3328 | =item * | |
3329 | ||
3330 | Weak references to lexical hashes going out of scope were not going stale | |
3331 | (becoming undefined), but continued to point to the hash. | |
0aae26c1 | 3332 | |
05c8f9ed RS |
3333 | =item * |
3334 | ||
3335 | Weak references to lexical variables going out of scope are now broken | |
3336 | before any magical methods (e.g., DESTROY on a tie object) are called. | |
3337 | This prevents such methods from modifying the variable that will be seen | |
3338 | the next time the scope is entered. | |
3339 | ||
3340 | =item * | |
d5dc7001 | 3341 | |
05c8f9ed RS |
3342 | Creating a weak reference to an @ISA array or accessing the array index |
3343 | (C<$#ISA>) could result in confused internal bookkeeping for elements | |
3344 | subsequently added to the @ISA array. For instance, creating a weak | |
3345 | reference to the element itself could push that weak reference on to @ISA; | |
3346 | and elements added after use of C<$#ISA> would be ignored by method lookup | |
3347 | [perl #85670]. | |
d5dc7001 | 3348 | |
2630d42b | 3349 | =back |
d5dc7001 | 3350 | |
05c8f9ed | 3351 | =head2 Other notable fixes |
d5dc7001 | 3352 | |
05c8f9ed | 3353 | =over |
d5dc7001 | 3354 | |
05c8f9ed | 3355 | =item * |
d5dc7001 | 3356 | |
05c8f9ed RS |
3357 | C<quotemeta> now quotes consistently the same non-ASCII characters under |
3358 | C<use feature 'unicode_strings'>, regardless of whether the string is | |
3359 | encoded in UTF-8 or not, hence fixing the last vestiges (we hope) of the | |
3360 | infamous L<perlunicode/The "Unicode Bug">. [perl #77654]. | |
d5dc7001 | 3361 | |
05c8f9ed RS |
3362 | Which of these code points is quoted has changed, based on Unicode's |
3363 | recommendations. See L<perlfunc/quotemeta> for details. | |
d5dc7001 | 3364 | |
05c8f9ed | 3365 | =item * |
d5dc7001 | 3366 | |
05c8f9ed RS |
3367 | When one writes C<open foo || die>, which used to work in Perl 4, a |
3368 | "Precedence problem" warning is produced. This warning used erroneously to | |
3369 | apply to fully-qualified bareword handle names not followed by C<||>. This | |
3370 | has been corrected. | |
d5dc7001 | 3371 | |
05c8f9ed | 3372 | =item * |
d5dc7001 | 3373 | |
05c8f9ed RS |
3374 | After package aliasing (C<*foo:: = *bar::>), C<select> with 0 or 1 argument |
3375 | would sometimes return a name that could not be used to refer to the | |
3376 | filehandle, or sometimes it would return C<undef> even when a filehandle | |
3377 | was selected. Now it returns a typeglob reference in such cases. | |
d5dc7001 | 3378 | |
05c8f9ed RS |
3379 | =item * |
3380 | ||
3381 | C<PerlIO::get_layers> no longer ignores some arguments that it thinks are | |
3382 | numeric, while treating others as filehandle names. It is now consistent | |
3383 | for flat scalars (i.e., not references). | |
d5dc7001 A |
3384 | |
3385 | =item * | |
3386 | ||
05c8f9ed | 3387 | Unrecognised switches on C<#!> line |
0aae26c1 | 3388 | |
05c8f9ed RS |
3389 | If a switch, such as B<-x>, that cannot occur on the C<#!> line is used |
3390 | there, perl dies with "Can't emulate...". | |
0aae26c1 | 3391 | |
05c8f9ed RS |
3392 | It used to produce the same message for switches that perl did not |
3393 | recognise at all, whether on the command line or the C<#!> line. | |
e2e06450 | 3394 | |
05c8f9ed | 3395 | Now it produces the "Unrecognized switch" error message [perl #104288]. |
ccfdda5c | 3396 | |
05c8f9ed | 3397 | =item * |
e2e06450 | 3398 | |
05c8f9ed RS |
3399 | C<system> now temporarily blocks the SIGCHLD signal handler, to prevent the |
3400 | signal handler from stealing the exit status [perl #105700]. | |
3401 | ||
3402 | =item * | |
3403 | ||
3404 | The %n formatting code for C<printf> and C<sprintf>, which causes the number | |
3405 | of characters to be assigned to the next argument, now actually | |
3406 | assigns the number of characters, instead of the number of bytes. | |
3407 | ||
3408 | It also works now with special lvalue functions like C<substr> and with | |
3409 | nonexistent hash and array elements [perl #3471, #103492]. | |
3410 | ||
3411 | =item * | |
3412 | ||
3413 | Perl skips copying values returned from a subroutine, for the sake of | |
3414 | speed, if doing so would make no observable difference. Due to faulty | |
3415 | logic, this would happen with the | |
3416 | result of C<delete>, C<shift> or C<splice>, even if the result was | |
3417 | referenced elsewhere. It also did so with tied variables about to be freed | |
3418 | [perl #91844, #95548]. | |
3419 | ||
3420 | =item * | |
3421 | ||
3422 | C<utf8::decode> now refuses to modify read-only scalars [perl #91850]. | |
3423 | ||
3424 | =item * | |
3425 | ||
3426 | Freeing $_ inside a C<grep> or C<map> block, a code block embedded in a | |
3427 | regular expression, or an @INC filter (a subroutine returned by a | |
3428 | subroutine in @INC) used to result in double frees or crashes | |
3429 | [perl #91880, #92254, #92256]. | |
3430 | ||
3431 | =item * | |
3432 | ||
3433 | C<eval> returns C<undef> in scalar context or an empty list in list | |
3434 | context when there is a run-time error. When C<eval> was passed a | |
3435 | string in list context and a syntax error occurred, it used to return a | |
3436 | list containing a single undefined element. Now it returns an empty | |
3437 | list in list context for all errors [perl #80630]. | |
3438 | ||
3439 | =item * | |
3440 | ||
3441 | C<goto &func> no longer crashes, but produces an error message, when | |
3442 | the unwinding of the current subroutine's scope fires a destructor that | |
3443 | undefines the subroutine being "goneto" [perl #99850]. | |
3444 | ||
3445 | =item * | |
3446 | ||
3447 | Perl now holds an extra reference count on the package that code is | |
3448 | currently compiling in. This means that the following code no longer | |
3449 | crashes [perl #101486]: | |
3450 | ||
3451 | package Foo; | |
3452 | BEGIN {*Foo:: = *Bar::} | |
3453 | sub foo; | |
3454 | ||
3455 | =item * | |
3456 | ||
3457 | The C<x> repetition operator no longer crashes on 64-bit builds with large | |
3458 | repeat counts [perl #94560]. | |
3459 | ||
3460 | =item * | |
3461 | ||
3462 | Calling C<require> on an implicit C<$_> when C<*CORE::GLOBAL::require> has | |
3463 | been overridden does not segfault anymore, and C<$_> is now passed to the | |
3464 | overriding subroutine [perl #78260]. | |
3465 | ||
3466 | =item * | |
3467 | ||
3468 | C<use> and C<require> are no longer affected by the I/O layers active in | |
3469 | the caller's scope (enabled by L<open.pm|open>) [perl #96008]. | |
3470 | ||
3471 | =item * | |
3472 | ||
3473 | C<our $::é; $é> (which is invalid) no longer produces the "Compilation | |
3474 | error at lib/utf8_heavy.pl..." error message, which it started emitting in | |
3475 | 5.10.0 [perl #99984]. | |
3476 | ||
3477 | =item * | |
3478 | ||
3479 | On 64-bit systems, C<read()> now understands large string offsets beyond | |
3480 | the 32-bit range. | |
3481 | ||
3482 | =item * | |
3483 | ||
3484 | Errors that occur when processing subroutine attributes no longer cause the | |
3485 | subroutine's op tree to leak. | |
3486 | ||
3487 | =item * | |
3488 | ||
3489 | Passing the same constant subroutine to both C<index> and C<formline> no | |
3490 | longer causes one or the other to fail [perl #89218]. (5.14.1) | |
3491 | ||
3492 | =item * | |
3493 | ||
3494 | List assignment to lexical variables declared with attributes in the same | |
3495 | statement (C<my ($x,@y) : blimp = (72,94)>) stopped working in Perl 5.8.0. | |
3496 | It has now been fixed. | |
3497 | ||
3498 | =item * | |
3499 | ||
3500 | Perl 5.10.0 introduced some faulty logic that made "U*" in the middle of | |
3501 | a pack template equivalent to "U0" if the input string was empty. This has | |
3502 | been fixed [perl #90160]. | |
3503 | ||
3504 | =item * | |
3505 | ||
3506 | Destructors on objects were not called during global destruction on objects | |
3507 | that were not referenced by any scalars. This could happen if an array | |
3508 | element were blessed (e.g., C<bless \$a[0]>) or if a closure referenced a | |
3509 | blessed variable (C<bless \my @a; sub foo { @a }>). | |
3510 | ||
3511 | Now there is an extra pass during global destruction to fire destructors on | |
3512 | any objects that might be left after the usual passes that check for | |
3513 | objects referenced by scalars [perl #36347]. | |
3514 | ||
3515 | =item * | |
3516 | ||
3517 | Fixed a case where it was possible that a freed buffer may have been read | |
3518 | from when parsing a here document [perl #90128]. (5.14.1) | |
3519 | ||
3520 | =item * | |
3521 | ||
3522 | C<each(I<ARRAY>)> is now wrapped in C<defined(...)>, like C<each(I<HASH>)>, | |
3523 | inside a C<while> condition [perl #90888]. | |
3524 | ||
3525 | =item * | |
3526 | ||
3527 | A problem with context propagation when a C<do> block is an argument to | |
3528 | C<return> has been fixed. It used to cause C<undef> to be returned in | |
3529 | some cases of a C<return> inside an C<if> block which itself is followed by | |
3530 | another C<return>. | |
3531 | ||
3532 | =item * | |
3533 | ||
3534 | Calling C<index> with a tainted constant no longer causes constants in | |
3535 | subsequently compiled code to become tainted [perl #64804]. | |
3536 | ||
3537 | =item * | |
3538 | ||
3539 | Infinite loops like C<1 while 1> used to stop C<strict 'subs'> mode from | |
3540 | working for the rest of the block.t | |
3541 | ||
3542 | =item * | |
3543 | ||
3544 | For list assignments like C<($a,$b) = ($b,$a)>, Perl has to make a copy of | |
3545 | the items on the right-hand side before assignment them to the left. For | |
3546 | efficiency's sake, it assigns the values on the right straight to the items | |
3547 | on the left if no one variable is mentioned on both sides, as in C<($a,$b) = | |
3548 | ($c,$d)>. The logic for determining when it can cheat was faulty, in that | |
3549 | C<&&> and C<||> on the right-hand side could fool it. So C<($a,$b) = | |
3550 | $some_true_value && ($b,$a)> would end up assigning the value of C<$b> to | |
3551 | both scalars. | |
3552 | ||
3553 | =item * | |
3554 | ||
3555 | Perl no longer tries to apply lvalue context to the string in | |
3556 | C<("string", $variable) ||= 1> (which used to be an error). Since the | |
3557 | left-hand side of C<||=> is evaluated in scalar context, that's a scalar | |
3558 | comma operator, which gives all but the last item void context. There is | |
3559 | no such thing as void lvalue context, so it was a mistake for Perl to try | |
3560 | to force it [perl #96942]. | |
3561 | ||
3562 | =item * | |
3563 | ||
3564 | C<caller> no longer leaks memory when called from the DB package if | |
3565 | C<@DB::args> was assigned to after the first call to C<caller>. L<Carp> | |
3566 | was triggering this bug [perl #97010]. | |
3567 | ||
3568 | =item * | |
3569 | ||
3570 | C<close> and similar filehandle functions, when called on built-in global | |
3571 | variables (like C<$+>), used to die if the variable happened to hold the | |
3572 | undefined value, instead of producing the usual "Use of uninitialized | |
3573 | value" warning. | |
3574 | ||
3575 | =item * | |
3576 | ||
3577 | When autovivified file handles were introduced in Perl 5.6.0, C<readline> | |
3578 | was inadvertently made to autovivify when called as C<readline($foo)> (but | |
3579 | not as C<E<lt>$fooE<gt>>). It has now been fixed never to autovivify. | |
3580 | ||
3581 | =item * | |
3582 | ||
3583 | Calling an undefined anonymous subroutine (e.g., what $x holds after | |
3584 | C<undef &{$x = sub{}}>) used to cause a "Not a CODE reference" error, which | |
3585 | has been corrected to "Undefined subroutine called" [perl #71154]. | |
3586 | ||
3587 | =item * | |
3588 | ||
3589 | Causing C<@DB::args> to be freed between uses of C<caller> no longer | |
3590 | results in a crash [perl #93320]. | |
3591 | ||
3592 | =item * | |
3593 | ||
3594 | C<setpgrp($foo)> used to be equivalent to C<($foo, setpgrp)>, because | |
3595 | C<setpgrp> was ignoring its argument if there was just one. Now it is | |
3596 | equivalent to C<setpgrp($foo,0)>. | |
3597 | ||
3598 | =item * | |
3599 | ||
3600 | C<shmread> was not setting the scalar flags correctly when reading from | |
3601 | shared memory, causing the existing cached numeric representation in the | |
3602 | scalar to persist [perl #98480]. | |
3603 | ||
3604 | =item * | |
3605 | ||
3606 | C<++> and C<--> now work on copies of globs, instead of dying. | |
3607 | ||
3608 | =item * | |
3609 | ||
3610 | C<splice()> doesn't warn when truncating | |
3611 | ||
3612 | You can now limit the size of an array using C<splice(@a,MAX_LEN)> without | |
3613 | worrying about warnings. | |
3614 | ||
3615 | =item * | |
3616 | ||
3617 | C<< $$ >> is no longer tainted. Since this value comes directly from | |
3618 | C<< getpid() >>, it is always safe. | |
e2e06450 | 3619 | |
2630d42b | 3620 | =item * |
e2e06450 | 3621 | |
05c8f9ed RS |
3622 | The parser no longer leaks a filehandle if STDIN was closed before parsing |
3623 | started [perl #37033]. | |
3624 | ||
3625 | =item * | |
3626 | ||
3627 | C<< die; >> with a non-reference, non-string, or magical (e.g., tainted) | |
3628 | value in $@ now properly propagates that value [perl #111654]. | |
e2e06450 | 3629 | |
2630d42b | 3630 | =back |
e2e06450 | 3631 | |
2630d42b | 3632 | =head1 Known Problems |
e2e06450 | 3633 | |
05c8f9ed RS |
3634 | =over 4 |
3635 | ||
3636 | =item * | |
2e2b2571 | 3637 | |
05c8f9ed | 3638 | On Solaris, we have two kinds of failure. |
2e2b2571 | 3639 | |
05c8f9ed RS |
3640 | If F<make> is Sun's F<make≥>, we get an error about a badly formed macro |
3641 | assignment in the F<Makefile>. That happens when F<./Configure> tries to | |
3642 | make depends. F<Configure> then exits 0, but further F<make>-ing fails. | |
e2e06450 | 3643 | |
05c8f9ed RS |
3644 | If F<make> is F<gmake>, F<Configure> completes, then we get errors related |
3645 | to F</usr/include/stdbool.h> | |
e2e06450 | 3646 | |
2630d42b | 3647 | =item * |
ea88c40c | 3648 | |
05c8f9ed RS |
3649 | The following CPAN modules have test failures with perl 5.16. Patches have |
3650 | been submitted for all of these, so hopefully there will be new releases | |
3651 | soon: | |
18af289e | 3652 | |
05c8f9ed RS |
3653 | =over |
3654 | ||
3655 | =item * | |
3656 | ||
3657 | L<Date::Pcalc> version 6.1 | |
3658 | ||
3659 | =item * | |
3660 | ||
3661 | L<Module::CPANTS::Analyse> version 0.85 | |
3662 | ||
3663 | This fails due to problems in L<Module::Find> 0.10 and L<File::MMagic> | |
3664 | 1.27. | |
3665 | ||
3666 | =item * | |
3667 | ||
3668 | L<PerlIO::Util> version 0.72 | |
c0154fe2 | 3669 | |
05c8f9ed | 3670 | =back |
d5dc7001 | 3671 | |
05c8f9ed | 3672 | =back |
d5dc7001 | 3673 | |
2630d42b | 3674 | =head1 Acknowledgements |
d5dc7001 | 3675 | |
c73d2bdd RS |
3676 | Perl 5.16.0 represents approximately 12 months of development since Perl |
3677 | 5.14.0 and contains approximately 590,000 lines of changes across 2,500 | |
3678 | files from 137 authors. | |
3679 | ||
3680 | Perl continues to flourish into its third decade thanks to a vibrant | |
3681 | community of users and developers. The following people are known to | |
3682 | have contributed the improvements that became Perl 5.14.1: | |
3683 | ||
3684 | Aaron Crane, Abhijit Menon-Sen, Abigail, Alan Haggai Alavi, Alberto | |
3685 | Simões, Alexandr Ciornii, Andreas König, Andy Dougherty, Aristotle | |
3686 | Pagaltzis, Bo Johansson, Bo Lindbergh, brian d foy, Brian Fraser, Brian | |
3687 | Greenfield, Carl Hayter, Chas. Owens, Chia-liang Kao, Chip Salzenberg, | |
3688 | Chris 'BinGOs' Williams, Christian Hansen, Christopher J. Madsen, | |
3689 | chromatic, Claes Jacobsson, Claudio Ramirez, Craig A. Berry, Damian | |
3690 | Conway, Daniel Kahn Gillmor, Darin McBride, Dave Rolsky, David Cantrell, | |
3691 | David Golden, David Leadbeater, David Mitchell, Dee Newcum, Dennis | |
3692 | Kaarsemaker, Dominic Hargreaves, Douglas Christopher Wilson, Eric Brine, | |
3693 | Father Chrysostomos, Florian Ragwitz, Frederic Briere, George Greer, | |
3694 | Gerard Goossen, Gisle Aas, H.Merijn Brand, Hojung Youn, Ian Goodacre, | |
3695 | James E Keenan, Jan Dubois, Jerry D. Hedden, Jesse Luehrs, Jesse | |
3696 | Vincent, Jilles Tjoelker, Jim Cromie, Jim Meyering, Joel Berger, Johan | |
3697 | Vromans, Johannes Plunien, John Hawkinson, John P. Linderman, John | |
3698 | Peacock, Joshua ben Jore, Juerd Waalboer, Karl Williamson, Karthik | |
3699 | Rajagopalan, Keith Thompson, Kevin J. Woolley, Kevin Ryde, Laurent | |
3700 | Dami, Leo Lapworth, Leon Brocard, Leon Timmermans, Louis Strous, Lukas | |
3701 | Mai, Marc Green, Marcel Grünauer, Mark A. Stratman, Mark Dootson, Mark | |
3702 | Jason Dominus, Martin Hasch, Matthew Horsfall, Max Maischein, Michael G | |
3703 | Schwern, Michael Witten, Mike Sheldrake, Moritz Lenz, Nicholas Clark, | |
3704 | Niko Tyni, Nuno Carvalho, Pau Amma, Paul Evans, Paul Green, Paul | |
3705 | Johnson, Perlover, Peter John Acklam, Peter Martini, Peter Scott, Phil | |
3706 | Monsen, Pino Toscano, Rafael Garcia-Suarez, Rainer Tammer, Reini Urban, | |
3707 | Ricardo Signes, Robin Barker, Rodolfo Carvalho, Salvador Fandiño, Sam | |
3708 | Kimbrel, Samuel Thibault, Shawn M Moore, Shigeya Suzuki, Shlomi Fish, | |
3709 | Sisyphus, Slaven Rezic, Spiros Denaxas, Steffen Müller, Steffen | |
3710 | Schwigon, Stephen Bennett, Stephen Oberholtzer, Stevan Little, Steve | |
3711 | Hay, Steve Peters, Thomas Sibley, Thorsten Glaser, Timothe Litt, Todd | |
3712 | Rinaldo, Tom Christiansen, Tom Hukins, Tony Cook, Vadim Konovalov, | |
3713 | Vincent Pit, Vladimir Timofeev, Walt Mankowski, Yves Orton, Zefram, | |
3714 | Zsbán Ambrus, Ævar Arnfjörð Bjarmason. | |
3715 | ||
3716 | The list above is almost certainly incomplete as it is automatically | |
3717 | generated from version control history. In particular, it does not | |
3718 | include the names of the (very much appreciated) contributors who | |
3719 | reported issues to the Perl bug tracker. | |
3720 | ||
3721 | Many of the changes included in this version originated in the CPAN | |
3722 | modules included in Perl's core. We're grateful to the entire CPAN | |
3723 | community for helping Perl to flourish. | |
3724 | ||
3725 | For a more complete list of all of Perl's historical contributors, | |
3726 | please see the F<AUTHORS> file in the Perl source distribution. | |
29cf780c | 3727 | |
44691e6f AB |
3728 | =head1 Reporting Bugs |
3729 | ||
3730 | If you find what you think is a bug, you might check the articles | |
52deee2e | 3731 | recently posted to the comp.lang.perl.misc newsgroup and the perl |
05c8f9ed RS |
3732 | bug database at L<http://rt.perl.org/perlbug/>. There may also be |
3733 | information at L<http://www.perl.org/>, the Perl Home Page. | |
44691e6f AB |
3734 | |
3735 | If you believe you have an unreported bug, please run the L<perlbug> | |
52deee2e DR |
3736 | program included with your release. Be sure to trim your bug down |
3737 | to a tiny but sufficient test case. Your bug report, along with the | |
3738 | output of C<perl -V>, will be sent off to perlbug@perl.org to be | |
3739 | analysed by the Perl porting team. | |
44691e6f AB |
3740 | |
3741 | If the bug you are reporting has security implications, which make it | |
05c8f9ed RS |
3742 | inappropriate to send to a publicly archived mailing list, then please |
3743 | send it to perl5-security-report@perl.org. This points to a closed | |
3744 | subscription unarchived mailing list, which includes all the core | |
3745 | committers, who will be able to help assess the impact of issues, figure | |
3746 | out a resolution, and help co-ordinate the release of patches to | |
3747 | mitigate or fix the problem across all platforms on which Perl is | |
3748 | supported. Please only use this address for security issues in the Perl | |
3749 | core, not for modules independently distributed on CPAN. | |
44691e6f AB |
3750 | |
3751 | =head1 SEE ALSO | |
3752 | ||
52deee2e DR |
3753 | The F<Changes> file for an explanation of how to view exhaustive details |
3754 | on what changed. | |
44691e6f AB |
3755 | |
3756 | The F<INSTALL> file for how to build Perl. | |
3757 | ||
3758 | The F<README> file for general stuff. | |
3759 | ||
3760 | The F<Artistic> and F<Copying> files for copyright information. | |
3761 | ||
3762 | =cut |