| 1 | =encoding utf8 |
| 2 | |
| 3 | =head1 NAME |
| 4 | |
| 5 | perl5160delta - what is new for perl v5.16.0 |
| 6 | |
| 7 | =head1 DESCRIPTION |
| 8 | |
| 9 | This document describes differences between the 5.14.0 release and |
| 10 | the 5.16.0 release. |
| 11 | |
| 12 | If you are upgrading from an earlier release such as 5.12.0, first read |
| 13 | L<perl5140delta>, which describes differences between 5.12.0 and |
| 14 | 5.14.0. |
| 15 | |
| 16 | =head1 Notice |
| 17 | |
| 18 | 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 | |
| 651 | =item * |
| 652 | |
| 653 | Unescaped literal C<< "{" >> in regular expressions. |
| 654 | |
| 655 | It is planned starting in v5.20 to require a literal C<"{"> to be |
| 656 | escaped by, for example, preceding it with a backslash. In v5.18, a |
| 657 | deprecated warning message will be emitted for all such uses. Note that |
| 658 | this only affects patterns which are to match a literal C<"{">. Other |
| 659 | uses of this character, such as part of a quantifier or sequence like in |
| 660 | the ones below are completely unaffected: |
| 661 | |
| 662 | /foo{3,5}/ |
| 663 | /\p{Alphabetic}/ |
| 664 | /\N{DIGIT ZERO} |
| 665 | |
| 666 | The removal of this will allow extensions to pattern syntax, and better |
| 667 | error checking of existing syntax. See L<perlre/Quantifiers> for an |
| 668 | example. |
| 669 | |
| 670 | =back |
| 671 | |
| 672 | =head1 Incompatible Changes |
| 673 | |
| 674 | =head2 Special blocks called in void context |
| 675 | |
| 676 | Special blocks (C<BEGIN>, C<CHECK>, C<INIT>, C<UNITCHECK>, C<END>) are now |
| 677 | called in void context. This avoids wasteful copying of the result of the |
| 678 | last statement [perl #108794]. |
| 679 | |
| 680 | =head2 The C<overloading> pragma and regexp objects |
| 681 | |
| 682 | With C<no overloading>, regular expression objects returned by C<qr//> are |
| 683 | now stringified as "Regexp=REGEXP(0xbe600d)" instead of the regular |
| 684 | expression itself [perl #108780]. |
| 685 | |
| 686 | =head2 Two XS typemap Entries removed |
| 687 | |
| 688 | Two presumably unused XS typemap entries have been removed from the |
| 689 | core typemap: T_DATAUNIT and T_CALLBACK. If you are, against all odds, |
| 690 | a user of these, please see the instructions on how to regain them |
| 691 | in L<perlxstypemap>. |
| 692 | |
| 693 | =head2 Unicode 6.1 has incompatibilities with Unicode 6.0 |
| 694 | |
| 695 | These are detailed in L</Supports (almost) Unicode 6.1> above. |
| 696 | You can compile this version of Perl to use Unicode 6.0. See |
| 697 | L<perlunicode/Hacking Perl to work on earlier Unicode versions (for very serious hackers only)>. |
| 698 | |
| 699 | =head2 Borland compiler |
| 700 | |
| 701 | All support for the Borland compiler has been dropped. The code had not |
| 702 | worked for a long time anyway. |
| 703 | |
| 704 | =head2 Certain deprecated Unicode properties are no longer supported by default |
| 705 | |
| 706 | Perl should never have exposed certain Unicode properties that are used |
| 707 | by Unicode internally and not meant to be publicly available. Use of |
| 708 | these has generated deprecated warning messages since Perl 5.12. The |
| 709 | removed properties are Other_Alphabetic, |
| 710 | Other_Default_Ignorable_Code_Point, Other_Grapheme_Extend, |
| 711 | Other_ID_Continue, Other_ID_Start, Other_Lowercase, Other_Math, and |
| 712 | Other_Uppercase. |
| 713 | |
| 714 | Perl may be recompiled to include any or all of them; instructions are |
| 715 | given in |
| 716 | L<perluniprops/Unicode character properties that are NOT accepted by Perl>. |
| 717 | |
| 718 | =head2 Dereferencing IO thingies as typeglobs |
| 719 | |
| 720 | The C<*{...}> operator, when passed a reference to an IO thingy (as in |
| 721 | C<*{*STDIN{IO}}>), creates a new typeglob containing just that IO object. |
| 722 | Previously, it would stringify as an empty string, but some operators would |
| 723 | treat it as undefined, producing an "uninitialized" warning. |
| 724 | Now it stringifies as __ANONIO__ [perl #96326]. |
| 725 | |
| 726 | =head2 User-defined case-changing operations |
| 727 | |
| 728 | This feature was deprecated in Perl 5.14, and has now been removed. |
| 729 | The CPAN module L<Unicode::Casing> provides better functionality without |
| 730 | the drawbacks that this feature had, as are detailed in the 5.14 |
| 731 | documentation: |
| 732 | L<http://perldoc.perl.org/5.14.0/perlunicode.html#User-Defined-Case-Mappings-%28for-serious-hackers-only%29> |
| 733 | |
| 734 | =head2 XSUBs are now 'static' |
| 735 | |
| 736 | XSUB C functions are now 'static', that is, they are not visible from |
| 737 | outside the compilation unit. Users can use the new C<XS_EXTERNAL(name)> |
| 738 | and C<XS_INTERNAL(name)> macros to pick the desired linking behaviour. |
| 739 | The ordinary C<XS(name)> declaration for XSUBs will continue to declare |
| 740 | non-'static' XSUBs for compatibility, but the XS compiler, |
| 741 | C<ExtUtils::ParseXS> (C<xsubpp>) will emit 'static' XSUBs by default. |
| 742 | C<ExtUtils::ParseXS>'s behaviour can be reconfigured from XS using the |
| 743 | C<EXPORT_XSUB_SYMBOLS> keyword. See L<perlxs> for details. |
| 744 | |
| 745 | =head2 Weakening read-only references |
| 746 | |
| 747 | Weakening read-only references is no longer permitted. It should never |
| 748 | have worked anyway, and in some cases could result in crashes. |
| 749 | |
| 750 | =head2 Tying scalars that hold typeglobs |
| 751 | |
| 752 | Attempting to tie a scalar after a typeglob was assigned to it would |
| 753 | instead tie the handle in the typeglob's IO slot. This meant that it was |
| 754 | impossible to tie the scalar itself. Similar problems affected C<tied> and |
| 755 | C<untie>: C<tied $scalar> would return false on a tied scalar if the last |
| 756 | thing returned was a typeglob, and C<untie $scalar> on such a tied scalar |
| 757 | would do nothing. |
| 758 | |
| 759 | We fixed this problem before Perl 5.14.0, but it caused problems with some |
| 760 | CPAN modules, so we put in a deprecation cycle instead. |
| 761 | |
| 762 | Now the deprecation has been removed and this bug has been fixed. So |
| 763 | C<tie $scalar> will always tie the scalar, not the handle it holds. To tie |
| 764 | the handle, use C<tie *$scalar> (with an explicit asterisk). The same |
| 765 | applies to C<tied *$scalar> and C<untie *$scalar>. |
| 766 | |
| 767 | =head2 IPC::Open3 no longer provides C<xfork()>, C<xclose_on_exec()> |
| 768 | and C<xpipe_anon()> |
| 769 | |
| 770 | All three functions were private, undocumented and unexported. They do |
| 771 | not appear to be used by any code on CPAN. Two have been inlined and one |
| 772 | deleted entirely. |
| 773 | |
| 774 | =head2 C<$$> no longer caches PID |
| 775 | |
| 776 | Previously, if one called fork(3) from C, Perl's |
| 777 | notion of C<$$> could go out of sync with what getpid() returns. By always |
| 778 | fetching the value of C<$$> via getpid(), this potential bug is eliminated. |
| 779 | Code that depends on the caching behavior will break. As described in |
| 780 | L<Core Enhancements|/C<$$> can be assigned to>, |
| 781 | C<$$> is now writable, but it will be reset during a |
| 782 | fork. |
| 783 | |
| 784 | =head2 C<$$> and C<getppid()> no longer emulate POSIX semantics under LinuxThreads |
| 785 | |
| 786 | The POSIX emulation of C<$$> and C<getppid()> under the obsolete |
| 787 | LinuxThreads implementation has been removed. |
| 788 | This only impacts users of Linux 2.4 and |
| 789 | users of Debian GNU/kFreeBSD up to and including 6.0, not the vast |
| 790 | majority of Linux installations that use NPTL threads. |
| 791 | |
| 792 | This means that C<getppid()>, like C<$$>, is now always guaranteed to |
| 793 | return the OS's idea of the current state of the process, not perl's |
| 794 | cached version of it. |
| 795 | |
| 796 | See the documentation for L<$$|perlvar/$$> for details. |
| 797 | |
| 798 | =head2 C<< $< >>, C<< $> >>, C<$(> and C<$)> are no longer cached |
| 799 | |
| 800 | Similarly to the changes to C<$$> and C<getppid()>, the internal |
| 801 | caching of C<< $< >>, C<< $> >>, C<$(> and C<$)> has been removed. |
| 802 | |
| 803 | When we cached these values our idea of what they were would drift out |
| 804 | of sync with reality if someone (e.g., someone embedding perl) called |
| 805 | C<sete?[ug]id()> without updating C<PL_e?[ug]id>. Having to deal with |
| 806 | this complexity wasn't worth it given how cheap the C<gete?[ug]id()> |
| 807 | system call is. |
| 808 | |
| 809 | This change will break a handful of CPAN modules that use the XS-level |
| 810 | C<PL_uid>, C<PL_gid>, C<PL_euid> or C<PL_egid> variables. |
| 811 | |
| 812 | The fix for those breakages is to use C<PerlProc_gete?[ug]id()> to |
| 813 | retrieve them (e.g. C<PerlProc_getuid()>), and not to assign to |
| 814 | C<PL_e?[ug]id> if you change the UID/GID/EUID/EGID. There is no longer |
| 815 | any need to do so since perl will always retrieve the up-to-date |
| 816 | version of those values from the OS. |
| 817 | |
| 818 | =head2 Which Non-ASCII characters get quoted by C<quotemeta> and C<\Q> has changed |
| 819 | |
| 820 | This is unlikely to result in a real problem, as Perl does not attach |
| 821 | special meaning to any non-ASCII character, so it is currently |
| 822 | irrelevant which are quoted or not. This change fixes bug [perl #77654] and |
| 823 | bring Perl's behavior more into line with Unicode's recommendations. |
| 824 | See L<perlfunc/quotemeta>. |
| 825 | |
| 826 | =head1 Performance Enhancements |
| 827 | |
| 828 | =over |
| 829 | |
| 830 | =item * |
| 831 | |
| 832 | Improved performance for Unicode properties in regular expressions |
| 833 | |
| 834 | =for comment Can this be compacted some? -- rjbs, 2012-02-20 |
| 835 | |
| 836 | Matching a code point against a Unicode property is now done via a |
| 837 | binary search instead of linear. This means for example that the worst |
| 838 | case for a 1000 item property is 10 probes instead of 1000. This |
| 839 | inefficiency has been compensated for in the past by permanently storing |
| 840 | in a hash the results of a given probe plus the results for the adjacent |
| 841 | 64 code points, under the theory that near-by code points are likely to |
| 842 | be searched for. A separate hash was used for each mention of a Unicode |
| 843 | property in each regular expression. Thus, C<qr/\p{foo}abc\p{foo}/> |
| 844 | would generate two hashes. Any probes in one instance would be unknown |
| 845 | to the other, and the hashes could expand separately to be quite large |
| 846 | if the regular expression were used on many different widely-separated |
| 847 | code points. This can lead to running out of memory in extreme cases. |
| 848 | Now, however, there is just one hash shared by all instances of a given |
| 849 | property. This means that if C<\p{foo}> is matched against "A" in one |
| 850 | regular expression in a thread, the result will be known immediately to |
| 851 | all regular expressions, and the relentless march of using up memory is |
| 852 | slowed considerably. |
| 853 | |
| 854 | =item * |
| 855 | |
| 856 | Version declarations with the C<use> keyword (e.g., C<use 5.012>) are now |
| 857 | faster, as they enable features without loading F<feature.pm>. |
| 858 | |
| 859 | =item * |
| 860 | |
| 861 | C<local $_> is faster now, as it no longer iterates through magic that it |
| 862 | is not going to copy anyway. |
| 863 | |
| 864 | =item * |
| 865 | |
| 866 | Perl 5.12.0 sped up the destruction of objects whose classes define |
| 867 | empty C<DESTROY> methods (to prevent autoloading), by simply not |
| 868 | calling such empty methods. This release takes this optimisation a |
| 869 | step further, by not calling any C<DESTROY> method that begins with a |
| 870 | C<return> statement. This can be useful for destructors that are only |
| 871 | used for debugging: |
| 872 | |
| 873 | use constant DEBUG => 1; |
| 874 | sub DESTROY { return unless DEBUG; ... } |
| 875 | |
| 876 | Constant-folding will reduce the first statement to C<return;> if DEBUG |
| 877 | is set to 0, triggering this optimisation. |
| 878 | |
| 879 | =item * |
| 880 | |
| 881 | Assigning to a variable that holds a typeglob or copy-on-write scalar |
| 882 | is now much faster. Previously the typeglob would be stringified or |
| 883 | the copy-on-write scalar would be copied before being clobbered. |
| 884 | |
| 885 | =item * |
| 886 | |
| 887 | Assignment to C<substr> in void context is now more than twice its |
| 888 | previous speed. Instead of creating and returning a special lvalue |
| 889 | scalar that is then assigned to, C<substr> modifies the original string |
| 890 | itself. |
| 891 | |
| 892 | =item * |
| 893 | |
| 894 | C<substr> no longer calculates a value to return when called in void |
| 895 | context. |
| 896 | |
| 897 | =item * |
| 898 | |
| 899 | Due to changes in L<File::Glob>, Perl's C<glob> function and its C<< |
| 900 | <...> >> equivalent are now much faster. The splitting of the pattern |
| 901 | into words has been rewritten in C, resulting in speed-ups of 20% in |
| 902 | some cases. |
| 903 | |
| 904 | This does not affect C<glob> on VMS, as it does not use File::Glob. |
| 905 | |
| 906 | =item * |
| 907 | |
| 908 | The short-circuiting operators C<&&>, C<||>, and C<//>, when chained |
| 909 | (such as C<$a || $b || $c>), are now considerably faster to short-circuit, |
| 910 | due to reduced optree traversal. |
| 911 | |
| 912 | =item * |
| 913 | |
| 914 | The implementation of C<s///r> makes one fewer copy of the scalar's value. |
| 915 | |
| 916 | =item * |
| 917 | |
| 918 | C<study> is now a no-op. |
| 919 | |
| 920 | =item * |
| 921 | |
| 922 | Recursive calls to lvalue subroutines in lvalue scalar context use less |
| 923 | memory. |
| 924 | |
| 925 | =back |
| 926 | |
| 927 | =head1 Modules and Pragmata |
| 928 | |
| 929 | =head2 Deprecated Modules |
| 930 | |
| 931 | =over |
| 932 | |
| 933 | =item L<Version::Requirements> |
| 934 | |
| 935 | Version::Requirements is now DEPRECATED, use L<CPAN::Meta::Requirements>, |
| 936 | which is a drop-in replacement. It will be deleted from perl.git blead |
| 937 | in v5.17.0. |
| 938 | |
| 939 | =back |
| 940 | |
| 941 | =head2 New Modules and Pragmata |
| 942 | |
| 943 | =over 4 |
| 944 | |
| 945 | =item * |
| 946 | |
| 947 | L<arybase> -- this new module implements the C<$[> variable. |
| 948 | |
| 949 | =item * |
| 950 | |
| 951 | C<PerlIO::mmap> 0.010 has been added to the Perl core. |
| 952 | |
| 953 | The C<mmap> PerlIO layer is no longer implemented by perl itself, but has |
| 954 | been moved out into the new L<PerlIO::mmap> module. |
| 955 | |
| 956 | =back |
| 957 | |
| 958 | =head2 Updated Modules and Pragmata |
| 959 | |
| 960 | =over 4 |
| 961 | |
| 962 | =item * |
| 963 | |
| 964 | L<XXX> has been upgraded from version 0.69 to version 0.70. |
| 965 | |
| 966 | =back |
| 967 | |
| 968 | =head2 Removed Modules and Pragmata |
| 969 | |
| 970 | As promised in Perl 5.14.0's release notes, the following modules have |
| 971 | been removed from the core distribution, and if needed should be installed |
| 972 | from CPAN instead. |
| 973 | |
| 974 | =over |
| 975 | |
| 976 | =item * |
| 977 | |
| 978 | C<Devel::DProf> has been removed from the Perl core. Prior version was |
| 979 | 20110228.00. |
| 980 | |
| 981 | =item * |
| 982 | |
| 983 | C<Shell> has been removed from the Perl core. Prior version was 0.72_01. |
| 984 | |
| 985 | =back |
| 986 | |
| 987 | =head1 Documentation |
| 988 | |
| 989 | =head2 New Documentation |
| 990 | |
| 991 | =head3 L<perldtrace> |
| 992 | |
| 993 | L<perldtrace> describes Perl's DTrace support, listing the provided probes |
| 994 | and gives examples of their use. |
| 995 | |
| 996 | =head3 L<perlexperiment> |
| 997 | |
| 998 | This document is intended to provide a list of experimental features in |
| 999 | Perl. It is still a work in progress. |
| 1000 | |
| 1001 | =head3 L<perlootut> |
| 1002 | |
| 1003 | This a new OO tutorial. It focuses on basic OO concepts, and then recommends |
| 1004 | that readers choose an OO framework from CPAN. |
| 1005 | |
| 1006 | =head3 L<perlxstypemap> |
| 1007 | |
| 1008 | The new manual describes the XS typemapping mechanism in unprecedented |
| 1009 | detail and combines new documentation with information extracted from |
| 1010 | L<perlxs> and the previously unofficial list of all core typemaps. |
| 1011 | |
| 1012 | =head2 Changes to Existing Documentation |
| 1013 | |
| 1014 | =head3 L<perlapi> |
| 1015 | |
| 1016 | =over 4 |
| 1017 | |
| 1018 | =item * |
| 1019 | |
| 1020 | The HV API has long accepted negative lengths to indicate that the key is |
| 1021 | in UTF8. Now this is documented. |
| 1022 | |
| 1023 | =item * |
| 1024 | |
| 1025 | The C<boolSV()> macro is now documented. |
| 1026 | |
| 1027 | =back |
| 1028 | |
| 1029 | =head3 L<perlfunc> |
| 1030 | |
| 1031 | =over 4 |
| 1032 | |
| 1033 | =item * |
| 1034 | |
| 1035 | C<dbmopen> treats a 0 mode as a special case, that prevents a nonexistent |
| 1036 | file from being created. This has been the case since Perl 5.000, but was |
| 1037 | never documented anywhere. Now the perlfunc entry mentions it |
| 1038 | [perl #90064]. |
| 1039 | |
| 1040 | =item * |
| 1041 | |
| 1042 | As an accident of history, C<open $fh, "<:", ...> applies the default |
| 1043 | layers for the platform (C<:raw> on Unix, C<:crlf> on Windows), ignoring |
| 1044 | whatever is declared by L<open.pm|open>. This seems such a useful feature |
| 1045 | it has been documented in L<perlfunc|perlfunc/open> and L<open>. |
| 1046 | |
| 1047 | =item * |
| 1048 | |
| 1049 | The entry for C<split> has been rewritten. It is now far clearer than |
| 1050 | before. |
| 1051 | |
| 1052 | =back |
| 1053 | |
| 1054 | =head3 L<perlguts> |
| 1055 | |
| 1056 | =over 4 |
| 1057 | |
| 1058 | =item * |
| 1059 | |
| 1060 | A new section, L<Autoloading with XSUBs|perlguts/Autoloading with XSUBs>, |
| 1061 | has been added, which explains the two APIs for accessing the name of the |
| 1062 | autoloaded sub. |
| 1063 | |
| 1064 | =item * |
| 1065 | |
| 1066 | Some of the function descriptions in L<perlguts> were confusing, as it was |
| 1067 | not clear whether they referred to the function above or below the |
| 1068 | description. This has been clarified [perl #91790]. |
| 1069 | |
| 1070 | =back |
| 1071 | |
| 1072 | =head3 L<perlobj> |
| 1073 | |
| 1074 | =over 4 |
| 1075 | |
| 1076 | =item * |
| 1077 | |
| 1078 | This document has been rewritten from scratch, and its coverage of various OO |
| 1079 | concepts has been expanded. |
| 1080 | |
| 1081 | =back |
| 1082 | |
| 1083 | =head3 L<perlop> |
| 1084 | |
| 1085 | =over 4 |
| 1086 | |
| 1087 | =item * |
| 1088 | |
| 1089 | Documentation of the smartmatch operator has been reworked and moved from |
| 1090 | perlsyn to perlop where it belongs. |
| 1091 | |
| 1092 | It has also been corrected for the case of C<undef> on the left-hand |
| 1093 | side. The list of different smart match behaviours had an item in the |
| 1094 | wrong place. |
| 1095 | |
| 1096 | =item * |
| 1097 | |
| 1098 | Documentation of the ellipsis statement (C<...>) has been reworked and |
| 1099 | moved from perlop to perlsyn. |
| 1100 | |
| 1101 | =item * |
| 1102 | |
| 1103 | The explanation of bitwise operators has been expanded to explain how they |
| 1104 | work on Unicode strings (5.14.1). |
| 1105 | |
| 1106 | =item * |
| 1107 | |
| 1108 | More examples for C<m//g> have been added (5.14.1). |
| 1109 | |
| 1110 | =item * |
| 1111 | |
| 1112 | The C<<< <<\FOO >>> here-doc syntax has been documented (5.14.1). |
| 1113 | |
| 1114 | =back |
| 1115 | |
| 1116 | =head3 L<perlpragma> |
| 1117 | |
| 1118 | =over 4 |
| 1119 | |
| 1120 | =item * |
| 1121 | |
| 1122 | There is now a standard convention for naming keys in the C<%^H>, |
| 1123 | documented under L<Key naming|perlpragma/Key naming>. |
| 1124 | |
| 1125 | =back |
| 1126 | |
| 1127 | =head3 L<perlsec/Laundering and Detecting Tainted Data> |
| 1128 | |
| 1129 | =over 4 |
| 1130 | |
| 1131 | =item * |
| 1132 | |
| 1133 | The example function for checking for taintedness contained a subtle |
| 1134 | error. C<$@> needs to be localized to prevent its changing this |
| 1135 | global's value outside the function. The preferred method to check for |
| 1136 | this remains L<Scalar::Util/tainted>. |
| 1137 | |
| 1138 | =back |
| 1139 | |
| 1140 | =head3 L<perllol> |
| 1141 | |
| 1142 | =over |
| 1143 | |
| 1144 | =item * |
| 1145 | |
| 1146 | L<perllol> has been expanded with examples using the new C<push $scalar> |
| 1147 | syntax introduced in Perl 5.14.0 (5.14.1). |
| 1148 | |
| 1149 | =back |
| 1150 | |
| 1151 | =head3 L<perlmod> |
| 1152 | |
| 1153 | =over |
| 1154 | |
| 1155 | =item * |
| 1156 | |
| 1157 | L<perlmod> now states explicitly that some types of explicit symbol table |
| 1158 | manipulation are not supported. This codifies what was effectively already |
| 1159 | the case [perl #78074]. |
| 1160 | |
| 1161 | =back |
| 1162 | |
| 1163 | =head3 L<perlpodstyle> |
| 1164 | |
| 1165 | =over 4 |
| 1166 | |
| 1167 | =item * |
| 1168 | |
| 1169 | The tips on which formatting codes to use have been corrected and greatly |
| 1170 | expanded. |
| 1171 | |
| 1172 | =item * |
| 1173 | |
| 1174 | There are now a couple of example one-liners for previewing POD files after |
| 1175 | they have been edited. |
| 1176 | |
| 1177 | =back |
| 1178 | |
| 1179 | =head3 L<perlre> |
| 1180 | |
| 1181 | =over |
| 1182 | |
| 1183 | =item * |
| 1184 | |
| 1185 | The C<(*COMMIT)> directive is now listed in the right section |
| 1186 | (L<Verbs without an argument|perlre/Verbs without an argument>). |
| 1187 | |
| 1188 | =back |
| 1189 | |
| 1190 | =head3 L<perlrun> |
| 1191 | |
| 1192 | =over |
| 1193 | |
| 1194 | =item * |
| 1195 | |
| 1196 | L<perlrun> has undergone a significant clean-up. Most notably, the |
| 1197 | B<-0x...> form of the B<-0> flag has been clarified, and the final section |
| 1198 | on environment variables has been corrected and expanded (5.14.1). |
| 1199 | |
| 1200 | =back |
| 1201 | |
| 1202 | =head3 L<perlsub> |
| 1203 | |
| 1204 | =over |
| 1205 | |
| 1206 | =item * |
| 1207 | |
| 1208 | The ($;) prototype syntax, which has existed for rather a long time, is now |
| 1209 | documented in L<perlsub>. It allows a unary function to have the same |
| 1210 | precedence as a list operator. |
| 1211 | |
| 1212 | =back |
| 1213 | |
| 1214 | =head3 L<perltie> |
| 1215 | |
| 1216 | =over |
| 1217 | |
| 1218 | =item * |
| 1219 | |
| 1220 | The required syntax for tying handles has been documented. |
| 1221 | |
| 1222 | =back |
| 1223 | |
| 1224 | =head3 L<perlvar> |
| 1225 | |
| 1226 | =over |
| 1227 | |
| 1228 | =item * |
| 1229 | |
| 1230 | The documentation for L<$!|perlvar/$!> has been corrected and clarified. |
| 1231 | It used to state that $! could be C<undef>, which is not the case. It was |
| 1232 | also unclear as to whether system calls set C's C<errno> or Perl's C<$!> |
| 1233 | [perl #91614]. |
| 1234 | |
| 1235 | =item * |
| 1236 | |
| 1237 | Documentation for L<$$|perlvar/$$> has been amended with additional |
| 1238 | cautions regarding changing the process ID. |
| 1239 | |
| 1240 | =back |
| 1241 | |
| 1242 | =head3 Other Changes |
| 1243 | |
| 1244 | =over 4 |
| 1245 | |
| 1246 | =item * |
| 1247 | |
| 1248 | L<perlxs> was extended with documentation on inline typemaps. |
| 1249 | |
| 1250 | =item * |
| 1251 | |
| 1252 | L<perlref> has a new L<Circular References|perlref/Circular References> |
| 1253 | section explaining how circularities may not be freed and how to solve that |
| 1254 | with weak references. |
| 1255 | |
| 1256 | =item * |
| 1257 | |
| 1258 | Parts of L<perlapi> were clarified, and Perl equivalents of some C |
| 1259 | functions have been added as an additional mode of exposition. |
| 1260 | |
| 1261 | =item * |
| 1262 | |
| 1263 | A few parts of L<perlre> and L<perlrecharclass> were clarified. |
| 1264 | |
| 1265 | =back |
| 1266 | |
| 1267 | =head2 Removed Documentation |
| 1268 | |
| 1269 | =head3 Old OO Documentation |
| 1270 | |
| 1271 | All the old OO tutorials, perltoot, perltooc, and perlboot, have been |
| 1272 | removed. The perlbot (bag of object tricks) document has been removed |
| 1273 | as well. |
| 1274 | |
| 1275 | =head3 Development Deltas |
| 1276 | |
| 1277 | The perldelta files for development releases are no longer packaged with |
| 1278 | perl. These can still be found in the perl source code repository. |
| 1279 | |
| 1280 | =head1 Diagnostics |
| 1281 | |
| 1282 | The following additions or changes have been made to diagnostic output, |
| 1283 | including warnings and fatal error messages. For the complete list of |
| 1284 | diagnostic messages, see L<perldiag>. |
| 1285 | |
| 1286 | =head2 New Diagnostics |
| 1287 | |
| 1288 | =head3 New Errors |
| 1289 | |
| 1290 | =over 4 |
| 1291 | |
| 1292 | =item * |
| 1293 | |
| 1294 | L<Cannot set tied @DB::args|perldiag/"Cannot set tied @DB::args"> |
| 1295 | |
| 1296 | This error occurs when C<caller> tries to set C<@DB::args> but finds it |
| 1297 | tied. Before this error was added, it used to crash instead. |
| 1298 | |
| 1299 | =item * |
| 1300 | |
| 1301 | L<Cannot tie unreifiable array|perldiag/"Cannot tie unreifiable array"> |
| 1302 | |
| 1303 | This error is part of a safety check that the C<tie> operator does before |
| 1304 | tying a special array like C<@_>. You should never see this message. |
| 1305 | |
| 1306 | =item * |
| 1307 | |
| 1308 | L<&CORE::%s cannot be called directly|perldiag/"&CORE::%s cannot be called directly"> |
| 1309 | |
| 1310 | This occurs when a subroutine in the C<CORE::> namespace is called |
| 1311 | with C<&foo> syntax or through a reference. Some subroutines |
| 1312 | in this package cannot yet be called that way, but must be |
| 1313 | called as barewords. See L</Subroutines in the C<CORE> namespace>, above. |
| 1314 | |
| 1315 | =item * |
| 1316 | |
| 1317 | L<Source filters apply only to byte streams|perldiag/"Source filters apply only to byte streams"> |
| 1318 | |
| 1319 | This new error occurs when you try to activate a source filter (usually by |
| 1320 | loading a source filter module) within a string passed to C<eval> under the |
| 1321 | C<unicode_eval> feature. |
| 1322 | |
| 1323 | =back |
| 1324 | |
| 1325 | =head3 New Warnings |
| 1326 | |
| 1327 | =over 4 |
| 1328 | |
| 1329 | =item * |
| 1330 | |
| 1331 | L<defined(@array) is deprecated|perldiag/"defined(@array) is deprecated"> |
| 1332 | |
| 1333 | The long-deprecated C<defined(@array)> now also warns for package variables. |
| 1334 | Previously it only issued a warning for lexical variables. |
| 1335 | |
| 1336 | =item * |
| 1337 | |
| 1338 | L<length() used on %s|perldiag/length() used on %s> |
| 1339 | |
| 1340 | This new warning occurs when C<length> is used on an array or hash, instead |
| 1341 | of C<scalar(@array)> or C<scalar(keys %hash)>. |
| 1342 | |
| 1343 | =item * |
| 1344 | |
| 1345 | L<lvalue attribute %s already-defined subroutine|perldiag/"lvalue attribute %s already-defined subroutine"> |
| 1346 | |
| 1347 | L<attributes.pm|attributes> now emits this warning when the :lvalue |
| 1348 | attribute is applied to a Perl subroutine that has already been defined, as |
| 1349 | doing so can have unexpected side-effects. |
| 1350 | |
| 1351 | =item * |
| 1352 | |
| 1353 | L<overload arg '%s' is invalid|perldiag/"overload arg '%s' is invalid"> |
| 1354 | |
| 1355 | This warning, in the "overload" category, is produced when the overload |
| 1356 | pragma is given an argument it doesn't recognize, presumably a mistyped |
| 1357 | operator. |
| 1358 | |
| 1359 | =item * |
| 1360 | |
| 1361 | L<$[ used in %s (did you mean $] ?)|perldiag/"$[ used in %s (did you mean $] ?)"> |
| 1362 | |
| 1363 | This new warning exists to catch the mistaken use of C<$[> in version |
| 1364 | checks. C<$]>, not C<$[>, contains the version number. |
| 1365 | |
| 1366 | =item * |
| 1367 | |
| 1368 | L<Useless assignment to a temporary|perldiag/"Useless assignment to a temporary"> |
| 1369 | |
| 1370 | Assigning to a temporary scalar returned |
| 1371 | from an lvalue subroutine now produces this |
| 1372 | warning [perl #31946]. |
| 1373 | |
| 1374 | =item * |
| 1375 | |
| 1376 | L<Useless use of \E|perldiag/"Useless use of \E"> |
| 1377 | |
| 1378 | C<\E> does nothing unless preceded by C<\Q>, C<\L> or C<\U>. |
| 1379 | |
| 1380 | =back |
| 1381 | |
| 1382 | =head2 Removed Errors |
| 1383 | |
| 1384 | =over |
| 1385 | |
| 1386 | =item * |
| 1387 | |
| 1388 | "sort is now a reserved word" |
| 1389 | |
| 1390 | This error used to occur when C<sort> was called without arguments, |
| 1391 | followed by C<;> or C<)>. (E.g., C<sort;> would die, but C<{sort}> was |
| 1392 | OK.) This error message was added in Perl 3 to catch code like |
| 1393 | C<close(sort)> which would no longer work. More than two decades later, |
| 1394 | this message is no longer appropriate. Now C<sort> without arguments is |
| 1395 | always allowed, and returns an empty list, as it did in those cases |
| 1396 | where it was already allowed [perl #90030]. |
| 1397 | |
| 1398 | =back |
| 1399 | |
| 1400 | =head2 Changes to Existing Diagnostics |
| 1401 | |
| 1402 | =over 4 |
| 1403 | |
| 1404 | =item * |
| 1405 | |
| 1406 | The "Applying pattern match..." or similar warning produced when an |
| 1407 | array or hash is on the left-hand side of the C<=~> operator now |
| 1408 | mentions the name of the variable. |
| 1409 | |
| 1410 | =item * |
| 1411 | |
| 1412 | The "Attempt to free non-existent shared string" has had the spelling |
| 1413 | of "non-existent" corrected to "nonexistent". It was already listed |
| 1414 | with the correct spelling in L<perldiag>. |
| 1415 | |
| 1416 | =item * |
| 1417 | |
| 1418 | The error messages for using C<default> and C<when> outside of a |
| 1419 | topicalizer have been standardised to match the messages for C<continue> |
| 1420 | and loop controls. They now read 'Can't "default" outside a |
| 1421 | topicalizer' and 'Can't "when" outside a topicalizer'. They both used |
| 1422 | to be 'Can't use when() outside a topicalizer' [perl #91514]. |
| 1423 | |
| 1424 | =item * |
| 1425 | |
| 1426 | The message, "Code point 0x%X is not Unicode, no properties match it; |
| 1427 | all inverse properties do" has been changed to "Code point 0x%X is not |
| 1428 | Unicode, all \p{} matches fail; all \P{} matches succeed". |
| 1429 | |
| 1430 | =item * |
| 1431 | |
| 1432 | Redefinition warnings for constant subroutines used to be mandatory, |
| 1433 | even occurring under C<no warnings>. Now they respect the L<warnings> |
| 1434 | pragma. |
| 1435 | |
| 1436 | =item * |
| 1437 | |
| 1438 | The "glob failed" warning message is now suppressible via C<no warnings> |
| 1439 | [perl #111656]. |
| 1440 | |
| 1441 | =item * |
| 1442 | |
| 1443 | The L<Invalid version format|perldiag/"Invalid version format (%s)"> |
| 1444 | error message now says "negative version number" within the parentheses, |
| 1445 | rather than "non-numeric data", for negative numbers. |
| 1446 | |
| 1447 | =item * |
| 1448 | |
| 1449 | The two warnings |
| 1450 | L<Possible attempt to put comments in qw() list|perldiag/"Possible attempt to put comments in qw() list"> |
| 1451 | and |
| 1452 | L<Possible attempt to separate words with commas|perldiag/"Possible attempt to separate words with commas"> |
| 1453 | are no longer mutually exclusive: the same C<qw> construct may produce |
| 1454 | both. |
| 1455 | |
| 1456 | =item * |
| 1457 | |
| 1458 | The uninitialized warning for C<y///r> when C<$_> is implicit and |
| 1459 | undefined now mentions the variable name, just like the non-/r variation |
| 1460 | of the operator. |
| 1461 | |
| 1462 | =item * |
| 1463 | |
| 1464 | The 'Use of "foo" without parentheses is ambiguous' warning has been |
| 1465 | extended to apply also to user-defined subroutines with a (;$) |
| 1466 | prototype, and not just to built-in functions. |
| 1467 | |
| 1468 | =item * |
| 1469 | |
| 1470 | Warnings that mention the names of lexical (C<my>) variables with |
| 1471 | Unicode characters in them now respect the presence or absence of the |
| 1472 | C<:utf8> layer on the output handle, instead of outputting UTF8 |
| 1473 | regardless. Also, the correct names are included in the strings passed |
| 1474 | to C<$SIG{__WARN__}> handlers, rather than the raw UTF8 bytes. |
| 1475 | |
| 1476 | =back |
| 1477 | |
| 1478 | =head1 Utility Changes |
| 1479 | |
| 1480 | =head3 L<h2ph> |
| 1481 | |
| 1482 | =over 4 |
| 1483 | |
| 1484 | =item * |
| 1485 | |
| 1486 | L<h2ph> used to generate code of the form |
| 1487 | |
| 1488 | unless(defined(&FOO)) { |
| 1489 | sub FOO () {42;} |
| 1490 | } |
| 1491 | |
| 1492 | But the subroutine is a compile-time declaration, and is hence unaffected |
| 1493 | by the condition. It has now been corrected to emit a string C<eval> |
| 1494 | around the subroutine [perl #99368]. |
| 1495 | |
| 1496 | =back |
| 1497 | |
| 1498 | =head3 L<splain> |
| 1499 | |
| 1500 | =over 4 |
| 1501 | |
| 1502 | =item * |
| 1503 | |
| 1504 | F<splain> no longer emits backtraces with the first line number repeated. |
| 1505 | |
| 1506 | This: |
| 1507 | |
| 1508 | Uncaught exception from user code: |
| 1509 | Cannot fwiddle the fwuddle at -e line 1. |
| 1510 | at -e line 1 |
| 1511 | main::baz() called at -e line 1 |
| 1512 | main::bar() called at -e line 1 |
| 1513 | main::foo() called at -e line 1 |
| 1514 | |
| 1515 | has become this: |
| 1516 | |
| 1517 | Uncaught exception from user code: |
| 1518 | Cannot fwiddle the fwuddle at -e line 1. |
| 1519 | main::baz() called at -e line 1 |
| 1520 | main::bar() called at -e line 1 |
| 1521 | main::foo() called at -e line 1 |
| 1522 | |
| 1523 | =item * |
| 1524 | |
| 1525 | Some error messages consist of multiple lines that are listed as separate |
| 1526 | entries in L<perldiag>. splain has been taught to find the separate |
| 1527 | entries in these cases, instead of simply failing to find the message. |
| 1528 | |
| 1529 | =back |
| 1530 | |
| 1531 | =head3 L<zipdetails> |
| 1532 | |
| 1533 | =over 4 |
| 1534 | |
| 1535 | =item * |
| 1536 | |
| 1537 | This is a new utility, included as part of an |
| 1538 | L<IO::Compress::Base> upgrade. |
| 1539 | |
| 1540 | L<zipdetails> displays information about the internal record structure |
| 1541 | of the zip file. It is not concerned with displaying any details of |
| 1542 | the compressed data stored in the zip file. |
| 1543 | |
| 1544 | =back |
| 1545 | |
| 1546 | =head1 Configuration and Compilation |
| 1547 | |
| 1548 | =over 4 |
| 1549 | |
| 1550 | =item * |
| 1551 | |
| 1552 | F<regexp.h> has been modified for compatibility with GCC's B<-Werror> |
| 1553 | option, as used by some projects that include perl's header files (5.14.1). |
| 1554 | |
| 1555 | =item * |
| 1556 | |
| 1557 | C<USE_LOCALE{,_COLLATE,_CTYPE,_NUMERIC}> have been added the output of perl -V |
| 1558 | as they have affect the behaviour of the interpreter binary (albeit only |
| 1559 | in a small area). |
| 1560 | |
| 1561 | =item * |
| 1562 | |
| 1563 | The code and tests for L<IPC::Open2> have been moved from F<ext/IPC-Open2> |
| 1564 | into F<ext/IPC-Open3>, as C<IPC::Open2::open2()> is implemented as a thin |
| 1565 | wrapper around C<IPC::Open3::_open3()>, and hence is very tightly coupled to |
| 1566 | it. |
| 1567 | |
| 1568 | =item * |
| 1569 | |
| 1570 | The magic types and magic vtables are now generated from data in a new script |
| 1571 | F<regen/mg_vtable.pl>, instead of being maintained by hand. As different |
| 1572 | EBCDIC variants can't agree on the code point for '~', the character to code |
| 1573 | point conversion is done at build time by F<generate_uudmap> to a new generated |
| 1574 | header F<mg_data.h>. C<PL_vtbl_bm> and C<PL_vtbl_fm> are now defined by the |
| 1575 | pre-processor as C<PL_vtbl_regexp>, instead of being distinct C variables. |
| 1576 | C<PL_vtbl_sig> has been removed. |
| 1577 | |
| 1578 | =item * |
| 1579 | |
| 1580 | Building with C<-DPERL_GLOBAL_STRUCT> works again. This configuration is not |
| 1581 | generally used. |
| 1582 | |
| 1583 | =item * |
| 1584 | |
| 1585 | Perl configured with I<MAD> now correctly frees C<MADPROP> structures when |
| 1586 | OPs are freed. C<MADPROP>s are now allocated with C<PerlMemShared_malloc()> |
| 1587 | |
| 1588 | =item * |
| 1589 | |
| 1590 | F<makedef.pl> has been refactored. This should have no noticeable affect on |
| 1591 | any of the platforms that use it as part of their build (AIX, VMS, Win32). |
| 1592 | |
| 1593 | =item * |
| 1594 | |
| 1595 | C<useperlio> can no longer be disabled. |
| 1596 | |
| 1597 | =item * |
| 1598 | |
| 1599 | The file F<global.sym> is no longer needed, and has been removed. It |
| 1600 | contained a list of all exported functions, one of the files generated by |
| 1601 | F<regen/embed.pl> from data in F<embed.fnc> and F<regen/opcodes>. The code |
| 1602 | has been refactored so that the only user of F<global.sym>, F<makedef.pl>, |
| 1603 | now reads F<embed.fnc> and F<regen/opcodes> directly, removing the need to |
| 1604 | store the list of exported functions in an intermediate file. |
| 1605 | |
| 1606 | As F<global.sym> was never installed, this change should not be visible |
| 1607 | outside the build process. |
| 1608 | |
| 1609 | =item * |
| 1610 | |
| 1611 | F<pod/buildtoc>, used by the build process to build L<perltoc>, has been |
| 1612 | refactored and simplified. It now only contains code to build L<perltoc>; |
| 1613 | the code to regenerate Makefiles has been moved to F<Porting/pod_rules.pl>. |
| 1614 | It's a bug if this change has any material effect on the build process. |
| 1615 | |
| 1616 | =item * |
| 1617 | |
| 1618 | F<pod/roffitall> is now built by F<pod/buildtoc>, instead of being |
| 1619 | shipped with the distribution. Its list of manpages is now generated |
| 1620 | (and therefore current). See also RT #103202 for an unresolved related |
| 1621 | issue. |
| 1622 | |
| 1623 | =item * |
| 1624 | |
| 1625 | The man page for C<XS::Typemap> is no longer installed. C<XS::Typemap> |
| 1626 | is a test module which is not installed, hence installing its |
| 1627 | documentation makes no sense. |
| 1628 | |
| 1629 | =item * |
| 1630 | |
| 1631 | The -Dusesitecustomize and -Duserelocatableinc options now work |
| 1632 | together properly. |
| 1633 | |
| 1634 | =back |
| 1635 | |
| 1636 | =head1 Platform Support |
| 1637 | |
| 1638 | =head2 Platform-Specific Notes |
| 1639 | |
| 1640 | =head3 Cygwin |
| 1641 | |
| 1642 | =over 4 |
| 1643 | |
| 1644 | =item * |
| 1645 | |
| 1646 | Since version 1.7, Cygwin supports native UTF-8 paths. If Perl is built |
| 1647 | under that environment, directory and filenames will be UTF-8 encoded. |
| 1648 | |
| 1649 | Cygwin does not initialize all original Win32 environment variables. See |
| 1650 | F<README.cygwin> for a discussion of the newly-added |
| 1651 | C<Cygwin::sync_winenv()> function [perl #110190] and for |
| 1652 | further links. |
| 1653 | |
| 1654 | =back |
| 1655 | |
| 1656 | =head3 HP-UX |
| 1657 | |
| 1658 | =over 4 |
| 1659 | |
| 1660 | =item * |
| 1661 | |
| 1662 | HP-UX PA-RISC/64 now supports gcc-4.x |
| 1663 | |
| 1664 | A fix to correct the socketsize now makes the test suite pass on HP-UX |
| 1665 | PA-RISC for 64bitall builds. |
| 1666 | |
| 1667 | =back |
| 1668 | |
| 1669 | =head3 VMS |
| 1670 | |
| 1671 | =over 4 |
| 1672 | |
| 1673 | =item * |
| 1674 | |
| 1675 | Remove unnecessary includes, fix miscellaneous compiler warnings and |
| 1676 | close some unclosed comments on F<vms/vms.c>. |
| 1677 | |
| 1678 | Remove sockadapt layer from the VMS build. |
| 1679 | |
| 1680 | =item * |
| 1681 | |
| 1682 | Explicit support for VMS versions prior to v7.0 and DEC C versions |
| 1683 | prior to v6.0 has been removed. |
| 1684 | |
| 1685 | =item * |
| 1686 | |
| 1687 | Since Perl 5.10.1, the home-grown C<stat> wrapper has been unable to |
| 1688 | distinguish between a directory name containing an underscore and an |
| 1689 | otherwise-identical filename containing a dot in the same position |
| 1690 | (e.g., t/test_pl as a directory and t/test.pl as a file). This problem |
| 1691 | has been corrected. |
| 1692 | |
| 1693 | =item * |
| 1694 | |
| 1695 | The build on VMS now allows names of the resulting symbols in C code for |
| 1696 | Perl longer than 31 characters. Symbols like |
| 1697 | C<Perl__it_was_the_best_of_times_it_was_the_worst_of_times> can now be |
| 1698 | created freely without causing the VMS linker to seize up. |
| 1699 | |
| 1700 | =back |
| 1701 | |
| 1702 | =head3 GNU/Hurd |
| 1703 | |
| 1704 | Numerous build and test failures on GNU/Hurd have been resolved with hints |
| 1705 | for building DBM modules, detection of the library search path, and enabling |
| 1706 | of large file support. |
| 1707 | |
| 1708 | =head3 OpenVOS |
| 1709 | |
| 1710 | Perl is now built with dynamic linking on OpenVOS, the minimum supported |
| 1711 | version of which is now Release 17.1.0. |
| 1712 | |
| 1713 | =head3 SunOS |
| 1714 | |
| 1715 | The CC workshop C++ compiler is now detected and used on systems that ship |
| 1716 | without cc. |
| 1717 | |
| 1718 | =head1 Internal Changes |
| 1719 | |
| 1720 | =over 4 |
| 1721 | |
| 1722 | =item * |
| 1723 | |
| 1724 | The compiled representation of formats is now stored via the C<mg_ptr> of |
| 1725 | their C<PERL_MAGIC_fm>. Previously it was stored in the string buffer, |
| 1726 | beyond C<SvLEN()>, the regular end of the string. C<SvCOMPILED()> and |
| 1727 | C<SvCOMPILED_{on,off}()> now exist solely for compatibility for XS code. |
| 1728 | The first is always 0, the other two now no-ops. (5.14.1) |
| 1729 | |
| 1730 | =item * |
| 1731 | |
| 1732 | Some global variables have been marked C<const>, members in the interpreter |
| 1733 | structure have been re-ordered, and the opcodes have been re-ordered. The |
| 1734 | op C<OP_AELEMFAST> has been split into C<OP_AELEMFAST> and C<OP_AELEMFAST_LEX>. |
| 1735 | |
| 1736 | =item * |
| 1737 | |
| 1738 | When empting a hash of its elements (e.g. via undef(%h), or %h=()), HvARRAY |
| 1739 | field is no longer temporarily zeroed. Any destructors called on the freed |
| 1740 | elements see the remaining elements. Thus, %h=() becomes more like |
| 1741 | C<delete $h{$_} for keys %h>. |
| 1742 | |
| 1743 | =item * |
| 1744 | |
| 1745 | Boyer-Moore compiled scalars are now PVMGs, and the Boyer-Moore tables are now |
| 1746 | stored via the mg_ptr of their C<PERL_MAGIC_bm>. |
| 1747 | Previously they were PVGVs, with the tables stored in |
| 1748 | the string buffer, beyond C<SvLEN()>. This eliminates |
| 1749 | the last place where the core stores data beyond C<SvLEN()>. |
| 1750 | |
| 1751 | =item * |
| 1752 | |
| 1753 | Simplified logic in C<Perl_sv_magic()> introduces a small change of |
| 1754 | behaviour for error cases involving unknown magic types. Previously, if |
| 1755 | C<Perl_sv_magic()> was passed a magic type unknown to it, it would |
| 1756 | |
| 1757 | =over |
| 1758 | |
| 1759 | =item 1. |
| 1760 | |
| 1761 | Croak "Modification of a read-only value attempted" if read only |
| 1762 | |
| 1763 | =item 2. |
| 1764 | |
| 1765 | Return without error if the SV happened to already have this magic |
| 1766 | |
| 1767 | =item 3. |
| 1768 | |
| 1769 | otherwise croak "Don't know how to handle magic of type \\%o" |
| 1770 | |
| 1771 | =back |
| 1772 | |
| 1773 | Now it will always croak "Don't know how to handle magic of type \\%o", even |
| 1774 | on read only values, or SVs which already have the unknown magic type. |
| 1775 | |
| 1776 | =item * |
| 1777 | |
| 1778 | The experimental C<fetch_cop_label> function has been renamed to |
| 1779 | C<cop_fetch_label>. |
| 1780 | |
| 1781 | =item * |
| 1782 | |
| 1783 | The C<cop_store_label> function has been added to the API, but is |
| 1784 | experimental. |
| 1785 | |
| 1786 | =item * |
| 1787 | |
| 1788 | F<embedvar.h> has been simplified, and one level of macro indirection for |
| 1789 | PL_* variables has been removed for the default (non-multiplicity) |
| 1790 | configuration. PERLVAR*() macros now directly expand their arguments to |
| 1791 | tokens such as C<PL_defgv>, instead of expanding to C<PL_Idefgv>, with |
| 1792 | F<embedvar.h> defining a macro to map C<PL_Idefgv> to C<PL_defgv>. XS code |
| 1793 | which has unwarranted chumminess with the implementation may need updating. |
| 1794 | |
| 1795 | =item * |
| 1796 | |
| 1797 | An API has been added to explicitly choose whether or not to export XSUB |
| 1798 | symbols. More detail can be found in the comments for commit e64345f8. |
| 1799 | |
| 1800 | =item * |
| 1801 | |
| 1802 | The C<is_gv_magical_sv> function has been eliminated and merged with |
| 1803 | C<gv_fetchpvn_flags>. It used to be called to determine whether a GV |
| 1804 | should be autovivified in rvalue context. Now it has been replaced with a |
| 1805 | new C<GV_ADDMG> flag (not part of the API). |
| 1806 | |
| 1807 | =item * |
| 1808 | |
| 1809 | Padlists are now marked C<AvREAL>; i.e., reference-counted. They have |
| 1810 | always been reference-counted, but were not marked real, because F<pad.c> |
| 1811 | did its own clean-up, instead of using the usual clean-up code in F<sv.c>. |
| 1812 | That caused problems in thread cloning, so now the C<AvREAL> flag is on, |
| 1813 | but is turned off in F<pad.c> right before the padlist is freed (after |
| 1814 | F<pad.c> has done its custom freeing of the pads). |
| 1815 | |
| 1816 | =item * |
| 1817 | |
| 1818 | All the C files that make up the Perl core have been converted to UTF-8. |
| 1819 | |
| 1820 | =item * |
| 1821 | |
| 1822 | These new functions have been added as part of the work on Unicode symbols: |
| 1823 | |
| 1824 | HvNAMELEN |
| 1825 | HvNAMEUTF8 |
| 1826 | HvENAMELEN |
| 1827 | HvENAMEUTF8 |
| 1828 | gv_init_pv |
| 1829 | gv_init_pvn |
| 1830 | gv_init_pvsv |
| 1831 | gv_fetchmeth_pv |
| 1832 | gv_fetchmeth_pvn |
| 1833 | gv_fetchmeth_sv |
| 1834 | gv_fetchmeth_pv_autoload |
| 1835 | gv_fetchmeth_pvn_autoload |
| 1836 | gv_fetchmeth_sv_autoload |
| 1837 | gv_fetchmethod_pv_flags |
| 1838 | gv_fetchmethod_pvn_flags |
| 1839 | gv_fetchmethod_sv_flags |
| 1840 | gv_autoload_pv |
| 1841 | gv_autoload_pvn |
| 1842 | gv_autoload_sv |
| 1843 | newGVgen_flags |
| 1844 | sv_derived_from_pv |
| 1845 | sv_derived_from_pvn |
| 1846 | sv_derived_from_sv |
| 1847 | sv_does_pv |
| 1848 | sv_does_pvn |
| 1849 | sv_does_sv |
| 1850 | whichsig_pv |
| 1851 | whichsig_pvn |
| 1852 | whichsig_sv |
| 1853 | newCONSTSUB_flags |
| 1854 | |
| 1855 | The gv_fetchmethod_*_flags functions, like gv_fetchmethod_flags, are |
| 1856 | experimental and may change in a future release. |
| 1857 | |
| 1858 | =item * |
| 1859 | |
| 1860 | The following functions were added. These are I<not> part of the API: |
| 1861 | |
| 1862 | GvNAMEUTF8 |
| 1863 | GvENAMELEN |
| 1864 | GvENAME_HEK |
| 1865 | CopSTASH_flags |
| 1866 | CopSTASH_flags_set |
| 1867 | PmopSTASH_flags |
| 1868 | PmopSTASH_flags_set |
| 1869 | sv_sethek |
| 1870 | HEKfARG |
| 1871 | |
| 1872 | There is also a C<HEKf> macro corresponding to C<SVf>, for |
| 1873 | interpolating HEKs in formatted strings. |
| 1874 | |
| 1875 | =item * |
| 1876 | |
| 1877 | C<sv_catpvn_flags> takes a couple of new internal-only flags, |
| 1878 | C<SV_CATBYTES> and C<SV_CATUTF8>, which tell it whether the char array to |
| 1879 | be concatenated is UTF8. This allows for more efficient concatenation than |
| 1880 | creating temporary SVs to pass to C<sv_catsv>. |
| 1881 | |
| 1882 | =item * |
| 1883 | |
| 1884 | For XS AUTOLOAD subs, $AUTOLOAD is set once more, as it was in 5.6.0. This |
| 1885 | is in addition to setting C<SvPVX(cv)>, for compatibility with 5.8 to 5.14. |
| 1886 | See L<perlguts/Autoloading with XSUBs>. |
| 1887 | |
| 1888 | =item * |
| 1889 | |
| 1890 | Perl now checks whether the array (the linearised isa) returned by a MRO |
| 1891 | plugin begins with the name of the class itself, for which the array was |
| 1892 | created, instead of assuming that it does. This prevents the first element |
| 1893 | from being skipped during method lookup. It also means that |
| 1894 | C<mro::get_linear_isa> may return an array with one more element than the |
| 1895 | MRO plugin provided [perl #94306]. |
| 1896 | |
| 1897 | =item * |
| 1898 | |
| 1899 | C<PL_curstash> is now reference-counted. |
| 1900 | |
| 1901 | =item * |
| 1902 | |
| 1903 | There are now feature bundle hints in C<PL_hints> (C<$^H>) that version |
| 1904 | declarations use, to avoid having to load F<feature.pm>. One setting of |
| 1905 | the hint bits indicates a "custom" feature bundle, which means that the |
| 1906 | entries in C<%^H> still apply. F<feature.pm> uses that. |
| 1907 | |
| 1908 | The C<HINT_FEATURE_MASK> macro is defined in F<perl.h> along with other |
| 1909 | hints. Other macros for setting and testing features and bundles are in |
| 1910 | the new F<feature.h>. C<FEATURE_IS_ENABLED> (which has moved to |
| 1911 | F<feature.h>) is no longer used throughout the codebase, but more specific |
| 1912 | macros, e.g., C<FEATURE_SAY_IS_ENABLED>, that are defined in F<feature.h>. |
| 1913 | |
| 1914 | =item * |
| 1915 | |
| 1916 | F<lib/feature.pm> is now a generated file, created by the new |
| 1917 | F<regen/feature.pl> script, which also generates F<feature.h>. |
| 1918 | |
| 1919 | =item * |
| 1920 | |
| 1921 | Tied arrays are now always C<AvREAL>. If C<@_> or C<DB::args> is tied, it |
| 1922 | is reified first, to make sure this is always the case. |
| 1923 | |
| 1924 | =item * |
| 1925 | |
| 1926 | Two new functions C<utf8_to_uvchr_buf()> and C<utf8_to_uvuni_buf()> have |
| 1927 | been added. These are the same as C<utf8_to_uvchr> and |
| 1928 | C<utf8_to_uvuni> (which are now deprecated), but take an extra parameter |
| 1929 | that is used to guard against reading beyond the end of the input |
| 1930 | string. |
| 1931 | See L<perlapi/utf8_to_uvchr_buf> and L<perlapi/utf8_to_uvuni_buf>. |
| 1932 | |
| 1933 | =item * |
| 1934 | |
| 1935 | The regular expression engine now does TRIE case insensitive matches |
| 1936 | under Unicode. This may change the output of C<< use re 'debug'; >>, |
| 1937 | and will speed up various things. |
| 1938 | |
| 1939 | =item * |
| 1940 | |
| 1941 | There is a new C<wrap_op_checker()> function, which provides a thread-safe |
| 1942 | alternative to writing to C<PL_check> directly. |
| 1943 | |
| 1944 | =back |
| 1945 | |
| 1946 | =head1 Selected Bug Fixes |
| 1947 | |
| 1948 | =head2 Array and hash |
| 1949 | |
| 1950 | =over |
| 1951 | |
| 1952 | =item * |
| 1953 | |
| 1954 | A bug has been fixed that would cause a "Use of freed value in iteration" |
| 1955 | error if the next two hash elements that would be iterated over are |
| 1956 | deleted [perl #85026]. (5.14.1) |
| 1957 | |
| 1958 | =item * |
| 1959 | |
| 1960 | Deleting the current hash iterator (the hash element that would be returend |
| 1961 | by the next call to C<each>) in void context used not to free it |
| 1962 | [perl #85026]. |
| 1963 | |
| 1964 | =item * |
| 1965 | |
| 1966 | Deletion of methods via C<delete $Class::{method}> syntax used to update |
| 1967 | method caches if called in void context, but not scalar or list context. |
| 1968 | |
| 1969 | =item * |
| 1970 | |
| 1971 | When hash elements are deleted in void context, the internal hash entry is |
| 1972 | now freed before the value is freed, to prevent destructors called by that |
| 1973 | latter freeing from seeing the hash in an inconsistent state. It was |
| 1974 | possible to cause double-frees if the destructor freed the hash itself |
| 1975 | [perl #100340]. |
| 1976 | |
| 1977 | =item * |
| 1978 | |
| 1979 | A C<keys> optimisation in Perl 5.12.0 to make it faster on empty hashes |
| 1980 | caused C<each> not to reset the iterator if called after the last element |
| 1981 | was deleted. |
| 1982 | |
| 1983 | =item * |
| 1984 | |
| 1985 | Freeing deeply nested hashes no longer crashes [perl #44225]. |
| 1986 | |
| 1987 | =item * |
| 1988 | |
| 1989 | It is possible from XS code to create hashes with elements that have no |
| 1990 | values. The hash element and slice operators used to crash |
| 1991 | when handling these in lvalue context. They now |
| 1992 | produce a "Modification of non-creatable hash value attempted" error |
| 1993 | message. |
| 1994 | |
| 1995 | =item * |
| 1996 | |
| 1997 | If list assignment to a hash or array triggered destructors that freed the |
| 1998 | hash or array itself, a crash would ensue. This is no longer the case |
| 1999 | [perl #107440]. |
| 2000 | |
| 2001 | =item * |
| 2002 | |
| 2003 | It used to be possible to free the typeglob of a localised array or hash |
| 2004 | (e.g., C<local @{"x"}; delete $::{x}>), resulting in a crash on scope exit. |
| 2005 | |
| 2006 | =item * |
| 2007 | |
| 2008 | Some core bugs affecting L<Hash::Util> have been fixed: locking a hash |
| 2009 | element that is a glob copy no longer causes subsequent assignment to it to |
| 2010 | corrupt the glob, and unlocking a hash element that holds a copy-on-write |
| 2011 | scalar no longer causes modifications to that scalar to modify other |
| 2012 | scalars that were sharing the same string buffer. |
| 2013 | |
| 2014 | =back |
| 2015 | |
| 2016 | =head2 C API fixes |
| 2017 | |
| 2018 | =over |
| 2019 | |
| 2020 | =item * |
| 2021 | |
| 2022 | The C<newHVhv> XS function now works on tied hashes, instead of crashing or |
| 2023 | returning an empty hash. |
| 2024 | |
| 2025 | =item * |
| 2026 | |
| 2027 | The C<SvIsCOW> C macro now returns false for read-only copies of typeglobs, |
| 2028 | such as those created by: |
| 2029 | |
| 2030 | $hash{elem} = *foo; |
| 2031 | Hash::Util::lock_value %hash, 'elem'; |
| 2032 | |
| 2033 | It used to return true. |
| 2034 | |
| 2035 | =item * |
| 2036 | |
| 2037 | The C<SvPVutf8> C function no longer tries to modify its argument, |
| 2038 | resulting in errors [perl #108994]. |
| 2039 | |
| 2040 | =item * |
| 2041 | |
| 2042 | C<SvPVutf8> now works properly with magical variables. |
| 2043 | |
| 2044 | =item * |
| 2045 | |
| 2046 | C<SvPVbyte> now works properly non-PVs. |
| 2047 | |
| 2048 | =item * |
| 2049 | |
| 2050 | When presented with malformed UTF-8 input, the XS-callable functions |
| 2051 | C<is_utf8_string()>, C<is_utf8_string_loc()>, and |
| 2052 | C<is_utf8_string_loclen()> could read beyond the end of the input |
| 2053 | string by up to 12 bytes. This no longer happens. [perl #32080]. |
| 2054 | However, currently, C<is_utf8_char()> still has this defect, see |
| 2055 | L</is_utf8_char()> above. |
| 2056 | |
| 2057 | =item * |
| 2058 | |
| 2059 | The C-level C<pregcomp> function could become confused as to whether the |
| 2060 | pattern was in UTF8 if the pattern was an overloaded, tied, or otherwise |
| 2061 | magical scalar [perl #101940]. |
| 2062 | |
| 2063 | =back |
| 2064 | |
| 2065 | =head2 Compile-time hints |
| 2066 | |
| 2067 | =over |
| 2068 | |
| 2069 | =item * |
| 2070 | |
| 2071 | Tying C<%^H> no longer causes perl to crash or ignore the contents of |
| 2072 | C<%^H> when entering a compilation scope [perl #106282]. |
| 2073 | |
| 2074 | =item * |
| 2075 | |
| 2076 | C<eval $string> and C<require> used not to |
| 2077 | localise C<%^H> during compilation if it |
| 2078 | was empty at the time the C<eval> call itself was compiled. This could |
| 2079 | lead to scary side effects, like C<use re "/m"> enabling other flags that |
| 2080 | the surrounding code was trying to enable for its caller [perl #68750]. |
| 2081 | |
| 2082 | =item * |
| 2083 | |
| 2084 | C<eval $string> and C<require> no longer localise hints (C<$^H> and C<%^H>) |
| 2085 | at run time, but only during compilation of the $string or required file. |
| 2086 | This makes C<BEGIN { $^H{foo}=7 }> equivalent to |
| 2087 | C<BEGIN { eval '$^H{foo}=7' }> [perl #70151]. |
| 2088 | |
| 2089 | =item * |
| 2090 | |
| 2091 | Creating a BEGIN block from XS code (via C<newXS> or C<newATTRSUB>) would, |
| 2092 | on completion, make the hints of the current compiling code the current |
| 2093 | hints. This could cause warnings to occur in a non-warning scope. |
| 2094 | |
| 2095 | =back |
| 2096 | |
| 2097 | =head2 Copy-on-write scalars |
| 2098 | |
| 2099 | Copy-on-write or shared hash key scalars |
| 2100 | were introduced in 5.8.0, but most Perl code |
| 2101 | did not encounter them (they were used mostly internally). Perl |
| 2102 | 5.10.0 extended them, such that assigning C<__PACKAGE__> or a |
| 2103 | hash key to a scalar would make it copy-on-write. Several parts |
| 2104 | of Perl were not updated to account for them, but have now been fixed. |
| 2105 | |
| 2106 | =over |
| 2107 | |
| 2108 | =item * |
| 2109 | |
| 2110 | C<utf8::decode> had a nasty bug that would modify copy-on-write scalars' |
| 2111 | string buffers in place (i.e., skipping the copy). This could result in |
| 2112 | hashes having two elements with the same key [perl #91834]. |
| 2113 | |
| 2114 | =item * |
| 2115 | |
| 2116 | Lvalue subroutines were not allowing COW scalars to be returned. This was |
| 2117 | fixed for lvalue scalar context in Perl 5.12.3 and 5.14.0, but list context |
| 2118 | was not fixed until this release. |
| 2119 | |
| 2120 | =item * |
| 2121 | |
| 2122 | Elements of restricted hashes (see the L<fields> pragma) containing |
| 2123 | copy-on-write values couldn't be deleted, nor could such hashes be cleared |
| 2124 | (C<%hash = ()>). |
| 2125 | |
| 2126 | =item * |
| 2127 | |
| 2128 | Localising a tied variable used to make it read-only if it contained a |
| 2129 | copy-on-write string. |
| 2130 | |
| 2131 | =item * |
| 2132 | |
| 2133 | Assigning a copy-on-write string to a stash |
| 2134 | element no longer causes a double free. Regardless of this change, the |
| 2135 | results of such assignments are still undefined. |
| 2136 | |
| 2137 | =item * |
| 2138 | |
| 2139 | Assigning a copy-on-write string to a tied variable no longer stops that |
| 2140 | variable from being tied if it happens to be a PVMG or PVLV internally. |
| 2141 | |
| 2142 | =item * |
| 2143 | |
| 2144 | Doing a substitution on a tied variable returning a copy-on-write |
| 2145 | scalar used to cause an assertion failure or an "Attempt to free |
| 2146 | nonexistent shared string" warning. |
| 2147 | |
| 2148 | =item * |
| 2149 | |
| 2150 | This one is a regression from 5.12: In 5.14.0, the bitwise assignment |
| 2151 | operators C<|=>, C<^=> and C<&=> started leaving the left-hand side |
| 2152 | undefined if it happened to be a copy-on-write string [perl #108480]. |
| 2153 | |
| 2154 | =item * |
| 2155 | |
| 2156 | L<Storable>, L<Devel::Peek> and L<PerlIO::scalar> had similar problems. |
| 2157 | See L</Updated Modules and Pragmata>, above. |
| 2158 | |
| 2159 | =back |
| 2160 | |
| 2161 | =head2 The debugger |
| 2162 | |
| 2163 | =over |
| 2164 | |
| 2165 | =item * |
| 2166 | |
| 2167 | F<dumpvar.pl>, and consequently the C<x> command in the debugger, have been |
| 2168 | fixed to handle objects blessed into classes whose names contain "=". The |
| 2169 | contents of such objects used not to be dumped [perl #101814]. |
| 2170 | |
| 2171 | =item * |
| 2172 | |
| 2173 | The "R" command for restarting a debugger session has been fixed to work on |
| 2174 | Windows, or any other system lacking a C<POSIX::_SC_OPEN_MAX> constant |
| 2175 | [perl #87740]. |
| 2176 | |
| 2177 | =item * |
| 2178 | |
| 2179 | The C<#line 42 foo> directive used not to update the arrays of lines used |
| 2180 | by the debugger if it occurred in a string eval. This was partially fixed |
| 2181 | in 5.14, but it only worked for a single C<#line 42 foo> in each eval. Now |
| 2182 | it works for multiple. |
| 2183 | |
| 2184 | =item * |
| 2185 | |
| 2186 | When subroutine calls are intercepted by the debugger, the name of the |
| 2187 | subroutine or a reference to it is stored in C<$DB::sub>, for the debugger |
| 2188 | to access. In some cases (such as C<$foo = *bar; undef *bar; &$foo>) |
| 2189 | C<$DB::sub> would be set to a name that could not be used to find the |
| 2190 | subroutine, and so the debugger's attempt to call it would fail. Now the |
| 2191 | check to see whether a reference is needed is more robust, so those |
| 2192 | problems should not happen anymore [rt.cpan.org #69862]. |
| 2193 | |
| 2194 | =item * |
| 2195 | |
| 2196 | Every subroutine has a filename associated with it that the debugger uses. |
| 2197 | The one associated with constant subroutines used to be misallocated when |
| 2198 | cloned under threads. Consequently, debugging threaded applications could |
| 2199 | result in memory corruption [perl #96126]. |
| 2200 | |
| 2201 | =back |
| 2202 | |
| 2203 | =head2 Dereferencing operators |
| 2204 | |
| 2205 | =over |
| 2206 | |
| 2207 | =item * |
| 2208 | |
| 2209 | C<defined(${"..."})>, C<defined(*{"..."})>, etc., used to |
| 2210 | return true for most, but not all built-in variables, if |
| 2211 | they had not been used yet. This bug affected C<${^GLOBAL_PHASE}> and |
| 2212 | C<${^UTF8CACHE}>, among others. It also used to return false if the |
| 2213 | package name was given as well (C<${"::!"}>) [perl #97978, #97492]. |
| 2214 | |
| 2215 | =item * |
| 2216 | |
| 2217 | Perl 5.10.0 introduced a similar bug: C<defined(*{"foo"})> where "foo" |
| 2218 | represents the name of a built-in global variable used to return false if |
| 2219 | the variable had never been used before, but only on the I<first> call. |
| 2220 | This, too, has been fixed. |
| 2221 | |
| 2222 | =item * |
| 2223 | |
| 2224 | Since 5.6.0, C<*{ ... }> has been inconsistent in how it treats undefined |
| 2225 | values. It would die in strict mode or lvalue context for most undefined |
| 2226 | values, but would be treated as the empty string (with a warning) for the |
| 2227 | specific scalar return by C<undef()> (C<&PL_sv_undef> internally). This |
| 2228 | has been corrected. C<undef()> is now treated like other undefined |
| 2229 | scalars, as in Perl 5.005. |
| 2230 | |
| 2231 | =back |
| 2232 | |
| 2233 | =head2 Filehandle, last-accessed |
| 2234 | |
| 2235 | Perl has an internal variable that stores the last filehandle to be |
| 2236 | accessed. It is used by C<$.> and by C<tell> and C<eof> without |
| 2237 | arguments. |
| 2238 | |
| 2239 | =over |
| 2240 | |
| 2241 | =item * |
| 2242 | |
| 2243 | It used to be possible to set this internal variable to a glob copy and |
| 2244 | then modify that glob copy to be something other than a glob, and still |
| 2245 | have the last-accessed filehandle associated with the variable after |
| 2246 | assigning a glob to it again: |
| 2247 | |
| 2248 | my $foo = *STDOUT; # $foo is a glob copy |
| 2249 | <$foo>; # $foo is now the last-accessed handle |
| 2250 | $foo = 3; # no longer a glob |
| 2251 | $foo = *STDERR; # still the last-accessed handle |
| 2252 | |
| 2253 | Now the C<$foo = 3> assignment unsets that internal variable, so there |
| 2254 | is no last-accessed filehandle, just as if C<< <$foo> >> had never |
| 2255 | happened. |
| 2256 | |
| 2257 | This also prevents some unrelated handle from becoming the last-accessed |
| 2258 | handle if $foo falls out of scope and the same internal SV gets used for |
| 2259 | another handle [perl #97988]. |
| 2260 | |
| 2261 | =item * |
| 2262 | |
| 2263 | A regression in 5.14 caused these statements not to set that internal |
| 2264 | variable: |
| 2265 | |
| 2266 | my $fh = *STDOUT; |
| 2267 | tell $fh; |
| 2268 | eof $fh; |
| 2269 | seek $fh, 0,0; |
| 2270 | tell *$fh; |
| 2271 | eof *$fh; |
| 2272 | seek *$fh, 0,0; |
| 2273 | readline *$fh; |
| 2274 | |
| 2275 | This is now fixed, but C<tell *{ *$fh }> still has the problem, and it |
| 2276 | is not clear how to fix it [perl #106536]. |
| 2277 | |
| 2278 | =back |
| 2279 | |
| 2280 | =head2 Filetests and C<stat> |
| 2281 | |
| 2282 | The term "filetests" refers to the operators that consist of a hyphen |
| 2283 | followed by a single letter: C<-r>, C<-x>, C<-M>, etc. The term "stacked" |
| 2284 | when applied to filetests means followed by another filetest operator |
| 2285 | sharing the same operand, as in C<-r -x -w $fooo>. |
| 2286 | |
| 2287 | =over |
| 2288 | |
| 2289 | =item * |
| 2290 | |
| 2291 | C<stat> produces more consistent warnings. It no longer warns for "_" |
| 2292 | [perl #71002] and no longer skips the warning at times for other unopened |
| 2293 | handles. It no longer warns about an unopened handle when the operating |
| 2294 | system's C<fstat> function fails. |
| 2295 | |
| 2296 | =item * |
| 2297 | |
| 2298 | C<stat> would sometimes return negative numbers for large inode numbers, |
| 2299 | because it was using the wrong internal C type. [perl #84590] |
| 2300 | |
| 2301 | =item * |
| 2302 | |
| 2303 | C<lstat> is documented to fall back to C<stat> (with a warning) when given |
| 2304 | a filehandle. When passed an IO reference, it was actually doing the |
| 2305 | equivalent of S<C<stat _>> and ignoring the handle. |
| 2306 | |
| 2307 | =item * |
| 2308 | |
| 2309 | C<-T _> with no preceding C<stat> used to produce a |
| 2310 | confusing "uninitialized" warning, even though there |
| 2311 | is no visible uninitialized value to speak of. |
| 2312 | |
| 2313 | =item * |
| 2314 | |
| 2315 | C<-T>, C<-B>, C<-l> and C<-t> now work |
| 2316 | when stacked with other filetest operators |
| 2317 | [perl #77388]. |
| 2318 | |
| 2319 | =item * |
| 2320 | |
| 2321 | In 5.14.0, filetest ops (C<-r>, C<-x>, etc.) started calling FETCH on a |
| 2322 | tied argument belonging to the previous argument to a list operator, if |
| 2323 | called with a bareword argument or no argument at all. This has been |
| 2324 | fixed, so C<push @foo, $tied, -r> no longer calls FETCH on C<$tied>. |
| 2325 | |
| 2326 | =item * |
| 2327 | |
| 2328 | In Perl 5.6, C<-l> followed by anything other than a bareword would treat |
| 2329 | its argument as a file name. That was changed in 5.8 for glob references |
| 2330 | (C<\*foo>), but not for globs themselves (C<*foo>). C<-l> started |
| 2331 | returning C<undef> for glob references without setting the last |
| 2332 | stat buffer that the "_" handle uses, but only if warnings |
| 2333 | were turned on. With warnings off, it was the same as 5.6. |
| 2334 | In other words, it was simply buggy and inconsistent. Now the 5.6 |
| 2335 | behaviour has been restored. |
| 2336 | |
| 2337 | =item * |
| 2338 | |
| 2339 | C<-l> followed by a bareword no longer "eats" the previous argument to |
| 2340 | the list operator in whose argument list it resides. Hence, |
| 2341 | C<print "bar", -l foo> now actually prints "bar", because C<-l> |
| 2342 | on longer eats it. |
| 2343 | |
| 2344 | =item * |
| 2345 | |
| 2346 | Perl keeps several internal variables to keep track of the last stat |
| 2347 | buffer, from which file(handle) it originated, what type it was, and |
| 2348 | whether the last stat succeeded. |
| 2349 | |
| 2350 | There were various cases where these could get out of synch, resulting in |
| 2351 | inconsistent or erratic behaviour in edge cases (every mention of C<-T> |
| 2352 | applies to C<-B> as well): |
| 2353 | |
| 2354 | =over |
| 2355 | |
| 2356 | =item * |
| 2357 | |
| 2358 | C<-T I<HANDLE>>, even though it does a C<stat>, was not resetting the last |
| 2359 | stat type, so an C<lstat _> following it would merrily return the wrong |
| 2360 | results. Also, it was not setting the success status. |
| 2361 | |
| 2362 | =item * |
| 2363 | |
| 2364 | Freeing the handle last used by C<stat> or a filetest could result in |
| 2365 | S<C<-T _>> using an unrelated handle. |
| 2366 | |
| 2367 | =item * |
| 2368 | |
| 2369 | C<stat> with an IO reference would not reset the stat type or record the |
| 2370 | filehandle for S<C<-T _>> to use. |
| 2371 | |
| 2372 | =item * |
| 2373 | |
| 2374 | Fatal warnings could cause the stat buffer not to be reset |
| 2375 | for a filetest operator on an unopened filehandle or C<-l> on any handle. |
| 2376 | Fatal warnings also stopped C<-T> from setting C<$!>. |
| 2377 | |
| 2378 | =item * |
| 2379 | |
| 2380 | When the last stat was on an unreadable file, C<-T _> is supposed to |
| 2381 | return C<undef>, leaving the last stat buffer unchanged. But it was |
| 2382 | setting the stat type, causing C<lstat _> to stop working. |
| 2383 | |
| 2384 | =item * |
| 2385 | |
| 2386 | C<-T I<FILENAME>> was not resetting the internal stat buffers for |
| 2387 | unreadable files. |
| 2388 | |
| 2389 | =back |
| 2390 | |
| 2391 | These have all been fixed. |
| 2392 | |
| 2393 | =back |
| 2394 | |
| 2395 | =head2 Formats |
| 2396 | |
| 2397 | =over |
| 2398 | |
| 2399 | =item * |
| 2400 | |
| 2401 | A number of edge cases have been fixed with formats and C<formline>; |
| 2402 | in particular, where the format itself is potentially variable (such as |
| 2403 | with ties and overloading), and where the format and data differ in their |
| 2404 | encoding. In both these cases, it used to possible for the output to be |
| 2405 | corrupted [perl #91032]. |
| 2406 | |
| 2407 | =item * |
| 2408 | |
| 2409 | C<formline> no longer converts its argument into a string in-place. So |
| 2410 | passing a reference to C<formline> no longer destroys the reference |
| 2411 | [perl #79532]. |
| 2412 | |
| 2413 | =item * |
| 2414 | |
| 2415 | Assignment to C<$^A> (the format output accumulator) now recalculates |
| 2416 | the number of lines output. |
| 2417 | |
| 2418 | =back |
| 2419 | |
| 2420 | =head2 C<given> and C<when> |
| 2421 | |
| 2422 | =over |
| 2423 | |
| 2424 | =item * |
| 2425 | |
| 2426 | C<given> was not scoping its implicit $_ properly, resulting in memory |
| 2427 | leaks or "Variable is not available" warnings [perl #94682]. |
| 2428 | |
| 2429 | =item * |
| 2430 | |
| 2431 | C<given> was not calling set-magic on the implicit lexical C<$_> that it |
| 2432 | uses. This meant, for example, that C<pos> would be remembered from one |
| 2433 | execution of the same C<given> block to the next, even if the input were a |
| 2434 | different variable [perl #84526]. |
| 2435 | |
| 2436 | =item * |
| 2437 | |
| 2438 | C<when> blocks are now capable of returning variables declared inside the |
| 2439 | enclosing C<given> block [perl #93548]. |
| 2440 | |
| 2441 | =back |
| 2442 | |
| 2443 | =head2 The C<glob> operator |
| 2444 | |
| 2445 | =over |
| 2446 | |
| 2447 | =item * |
| 2448 | |
| 2449 | On OSes other than VMS, Perl's C<glob> operator (and the C<< <...> >> form) |
| 2450 | use L<File::Glob> underneath. L<File::Glob> splits the pattern into words, |
| 2451 | before feeding each word to its C<bsd_glob> function. |
| 2452 | |
| 2453 | There were several inconsistencies in the way the split was done. Now |
| 2454 | quotation marks (' and ") are always treated as shell-style word delimiters |
| 2455 | (that allow whitespace as part of a word) and backslashes are always |
| 2456 | preserved, unless they exist to escape quotation marks. Before, those |
| 2457 | would only sometimes be the case, depending on whether the pattern |
| 2458 | contained whitespace. Also, escaped whitespace at the end of the pattern |
| 2459 | is no longer stripped [perl #40470]. |
| 2460 | |
| 2461 | =item * |
| 2462 | |
| 2463 | C<CORE::glob> now works as a way to call the default globbing function. It |
| 2464 | used to respect overrides, despite the C<CORE::> prefix. |
| 2465 | |
| 2466 | =item * |
| 2467 | |
| 2468 | Under miniperl (used to configure modules when perl itself is built), |
| 2469 | C<glob> now clears %ENV before calling csh, since the latter croaks on some |
| 2470 | systems if it does not like the contents of the LS_COLORS enviroment |
| 2471 | variable [perl #98662]. |
| 2472 | |
| 2473 | =back |
| 2474 | |
| 2475 | =head2 Lvalue subroutines |
| 2476 | |
| 2477 | =over |
| 2478 | |
| 2479 | =item * |
| 2480 | |
| 2481 | Explicit return now returns the actual argument passed to return, instead |
| 2482 | of copying it [perl #72724, #72706]. |
| 2483 | |
| 2484 | =item * |
| 2485 | |
| 2486 | Lvalue subroutines used to enforce lvalue syntax (i.e., whatever can go on |
| 2487 | the left-hand side of C<=>) for the last statement and the arguments to |
| 2488 | return. Since lvalue subroutines are not always called in lvalue context, |
| 2489 | this restriction has been lifted. |
| 2490 | |
| 2491 | =item * |
| 2492 | |
| 2493 | Lvalue subroutines are less restrictive as to what values can be returned. |
| 2494 | It used to croak on values returned by C<shift> and C<delete> and from |
| 2495 | other subroutines, but no longer does so [perl #71172]. |
| 2496 | |
| 2497 | =item * |
| 2498 | |
| 2499 | Empty lvalue subroutines (C<sub :lvalue {}>) used to return C<@_> in list |
| 2500 | context. In fact, all subroutines used to, but regular subs were fixed in |
| 2501 | Perl 5.8.2. Now lvalue subroutines have been likewise fixed. |
| 2502 | |
| 2503 | =item * |
| 2504 | |
| 2505 | Autovivification now works on values returned from lvalue subroutines |
| 2506 | [perl #7946], as does returning C<keys> in lvalue context. |
| 2507 | |
| 2508 | =item * |
| 2509 | |
| 2510 | Lvalue subroutines used to copy their return values in rvalue context. Not |
| 2511 | only was this a waste of CPU cycles, but it also caused bugs. A C<($)> |
| 2512 | prototype would cause an lvalue sub to copy its return value [perl #51408], |
| 2513 | and C<while(lvalue_sub() =~ m/.../g) { ... }> would loop endlessly |
| 2514 | [perl #78680]. |
| 2515 | |
| 2516 | =item * |
| 2517 | |
| 2518 | When called in potential lvalue context |
| 2519 | (e.g., subroutine arguments or a list |
| 2520 | passed to C<for>), lvalue subroutines used to copy |
| 2521 | any read-only value that was returned. E.g., C< sub :lvalue { $] } > |
| 2522 | would not return C<$]>, but a copy of it. |
| 2523 | |
| 2524 | =item * |
| 2525 | |
| 2526 | When called in potential lvalue context, an lvalue subroutine returning |
| 2527 | arrays or hashes used to bind the arrays or hashes to scalar variables, |
| 2528 | resulting in bugs. This was fixed in 5.14.0 if an array were the first |
| 2529 | thing returned from the subroutine (but not for C<$scalar, @array> or |
| 2530 | hashes being returned). Now a more general fix has been applied |
| 2531 | [perl #23790]. |
| 2532 | |
| 2533 | =item * |
| 2534 | |
| 2535 | Method calls whose arguments were all surrounded with C<my()> or C<our()> |
| 2536 | (as in C<< $object->method(my($a,$b)) >>) used to force lvalue context on |
| 2537 | the subroutine. This would prevent lvalue methods from returning certain |
| 2538 | values. |
| 2539 | |
| 2540 | =item * |
| 2541 | |
| 2542 | Lvalue sub calls that are not determined to be such at compile time |
| 2543 | (C<&$name> or &{"name"}) are no longer exempt from strict refs if they |
| 2544 | occur in the last statement of an lvalue subroutine [perl #102486]. |
| 2545 | |
| 2546 | =item * |
| 2547 | |
| 2548 | Sub calls whose subs are not visible at compile time, if |
| 2549 | they occurred in the last statement of an lvalue subroutine, |
| 2550 | would reject non-lvalue subroutines and die with "Can't modify non-lvalue |
| 2551 | subroutine call" [perl #102486]. |
| 2552 | |
| 2553 | Non-lvalue sub calls whose subs I<are> visible at compile time exhibited |
| 2554 | the opposite bug. If the call occurred in the last statement of an lvalue |
| 2555 | subroutine, there would be no error when the lvalue sub was called in |
| 2556 | lvalue context. Perl would blindly assign to the temporary value returned |
| 2557 | by the non-lvalue subroutine. |
| 2558 | |
| 2559 | =item * |
| 2560 | |
| 2561 | C<AUTOLOAD> routines used to take precedence over the actual sub being |
| 2562 | called (i.e., when autoloading wasn't needed), for sub calls in lvalue or |
| 2563 | potential lvalue context, if the subroutine was not visible at compile |
| 2564 | time. |
| 2565 | |
| 2566 | =item * |
| 2567 | |
| 2568 | Applying the C<:lvalue> attribute to an XSUB or to an aliased subroutine |
| 2569 | stub with C<< sub foo :lvalue; >> syntax stopped working in Perl 5.12. |
| 2570 | This has been fixed. |
| 2571 | |
| 2572 | =item * |
| 2573 | |
| 2574 | Applying the :lvalue attribute to subroutine that is already defined does |
| 2575 | not work properly, as the attribute changes the way the sub is compiled. |
| 2576 | Hence, Perl 5.12 began warning when an attempt is made to apply the |
| 2577 | attribute to an already defined sub. In such cases, the attribute is |
| 2578 | discarded. |
| 2579 | |
| 2580 | But the change in 5.12 missed the case where custom attributes are also |
| 2581 | present: that case still silently and ineffectively applied the attribute. |
| 2582 | That omission has now been corrected. C<sub foo :lvalue :Whatever> (when |
| 2583 | C<foo> is already defined) now warns about the :lvalue attribute, and does |
| 2584 | not apply it. |
| 2585 | |
| 2586 | =item * |
| 2587 | |
| 2588 | A bug affecting lvalue context propagation through nested lvalue subroutine |
| 2589 | calls has been fixed. Previously, returning a value in nested rvalue |
| 2590 | context would be treated as lvalue context by the inner subroutine call, |
| 2591 | resulting in some values (such as read-only values) being rejected. |
| 2592 | |
| 2593 | =back |
| 2594 | |
| 2595 | =head2 Overloading |
| 2596 | |
| 2597 | =over |
| 2598 | |
| 2599 | =item * |
| 2600 | |
| 2601 | Arithmetic assignment (C<$left += $right>) involving overloaded objects |
| 2602 | that rely on the 'nomethod' override no longer segfault when the left |
| 2603 | operand is not overloaded. |
| 2604 | |
| 2605 | =item * |
| 2606 | |
| 2607 | Errors that occur when methods cannot be found during overloading now |
| 2608 | mention the correct package name, as they did in 5.8.x, instead of |
| 2609 | erroneously mentioning the "overload" package, as they have since 5.10.0. |
| 2610 | |
| 2611 | =item * |
| 2612 | |
| 2613 | Undefining C<%overload::> no longer causes a crash. |
| 2614 | |
| 2615 | =back |
| 2616 | |
| 2617 | =head2 Prototypes of built-in keywords |
| 2618 | |
| 2619 | =over |
| 2620 | |
| 2621 | =item * |
| 2622 | |
| 2623 | The C<prototype> function no longer dies for the C<__FILE__>, C<__LINE__> |
| 2624 | and C<__PACKAGE__> directives. It now returns an empty-string prototype |
| 2625 | for them, because they are syntactically indistinguishable from nullary |
| 2626 | functions like C<time>. |
| 2627 | |
| 2628 | =item * |
| 2629 | |
| 2630 | C<prototype> now returns C<undef> for all overridable infix operators, |
| 2631 | such as C<eq>, which are not callable in any way resembling functions. |
| 2632 | It used to return incorrect prototypes for some and die for others |
| 2633 | [perl #94984]. |
| 2634 | |
| 2635 | =item * |
| 2636 | |
| 2637 | The prototypes of several built-in functions--C<getprotobynumber>, C<lock>, |
| 2638 | C<not> and C<select>--have been corrected, or at least are now closer to |
| 2639 | reality than before. |
| 2640 | |
| 2641 | =back |
| 2642 | |
| 2643 | =head2 Regular expressions |
| 2644 | |
| 2645 | =for comment Is it possible to merge some of these items? |
| 2646 | |
| 2647 | =over 4 |
| 2648 | |
| 2649 | =item * |
| 2650 | |
| 2651 | C</[[:ascii:]]/> and C</[[:blank:]]/> now use locale rules under |
| 2652 | C<use locale> when the platform supports that. Previously, they used |
| 2653 | the platform's native character set. |
| 2654 | |
| 2655 | =item * |
| 2656 | |
| 2657 | C<m/[[:ascii:]]/i> and C</\p{ASCII}/i> now match identically (when not |
| 2658 | under a differing locale). This fixes a regression introduced in 5.14 |
| 2659 | in which the first expression could match characters outside of ASCII, |
| 2660 | such as the KELVIN SIGN. |
| 2661 | |
| 2662 | =item * |
| 2663 | |
| 2664 | C</.*/g> would sometimes refuse to match at the end of a string that ends |
| 2665 | with "\n". This has been fixed [perl #109206]. |
| 2666 | |
| 2667 | =item * |
| 2668 | |
| 2669 | Starting with 5.12.0, Perl used to get its internal bookkeeping muddled up |
| 2670 | after assigning C<${ qr// }> to a hash element and locking it with |
| 2671 | L<Hash::Util>. This could result in double frees, crashes or erratic |
| 2672 | behaviour. |
| 2673 | |
| 2674 | =item * |
| 2675 | |
| 2676 | The new (in 5.14.0) regular expression modifier C</a> when repeated like |
| 2677 | C</aa> forbids the characters outside the ASCII range that match |
| 2678 | characters inside that range from matching under C</i>. This did not |
| 2679 | work under some circumstances, all involving alternation, such as: |
| 2680 | |
| 2681 | "\N{KELVIN SIGN}" =~ /k|foo/iaa; |
| 2682 | |
| 2683 | succeeded inappropriately. This is now fixed. |
| 2684 | |
| 2685 | =item * |
| 2686 | |
| 2687 | 5.14.0 introduced some memory leaks in regular expression character |
| 2688 | classes such as C<[\w\s]>, which have now been fixed. (5.14.1) |
| 2689 | |
| 2690 | =item * |
| 2691 | |
| 2692 | An edge case in regular expression matching could potentially loop. |
| 2693 | This happened only under C</i> in bracketed character classes that have |
| 2694 | characters with multi-character folds, and the target string to match |
| 2695 | against includes the first portion of the fold, followed by another |
| 2696 | character that has a multi-character fold that begins with the remaining |
| 2697 | portion of the fold, plus some more. |
| 2698 | |
| 2699 | "s\N{U+DF}" =~ /[\x{DF}foo]/i |
| 2700 | |
| 2701 | is one such case. C<\xDF> folds to C<"ss">. (5.14.1) |
| 2702 | |
| 2703 | =item * |
| 2704 | |
| 2705 | A few characters in regular expression pattern matches did not |
| 2706 | match correctly in some circumstances, all involving C</i>. The |
| 2707 | affected characters are: |
| 2708 | COMBINING GREEK YPOGEGRAMMENI, |
| 2709 | GREEK CAPITAL LETTER IOTA, |
| 2710 | GREEK CAPITAL LETTER UPSILON, |
| 2711 | GREEK PROSGEGRAMMENI, |
| 2712 | GREEK SMALL LETTER IOTA WITH DIALYTIKA AND OXIA, |
| 2713 | GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS, |
| 2714 | GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND OXIA, |
| 2715 | GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS, |
| 2716 | LATIN SMALL LETTER LONG S, |
| 2717 | LATIN SMALL LIGATURE LONG S T, |
| 2718 | and |
| 2719 | LATIN SMALL LIGATURE ST. |
| 2720 | |
| 2721 | =item * |
| 2722 | |
| 2723 | A memory leak regression in regular expression compilation |
| 2724 | under threading has been fixed. |
| 2725 | |
| 2726 | =item * |
| 2727 | |
| 2728 | A regression introduced in 5.13.6 has |
| 2729 | been fixed. This involved an inverted |
| 2730 | bracketed character class in a regular expression that consisted solely |
| 2731 | of a Unicode property. That property wasn't getting inverted outside the |
| 2732 | Latin1 range. |
| 2733 | |
| 2734 | =item * |
| 2735 | |
| 2736 | Three problematic Unicode characters now work better in regex pattern matching under C</i> |
| 2737 | |
| 2738 | In the past, three Unicode characters: |
| 2739 | LATIN SMALL LETTER SHARP S, |
| 2740 | GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS, |
| 2741 | and |
| 2742 | GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS, |
| 2743 | along with the sequences that they fold to |
| 2744 | (including "ss" in the case of LATIN SMALL LETTER SHARP S), |
| 2745 | did not properly match under C</i>. 5.14.0 fixed some of these cases, |
| 2746 | but introduced others, including a panic when one of the characters or |
| 2747 | sequences was used in the C<(?(DEFINE)> regular expression predicate. |
| 2748 | The known bugs that were introduced in 5.14 have now been fixed; as well |
| 2749 | as some other edge cases that have never worked until now. All these |
| 2750 | involve using the characters and sequences outside bracketed character |
| 2751 | classes under C</i>. This closes [perl #98546]. |
| 2752 | |
| 2753 | There remain known problems when using certain characters with |
| 2754 | multi-character folds inside bracketed character classes, including such |
| 2755 | constructs as C<qr/[\N{LATIN SMALL LETTER SHARP}a-z]/i>. These |
| 2756 | remaining bugs are addressed in [perl #89774]. |
| 2757 | |
| 2758 | =item * |
| 2759 | |
| 2760 | RT #78266: The regex engine has been leaking memory when accessing |
| 2761 | named captures that weren't matched as part of a regex ever since 5.10 |
| 2762 | when they were introduced, e.g. this would consume over a hundred MB of |
| 2763 | memory: |
| 2764 | |
| 2765 | for (1..10_000_000) { |
| 2766 | if ("foo" =~ /(foo|(?<capture>bar))?/) { |
| 2767 | my $capture = $+{capture} |
| 2768 | } |
| 2769 | } |
| 2770 | system "ps -o rss $$"' |
| 2771 | |
| 2772 | =item * |
| 2773 | |
| 2774 | In 5.14, C</[[:lower:]]/i> and C</[[:upper:]]/i> no longer matched the |
| 2775 | opposite case. This has been fixed [perl #101970]. |
| 2776 | |
| 2777 | =item * |
| 2778 | |
| 2779 | A regular expression match with an overloaded object on the right-hand side |
| 2780 | would in some cases stringify the object too many times. |
| 2781 | |
| 2782 | =item * |
| 2783 | |
| 2784 | A regression has been fixed that was introduced in 5.14, in C</i> |
| 2785 | regular expression matching, in which a match improperly fails if the |
| 2786 | pattern is in UTF-8, the target string is not, and a Latin-1 character |
| 2787 | precedes a character in the string that should match the pattern. |
| 2788 | [perl #101710] |
| 2789 | |
| 2790 | =item * |
| 2791 | |
| 2792 | In case-insensitive regular expression pattern matching, no longer on |
| 2793 | UTF-8 encoded strings does the scan for the start of match only look at |
| 2794 | the first possible position. This caused matches such as |
| 2795 | C<"f\x{FB00}" =~ /ff/i> to fail. |
| 2796 | |
| 2797 | =item * |
| 2798 | |
| 2799 | The regexp optimiser no longer crashes on debugging builds when merging |
| 2800 | fixed-string nodes with inconvenient contents. |
| 2801 | |
| 2802 | =item * |
| 2803 | |
| 2804 | A panic involving the combination of the regular expression modifiers |
| 2805 | C</aa> and the C<\b> escape sequence introduced in 5.14.0 has been |
| 2806 | fixed [perl #95964]. |
| 2807 | |
| 2808 | =item * |
| 2809 | |
| 2810 | The combination of the regular expression modifiers C</aa> and the C<\b> |
| 2811 | and C<\B> escape sequences did not work properly on UTF-8 encoded |
| 2812 | strings. All non-ASCII characters under C</aa> should be treated as |
| 2813 | non-word characters, but what was happening was that Unicode rules were |
| 2814 | used to determine wordness/non-wordness for non-ASCII characters. This |
| 2815 | is now fixed [perl #95968]. |
| 2816 | |
| 2817 | =item * |
| 2818 | |
| 2819 | C<< (?foo: ...) >> no longer loses passed in character set. |
| 2820 | |
| 2821 | =item * |
| 2822 | |
| 2823 | The trie optimisation used to have problems with alternations containing |
| 2824 | an empty C<(?:)>, causing C<< "x" =~ /\A(?>(?:(?:)A|B|C?x))\z/ >> not to |
| 2825 | match, whereas it should [perl #111842]. |
| 2826 | |
| 2827 | =item * |
| 2828 | |
| 2829 | Use of lexical (C<my>) variables in code blocks embedded in regular |
| 2830 | expressions will no longer result in memory corruption or crashes. |
| 2831 | |
| 2832 | Nevertheless, these code blocks are still experimental, as there are still |
| 2833 | problems with the wrong variables being closed over (in loops for instance) |
| 2834 | and with abnormal exiting (e.g., C<die>) causing memory corruption. |
| 2835 | |
| 2836 | =item * |
| 2837 | |
| 2838 | The C<\h>, C<\H>, C<\v> and C<\V> regular expression metacharacters used to |
| 2839 | cause a panic error message when attempting to match at the end of the |
| 2840 | string [perl #96354]. |
| 2841 | |
| 2842 | =item * |
| 2843 | |
| 2844 | The abbreviations for four C1 control characters C<MW> C<PM>, C<RI>, and |
| 2845 | C<ST> were previously unrecognized by C<\N{}>, vianame(), and |
| 2846 | string_vianame(). |
| 2847 | |
| 2848 | =item * |
| 2849 | |
| 2850 | Mentioning a variable named "&" other than C<$&> (i.e., C<@&> or C<%&>) no |
| 2851 | longer stops C<$&> from working. The same applies to variables named "'" |
| 2852 | and "`" [perl #24237]. |
| 2853 | |
| 2854 | =item * |
| 2855 | |
| 2856 | Creating a C<UNIVERSAL::AUTOLOAD> sub no longer stops C<%+>, C<%-> and |
| 2857 | C<%!> from working some of the time [perl #105024]. |
| 2858 | |
| 2859 | =back |
| 2860 | |
| 2861 | =head2 Smartmatching |
| 2862 | |
| 2863 | =over |
| 2864 | |
| 2865 | =item * |
| 2866 | |
| 2867 | C<~~> now correctly handles the precedence of Any~~Object, and is not tricked |
| 2868 | by an overloaded object on the left-hand side. |
| 2869 | |
| 2870 | =item * |
| 2871 | |
| 2872 | In Perl 5.14.0, C<$tainted ~~ @array> stopped working properly. Sometimes |
| 2873 | it would erroneously fail (when C<$tainted> contained a string that occurs |
| 2874 | in the array I<after> the first element) or erroneously succeed (when |
| 2875 | C<undef> occurred after the first element) [perl #93590]. |
| 2876 | |
| 2877 | =back |
| 2878 | |
| 2879 | =head2 The C<sort> operator |
| 2880 | |
| 2881 | =over |
| 2882 | |
| 2883 | =item * |
| 2884 | |
| 2885 | C<sort> was not treating C<sub {}> and C<sub {()}> as equivalent when |
| 2886 | such a sub was provided as the comparison routine. It used to croak on |
| 2887 | C<sub {()}>. |
| 2888 | |
| 2889 | =item * |
| 2890 | |
| 2891 | C<sort> now works once more with custom sort routines that are XSUBs. It |
| 2892 | stopped working in 5.10.0. |
| 2893 | |
| 2894 | =item * |
| 2895 | |
| 2896 | C<sort> with a constant for a custom sort routine, although it produces |
| 2897 | unsorted results, no longer crashes. It started crashing in 5.10.0. |
| 2898 | |
| 2899 | =item * |
| 2900 | |
| 2901 | Warnings emitted by C<sort> when a custom comparison routine returns a |
| 2902 | non-numeric value now contain "in sort" and show the line number of the |
| 2903 | C<sort> operator, rather than the last line of the comparison routine. The |
| 2904 | warnings also occur now only if warnings are enabled in the scope where |
| 2905 | C<sort> occurs. Previously the warnings would occur if enabled in the |
| 2906 | comparison routine's scope. |
| 2907 | |
| 2908 | =item * |
| 2909 | |
| 2910 | C<< sort { $a <=> $b } >>, which is optimised internally, now produces |
| 2911 | "uninitialized" warnings for NaNs (not-a-number values), since C<< <=> >> |
| 2912 | returns C<undef> for those. This brings it in line with |
| 2913 | S<C<< sort { 1; $a <=> $b } >>> and other more complex cases, which are not |
| 2914 | optimised [perl #94390]. |
| 2915 | |
| 2916 | =back |
| 2917 | |
| 2918 | =head2 The C<substr> operator |
| 2919 | |
| 2920 | =over |
| 2921 | |
| 2922 | =item * |
| 2923 | |
| 2924 | Tied (and otherwise magical) variables are no longer exempt from the |
| 2925 | "Attempt to use reference as lvalue in substr" warning. |
| 2926 | |
| 2927 | =item * |
| 2928 | |
| 2929 | That warning now occurs when the returned lvalue is assigned to, not |
| 2930 | when C<substr> itself is called. This only makes a difference if the |
| 2931 | return value of C<substr> is referenced and assigned to later. |
| 2932 | |
| 2933 | =item * |
| 2934 | |
| 2935 | Passing a substring of a read-only value or a typeglob to a function |
| 2936 | (potential lvalue context) no longer causes an immediate "Can't coerce" |
| 2937 | or "Modification of a read-only value" error. That error only occurs |
| 2938 | if and when the value passed is assigned to. |
| 2939 | |
| 2940 | The same thing happens with the "substr outside of string" error. If |
| 2941 | the lvalue is only read, not written to, it is now just a warning, as |
| 2942 | with rvalue C<substr>. |
| 2943 | |
| 2944 | =item * |
| 2945 | |
| 2946 | C<substr> assignments no longer call FETCH twice if the first argument |
| 2947 | is a tied variable, just once. |
| 2948 | |
| 2949 | =back |
| 2950 | |
| 2951 | =head2 Support for embedded nulls |
| 2952 | |
| 2953 | Some parts of Perl did not work correctly with nulls (C<chr 0>) embedded in |
| 2954 | strings. That meant that, for instance, C<< $m = "a\0b"; foo->$m >> would |
| 2955 | call the "a" method, instead of the actual method name contained in $m. |
| 2956 | These parts of perl have been fixed to support nulls: |
| 2957 | |
| 2958 | =over |
| 2959 | |
| 2960 | =item * |
| 2961 | |
| 2962 | Method names |
| 2963 | |
| 2964 | =item * |
| 2965 | |
| 2966 | Typeglob names (including filehandle and subroutine names) |
| 2967 | |
| 2968 | =item * |
| 2969 | |
| 2970 | Package names, including the return value of C<ref()> |
| 2971 | |
| 2972 | =item * |
| 2973 | |
| 2974 | Typeglob elements (C<*foo{"THING\0stuff"}>) |
| 2975 | |
| 2976 | =item * |
| 2977 | |
| 2978 | Signal names |
| 2979 | |
| 2980 | =item * |
| 2981 | |
| 2982 | Various warnings and error messages that mention variable names or values, |
| 2983 | methods, etc. |
| 2984 | |
| 2985 | =back |
| 2986 | |
| 2987 | One side effect of these changes is that blessing into "\0" no longer |
| 2988 | causes C<ref()> to return false. |
| 2989 | |
| 2990 | =head2 Threading bugs |
| 2991 | |
| 2992 | =over |
| 2993 | |
| 2994 | =item * |
| 2995 | |
| 2996 | Typeglobs returned from threads are no longer cloned if the parent thread |
| 2997 | already has a glob with the same name. This means that returned |
| 2998 | subroutines will now assign to the right package variables [perl #107366]. |
| 2999 | |
| 3000 | =item * |
| 3001 | |
| 3002 | Some cases of threads crashing due to memory allocation during cloning have |
| 3003 | been fixed [perl #90006]. |
| 3004 | |
| 3005 | =item * |
| 3006 | |
| 3007 | Thread joining would sometimes emit "Attempt to free unreferenced scalar" |
| 3008 | warnings if C<caller> had been used from the C<DB> package prior to thread |
| 3009 | creation [perl #98092]. |
| 3010 | |
| 3011 | =item * |
| 3012 | |
| 3013 | Locking a subroutine (via C<lock &sub>) is no longer a compile-time error |
| 3014 | for regular subs. For lvalue subroutines, it no longer tries to return the |
| 3015 | sub as a scalar, resulting in strange side effects like C<ref \$_> |
| 3016 | returning "CODE" in some instances. |
| 3017 | |
| 3018 | C<lock &sub> is now a run-time error if L<threads::shared> is loaded (a |
| 3019 | no-op otherwise), but that may be rectified in a future version. |
| 3020 | |
| 3021 | =back |
| 3022 | |
| 3023 | =head2 Tied variables |
| 3024 | |
| 3025 | =over |
| 3026 | |
| 3027 | =item * |
| 3028 | |
| 3029 | Various cases in which FETCH was being ignored or called too many times |
| 3030 | have been fixed: |
| 3031 | |
| 3032 | =over |
| 3033 | |
| 3034 | =item * |
| 3035 | |
| 3036 | C<PerlIO::get_layers> [perl #97956] |
| 3037 | |
| 3038 | =item * |
| 3039 | |
| 3040 | C<$tied =~ y/a/b/>, C<chop $tied> and C<chomp $tied> when $tied holds a |
| 3041 | reference. |
| 3042 | |
| 3043 | =item * |
| 3044 | |
| 3045 | When calling C<local $_> [perl #105912] |
| 3046 | |
| 3047 | =item * |
| 3048 | |
| 3049 | Four-argument C<select> |
| 3050 | |
| 3051 | =item * |
| 3052 | |
| 3053 | A tied buffer passed to C<sysread> |
| 3054 | |
| 3055 | =item * |
| 3056 | |
| 3057 | C<< $tied .= <> >> |
| 3058 | |
| 3059 | =item * |
| 3060 | |
| 3061 | Three-argument C<open>, the third being a tied file handle |
| 3062 | (as in C<< open $fh, ">&", $tied >>) |
| 3063 | |
| 3064 | =item * |
| 3065 | |
| 3066 | C<sort> with a reference to a tied glob for the comparison routine. |
| 3067 | |
| 3068 | =item * |
| 3069 | |
| 3070 | C<..> and C<...> in list context [perl #53554]. |
| 3071 | |
| 3072 | =item * |
| 3073 | |
| 3074 | C<${$tied}>, C<@{$tied}>, C<%{$tied}> and C<*{$tied}> where the tied |
| 3075 | variable returns a string (C<&{}> was unaffected) |
| 3076 | |
| 3077 | =item * |
| 3078 | |
| 3079 | C<defined ${ $tied_variable }> |
| 3080 | |
| 3081 | =item * |
| 3082 | |
| 3083 | Various functions that take a filehandle argument in rvalue context |
| 3084 | (C<close>, C<readline>, etc.) [perl #97482] |
| 3085 | |
| 3086 | =item * |
| 3087 | |
| 3088 | Some cases of dereferencing a complex expression, such as |
| 3089 | C<${ (), $tied } = 1>, used to call C<FETCH> multiple times, but now call |
| 3090 | it once. |
| 3091 | |
| 3092 | =item * |
| 3093 | |
| 3094 | C<$tied-E<gt>method> where $tied returns a package name--even resulting in |
| 3095 | a failure to call the method, due to memory corruption |
| 3096 | |
| 3097 | =item * |
| 3098 | |
| 3099 | Assignments like C<*$tied = \&{"..."}> and C<*glob = $tied> |
| 3100 | |
| 3101 | =item * |
| 3102 | |
| 3103 | C<chdir>, C<chmod>, C<chown>, C<utime>, C<truncate>, C<stat>, C<lstat> and |
| 3104 | the filetest ops (C<-r>, C<-x>, etc.) |
| 3105 | |
| 3106 | =back |
| 3107 | |
| 3108 | =item * |
| 3109 | |
| 3110 | C<caller> sets C<@DB::args> to the subroutine arguments when called from |
| 3111 | the DB package. It used to crash when doing so if C<@DB::args> happened to |
| 3112 | be tied. Now it croaks instead. |
| 3113 | |
| 3114 | =item * |
| 3115 | |
| 3116 | Tying an element of %ENV or C<%^H> and then deleting that element would |
| 3117 | result in a call to the tie object's DELETE method, even though tying the |
| 3118 | element itself is supposed to be equivalent to tying a scalar (the element |
| 3119 | is, of course, a scalar) [perl #67490]. |
| 3120 | |
| 3121 | =item * |
| 3122 | |
| 3123 | When Perl autovivifies an element of a tied array or hash (which entails |
| 3124 | calling STORE with a new reference), it now calls FETCH immediately after |
| 3125 | the STORE, instead of assuming that FETCH would have returned the same |
| 3126 | reference. This can make it easier to implement tied objects [perl #35865, #43011]. |
| 3127 | |
| 3128 | =item * |
| 3129 | |
| 3130 | Four-argument C<select> no longer produces its "Non-string passed as |
| 3131 | bitmask" warning on tied or tainted variables that are strings. |
| 3132 | |
| 3133 | =item * |
| 3134 | |
| 3135 | Localising a tied scalar that returns a typeglob no longer stops it from |
| 3136 | being tied till the end of the scope. |
| 3137 | |
| 3138 | =item * |
| 3139 | |
| 3140 | Attempting to C<goto> out of a tied handle method used to cause memory |
| 3141 | corruption or crashes. Now it produces an error message instead |
| 3142 | [perl #8611]. |
| 3143 | |
| 3144 | =item * |
| 3145 | |
| 3146 | A bug has been fixed that occurs when a tied variable is used as a |
| 3147 | subroutine reference: if the last thing assigned to or returned from the |
| 3148 | variable was a reference or typeglob, the C<\&$tied> could either crash or |
| 3149 | return the wrong subroutine. The reference case is a regression introduced |
| 3150 | in Perl 5.10.0. For typeglobs, it has probably never worked till now. |
| 3151 | |
| 3152 | =back |
| 3153 | |
| 3154 | =head2 Version objects and vstrings |
| 3155 | |
| 3156 | =over |
| 3157 | |
| 3158 | =item * |
| 3159 | |
| 3160 | The bitwise complement operator (and possibly other operators, too) when |
| 3161 | passed a vstring would leave vstring magic attached to the return value, |
| 3162 | even though the string had changed. This meant that |
| 3163 | C<< version->new(~v1.2.3) >> would create a version looking like "v1.2.3" |
| 3164 | even though the string passed to C<< version->new >> was actually |
| 3165 | "\376\375\374". This also caused L<B::Deparse> to deparse C<~v1.2.3> |
| 3166 | incorrectly, without the C<~> [perl #29070]. |
| 3167 | |
| 3168 | =item * |
| 3169 | |
| 3170 | Assigning a vstring to a magic (e.g., tied, C<$!>) variable and then |
| 3171 | assigning something else used to blow away all the magic. This meant that |
| 3172 | tied variables would come undone, C<$!> would stop getting updated on |
| 3173 | failed system calls, C<$|> would stop setting autoflush, and other |
| 3174 | mischief would take place. This has been fixed. |
| 3175 | |
| 3176 | =item * |
| 3177 | |
| 3178 | C<< version->new("version") >> and C<printf "%vd", "version"> no longer |
| 3179 | crash [perl #102586]. |
| 3180 | |
| 3181 | =item * |
| 3182 | |
| 3183 | Version comparisons, such as those that happen implicitly with C<use |
| 3184 | v5.43>, no longer cause locale settings to change [perl #105784]. |
| 3185 | |
| 3186 | =item * |
| 3187 | |
| 3188 | Version objects no longer cause memory leaks in boolean context |
| 3189 | [perl #109762]. |
| 3190 | |
| 3191 | =back |
| 3192 | |
| 3193 | =head2 Warnings, redefinition |
| 3194 | |
| 3195 | =over |
| 3196 | |
| 3197 | =item * |
| 3198 | |
| 3199 | Subroutines from the C<autouse> namespace are once more exempt from |
| 3200 | redefinition warnings. This used to work in 5.005, but was broken in |
| 3201 | 5.6 for most subroutines. For subs created via XS that redefine |
| 3202 | subroutines from the C<autouse> package, this stopped working in 5.10. |
| 3203 | |
| 3204 | =item * |
| 3205 | |
| 3206 | New XSUBs now produce redefinition warnings if they overwrite existing |
| 3207 | subs, as they did in 5.8.x. (The C<autouse> logic was reversed in |
| 3208 | 5.10-14. Only subroutines from the C<autouse> namespace would warn |
| 3209 | when clobbered.) |
| 3210 | |
| 3211 | =item * |
| 3212 | |
| 3213 | C<newCONSTSUB> used to use compile-time warning hints, instead of |
| 3214 | run-time hints. The following code should never produce a redefinition |
| 3215 | warning, but it used to, if C<newCONSTSUB> redefined an existing |
| 3216 | subroutine: |
| 3217 | |
| 3218 | use warnings; |
| 3219 | BEGIN { |
| 3220 | no warnings; |
| 3221 | some_XS_function_that_calls_new_CONSTSUB(); |
| 3222 | } |
| 3223 | |
| 3224 | =item * |
| 3225 | |
| 3226 | Redefinition warnings for constant subroutines are on by default (what |
| 3227 | are known as severe warnings in L<perldiag>). This was only the case |
| 3228 | when it was a glob assignment or declaration of a Perl subroutine that |
| 3229 | caused the warning. If the creation of XSUBs triggered the warning, it |
| 3230 | was not a default warning. This has been corrected. |
| 3231 | |
| 3232 | =item * |
| 3233 | |
| 3234 | The internal check to see whether a redefinition warning should occur |
| 3235 | used to emit "uninitialized" warnings in cases like this: |
| 3236 | |
| 3237 | use warnings "uninitialized"; |
| 3238 | use constant {u => undef, v => undef}; |
| 3239 | sub foo(){u} |
| 3240 | sub foo(){v} |
| 3241 | |
| 3242 | =back |
| 3243 | |
| 3244 | =head2 Warnings, "Uninitialized" |
| 3245 | |
| 3246 | =over |
| 3247 | |
| 3248 | =item * |
| 3249 | |
| 3250 | Various functions that take a filehandle argument in rvalue context |
| 3251 | (C<close>, C<readline>, etc.) used to warn twice for an undefined handle |
| 3252 | [perl #97482]. |
| 3253 | |
| 3254 | =item * |
| 3255 | |
| 3256 | C<dbmopen> now only warns once, rather than three times, if the mode |
| 3257 | argument is C<undef> [perl #90064]. |
| 3258 | |
| 3259 | =item * |
| 3260 | |
| 3261 | The C<+=> operator does not usually warn when the left-hand side is |
| 3262 | C<undef>, but it was doing so for tied variables. This has been fixed |
| 3263 | [perl #44895]. |
| 3264 | |
| 3265 | =item * |
| 3266 | |
| 3267 | A bug fix in Perl 5.14 introduced a new bug, causing "uninitialized" |
| 3268 | warnings to report the wrong variable if the operator in question had |
| 3269 | two operands and one was C<%{...}> or C<@{...}>. This has been fixed |
| 3270 | [perl #103766]. |
| 3271 | |
| 3272 | =item * |
| 3273 | |
| 3274 | C<..> and C<...> in list context now mention the name of the variable in |
| 3275 | "uninitialized" warnings for string (as opposed to numeric) ranges. |
| 3276 | |
| 3277 | =back |
| 3278 | |
| 3279 | =head2 Weak references |
| 3280 | |
| 3281 | =over |
| 3282 | |
| 3283 | =item * |
| 3284 | |
| 3285 | Weakening the first argument to an automatically-invoked C<DESTROY> method |
| 3286 | could result in erroneous "DESTROY created new reference" errors or |
| 3287 | crashes. Now it is an error to weaken a read-only reference. |
| 3288 | |
| 3289 | =item * |
| 3290 | |
| 3291 | Weak references to lexical hashes going out of scope were not going stale |
| 3292 | (becoming undefined), but continued to point to the hash. |
| 3293 | |
| 3294 | =item * |
| 3295 | |
| 3296 | Weak references to lexical variables going out of scope are now broken |
| 3297 | before any magical methods (e.g., DESTROY on a tie object) are called. |
| 3298 | This prevents such methods from modifying the variable that will be seen |
| 3299 | the next time the scope is entered. |
| 3300 | |
| 3301 | =item * |
| 3302 | |
| 3303 | Creating a weak reference to an @ISA array or accessing the array index |
| 3304 | (C<$#ISA>) could result in confused internal bookkeeping for elements |
| 3305 | subsequently added to the @ISA array. For instance, creating a weak |
| 3306 | reference to the element itself could push that weak reference on to @ISA; |
| 3307 | and elements added after use of C<$#ISA> would be ignored by method lookup |
| 3308 | [perl #85670]. |
| 3309 | |
| 3310 | =back |
| 3311 | |
| 3312 | =head2 Other notable fixes |
| 3313 | |
| 3314 | =over |
| 3315 | |
| 3316 | =item * |
| 3317 | |
| 3318 | C<quotemeta> now quotes consistently the same non-ASCII characters under |
| 3319 | C<use feature 'unicode_strings'>, regardless of whether the string is |
| 3320 | encoded in UTF-8 or not, hence fixing the last vestiges (we hope) of the |
| 3321 | infamous L<perlunicode/The "Unicode Bug">. [perl #77654]. |
| 3322 | |
| 3323 | Which of these code points is quoted has changed, based on Unicode's |
| 3324 | recommendations. See L<perlfunc/quotemeta> for details. |
| 3325 | |
| 3326 | =item * |
| 3327 | |
| 3328 | When one writes C<open foo || die>, which used to work in Perl 4, a |
| 3329 | "Precedence problem" warning is produced. This warning used erroneously to |
| 3330 | apply to fully-qualified bareword handle names not followed by C<||>. This |
| 3331 | has been corrected. |
| 3332 | |
| 3333 | =item * |
| 3334 | |
| 3335 | After package aliasing (C<*foo:: = *bar::>), C<select> with 0 or 1 argument |
| 3336 | would sometimes return a name that could not be used to refer to the |
| 3337 | filehandle, or sometimes it would return C<undef> even when a filehandle |
| 3338 | was selected. Now it returns a typeglob reference in such cases. |
| 3339 | |
| 3340 | =item * |
| 3341 | |
| 3342 | C<PerlIO::get_layers> no longer ignores some arguments that it thinks are |
| 3343 | numeric, while treating others as filehandle names. It is now consistent |
| 3344 | for flat scalars (i.e., not references). |
| 3345 | |
| 3346 | =item * |
| 3347 | |
| 3348 | Unrecognised switches on C<#!> line |
| 3349 | |
| 3350 | If a switch, such as B<-x>, that cannot occur on the C<#!> line is used |
| 3351 | there, perl dies with "Can't emulate...". |
| 3352 | |
| 3353 | It used to produce the same message for switches that perl did not |
| 3354 | recognise at all, whether on the command line or the C<#!> line. |
| 3355 | |
| 3356 | Now it produces the "Unrecognized switch" error message [perl #104288]. |
| 3357 | |
| 3358 | =item * |
| 3359 | |
| 3360 | C<system> now temporarily blocks the SIGCHLD signal handler, to prevent the |
| 3361 | signal handler from stealing the exit status [perl #105700]. |
| 3362 | |
| 3363 | =item * |
| 3364 | |
| 3365 | The %n formatting code for C<printf> and C<sprintf>, which causes the number |
| 3366 | of characters to be assigned to the next argument, now actually |
| 3367 | assigns the number of characters, instead of the number of bytes. |
| 3368 | |
| 3369 | It also works now with special lvalue functions like C<substr> and with |
| 3370 | nonexistent hash and array elements [perl #3471, #103492]. |
| 3371 | |
| 3372 | =item * |
| 3373 | |
| 3374 | Perl skips copying values returned from a subroutine, for the sake of |
| 3375 | speed, if doing so would make no observable difference. Due to faulty |
| 3376 | logic, this would happen with the |
| 3377 | result of C<delete>, C<shift> or C<splice>, even if the result was |
| 3378 | referenced elsewhere. It also did so with tied variables about to be freed |
| 3379 | [perl #91844, #95548]. |
| 3380 | |
| 3381 | =item * |
| 3382 | |
| 3383 | C<utf8::decode> now refuses to modify read-only scalars [perl #91850]. |
| 3384 | |
| 3385 | =item * |
| 3386 | |
| 3387 | Freeing $_ inside a C<grep> or C<map> block, a code block embedded in a |
| 3388 | regular expression, or an @INC filter (a subroutine returned by a |
| 3389 | subroutine in @INC) used to result in double frees or crashes |
| 3390 | [perl #91880, #92254, #92256]. |
| 3391 | |
| 3392 | =item * |
| 3393 | |
| 3394 | C<eval> returns C<undef> in scalar context or an empty list in list |
| 3395 | context when there is a run-time error. When C<eval> was passed a |
| 3396 | string in list context and a syntax error occurred, it used to return a |
| 3397 | list containing a single undefined element. Now it returns an empty |
| 3398 | list in list context for all errors [perl #80630]. |
| 3399 | |
| 3400 | =item * |
| 3401 | |
| 3402 | C<goto &func> no longer crashes, but produces an error message, when |
| 3403 | the unwinding of the current subroutine's scope fires a destructor that |
| 3404 | undefines the subroutine being "goneto" [perl #99850]. |
| 3405 | |
| 3406 | =item * |
| 3407 | |
| 3408 | Perl now holds an extra reference count on the package that code is |
| 3409 | currently compiling in. This means that the following code no longer |
| 3410 | crashes [perl #101486]: |
| 3411 | |
| 3412 | package Foo; |
| 3413 | BEGIN {*Foo:: = *Bar::} |
| 3414 | sub foo; |
| 3415 | |
| 3416 | =item * |
| 3417 | |
| 3418 | The C<x> repetition operator no longer crashes on 64-bit builds with large |
| 3419 | repeat counts [perl #94560]. |
| 3420 | |
| 3421 | =item * |
| 3422 | |
| 3423 | Calling C<require> on an implicit C<$_> when C<*CORE::GLOBAL::require> has |
| 3424 | been overridden does not segfault anymore, and C<$_> is now passed to the |
| 3425 | overriding subroutine [perl #78260]. |
| 3426 | |
| 3427 | =item * |
| 3428 | |
| 3429 | C<use> and C<require> are no longer affected by the I/O layers active in |
| 3430 | the caller's scope (enabled by L<open.pm|open>) [perl #96008]. |
| 3431 | |
| 3432 | =item * |
| 3433 | |
| 3434 | C<our $::é; $é> (which is invalid) no longer produces the "Compilation |
| 3435 | error at lib/utf8_heavy.pl..." error message, which it started emitting in |
| 3436 | 5.10.0 [perl #99984]. |
| 3437 | |
| 3438 | =item * |
| 3439 | |
| 3440 | On 64-bit systems, C<read()> now understands large string offsets beyond |
| 3441 | the 32-bit range. |
| 3442 | |
| 3443 | =item * |
| 3444 | |
| 3445 | Errors that occur when processing subroutine attributes no longer cause the |
| 3446 | subroutine's op tree to leak. |
| 3447 | |
| 3448 | =item * |
| 3449 | |
| 3450 | Passing the same constant subroutine to both C<index> and C<formline> no |
| 3451 | longer causes one or the other to fail [perl #89218]. (5.14.1) |
| 3452 | |
| 3453 | =item * |
| 3454 | |
| 3455 | List assignment to lexical variables declared with attributes in the same |
| 3456 | statement (C<my ($x,@y) : blimp = (72,94)>) stopped working in Perl 5.8.0. |
| 3457 | It has now been fixed. |
| 3458 | |
| 3459 | =item * |
| 3460 | |
| 3461 | Perl 5.10.0 introduced some faulty logic that made "U*" in the middle of |
| 3462 | a pack template equivalent to "U0" if the input string was empty. This has |
| 3463 | been fixed [perl #90160]. |
| 3464 | |
| 3465 | =item * |
| 3466 | |
| 3467 | Destructors on objects were not called during global destruction on objects |
| 3468 | that were not referenced by any scalars. This could happen if an array |
| 3469 | element were blessed (e.g., C<bless \$a[0]>) or if a closure referenced a |
| 3470 | blessed variable (C<bless \my @a; sub foo { @a }>). |
| 3471 | |
| 3472 | Now there is an extra pass during global destruction to fire destructors on |
| 3473 | any objects that might be left after the usual passes that check for |
| 3474 | objects referenced by scalars [perl #36347]. |
| 3475 | |
| 3476 | =item * |
| 3477 | |
| 3478 | Fixed a case where it was possible that a freed buffer may have been read |
| 3479 | from when parsing a here document [perl #90128]. (5.14.1) |
| 3480 | |
| 3481 | =item * |
| 3482 | |
| 3483 | C<each(I<ARRAY>)> is now wrapped in C<defined(...)>, like C<each(I<HASH>)>, |
| 3484 | inside a C<while> condition [perl #90888]. |
| 3485 | |
| 3486 | =item * |
| 3487 | |
| 3488 | A problem with context propagation when a C<do> block is an argument to |
| 3489 | C<return> has been fixed. It used to cause C<undef> to be returned in |
| 3490 | some cases of a C<return> inside an C<if> block which itself is followed by |
| 3491 | another C<return>. |
| 3492 | |
| 3493 | =item * |
| 3494 | |
| 3495 | Calling C<index> with a tainted constant no longer causes constants in |
| 3496 | subsequently compiled code to become tainted [perl #64804]. |
| 3497 | |
| 3498 | =item * |
| 3499 | |
| 3500 | Infinite loops like C<1 while 1> used to stop C<strict 'subs'> mode from |
| 3501 | working for the rest of the block.t |
| 3502 | |
| 3503 | =item * |
| 3504 | |
| 3505 | For list assignments like C<($a,$b) = ($b,$a)>, Perl has to make a copy of |
| 3506 | the items on the right-hand side before assignment them to the left. For |
| 3507 | efficiency's sake, it assigns the values on the right straight to the items |
| 3508 | on the left if no one variable is mentioned on both sides, as in C<($a,$b) = |
| 3509 | ($c,$d)>. The logic for determining when it can cheat was faulty, in that |
| 3510 | C<&&> and C<||> on the right-hand side could fool it. So C<($a,$b) = |
| 3511 | $some_true_value && ($b,$a)> would end up assigning the value of C<$b> to |
| 3512 | both scalars. |
| 3513 | |
| 3514 | =item * |
| 3515 | |
| 3516 | Perl no longer tries to apply lvalue context to the string in |
| 3517 | C<("string", $variable) ||= 1> (which used to be an error). Since the |
| 3518 | left-hand side of C<||=> is evaluated in scalar context, that's a scalar |
| 3519 | comma operator, which gives all but the last item void context. There is |
| 3520 | no such thing as void lvalue context, so it was a mistake for Perl to try |
| 3521 | to force it [perl #96942]. |
| 3522 | |
| 3523 | =item * |
| 3524 | |
| 3525 | C<caller> no longer leaks memory when called from the DB package if |
| 3526 | C<@DB::args> was assigned to after the first call to C<caller>. L<Carp> |
| 3527 | was triggering this bug [perl #97010]. |
| 3528 | |
| 3529 | =item * |
| 3530 | |
| 3531 | C<close> and similar filehandle functions, when called on built-in global |
| 3532 | variables (like C<$+>), used to die if the variable happened to hold the |
| 3533 | undefined value, instead of producing the usual "Use of uninitialized |
| 3534 | value" warning. |
| 3535 | |
| 3536 | =item * |
| 3537 | |
| 3538 | When autovivified file handles were introduced in Perl 5.6.0, C<readline> |
| 3539 | was inadvertently made to autovivify when called as C<readline($foo)> (but |
| 3540 | not as C<E<lt>$fooE<gt>>). It has now been fixed never to autovivify. |
| 3541 | |
| 3542 | =item * |
| 3543 | |
| 3544 | Calling an undefined anonymous subroutine (e.g., what $x holds after |
| 3545 | C<undef &{$x = sub{}}>) used to cause a "Not a CODE reference" error, which |
| 3546 | has been corrected to "Undefined subroutine called" [perl #71154]. |
| 3547 | |
| 3548 | =item * |
| 3549 | |
| 3550 | Causing C<@DB::args> to be freed between uses of C<caller> no longer |
| 3551 | results in a crash [perl #93320]. |
| 3552 | |
| 3553 | =item * |
| 3554 | |
| 3555 | C<setpgrp($foo)> used to be equivalent to C<($foo, setpgrp)>, because |
| 3556 | C<setpgrp> was ignoring its argument if there was just one. Now it is |
| 3557 | equivalent to C<setpgrp($foo,0)>. |
| 3558 | |
| 3559 | =item * |
| 3560 | |
| 3561 | C<shmread> was not setting the scalar flags correctly when reading from |
| 3562 | shared memory, causing the existing cached numeric representation in the |
| 3563 | scalar to persist [perl #98480]. |
| 3564 | |
| 3565 | =item * |
| 3566 | |
| 3567 | C<++> and C<--> now work on copies of globs, instead of dying. |
| 3568 | |
| 3569 | =item * |
| 3570 | |
| 3571 | C<splice()> doesn't warn when truncating |
| 3572 | |
| 3573 | You can now limit the size of an array using C<splice(@a,MAX_LEN)> without |
| 3574 | worrying about warnings. |
| 3575 | |
| 3576 | =item * |
| 3577 | |
| 3578 | C<< $$ >> is no longer tainted. Since this value comes directly from |
| 3579 | C<< getpid() >>, it is always safe. |
| 3580 | |
| 3581 | =item * |
| 3582 | |
| 3583 | The parser no longer leaks a filehandle if STDIN was closed before parsing |
| 3584 | started [perl #37033]. |
| 3585 | |
| 3586 | =item * |
| 3587 | |
| 3588 | C<< die; >> with a non-reference, non-string, or magical (e.g., tainted) |
| 3589 | value in $@ now properly propagates that value [perl #111654]. |
| 3590 | |
| 3591 | =back |
| 3592 | |
| 3593 | =head1 Known Problems |
| 3594 | |
| 3595 | =over 4 |
| 3596 | |
| 3597 | =item * |
| 3598 | |
| 3599 | On Solaris, we have two kinds of failure. |
| 3600 | |
| 3601 | If F<make> is Sun's F<make≥>, we get an error about a badly formed macro |
| 3602 | assignment in the F<Makefile>. That happens when F<./Configure> tries to |
| 3603 | make depends. F<Configure> then exits 0, but further F<make>-ing fails. |
| 3604 | |
| 3605 | If F<make> is F<gmake>, F<Configure> completes, then we get errors related |
| 3606 | to F</usr/include/stdbool.h> |
| 3607 | |
| 3608 | =item * |
| 3609 | |
| 3610 | The following CPAN modules have test failures with perl 5.16. Patches have |
| 3611 | been submitted for all of these, so hopefully there will be new releases |
| 3612 | soon: |
| 3613 | |
| 3614 | =over |
| 3615 | |
| 3616 | =item * |
| 3617 | |
| 3618 | L<Date::Pcalc> version 6.1 |
| 3619 | |
| 3620 | =item * |
| 3621 | |
| 3622 | L<Module::CPANTS::Analyse> version 0.85 |
| 3623 | |
| 3624 | This fails due to problems in L<Module::Find> 0.10 and L<File::MMagic> |
| 3625 | 1.27. |
| 3626 | |
| 3627 | =item * |
| 3628 | |
| 3629 | L<PerlIO::Util> version 0.72 |
| 3630 | |
| 3631 | =back |
| 3632 | |
| 3633 | =back |
| 3634 | |
| 3635 | =head1 Acknowledgements |
| 3636 | |
| 3637 | XXX Generate this with: |
| 3638 | |
| 3639 | perl Porting/acknowledgements.pl v5.14.0..HEAD |
| 3640 | |
| 3641 | =head1 Reporting Bugs |
| 3642 | |
| 3643 | If you find what you think is a bug, you might check the articles |
| 3644 | recently posted to the comp.lang.perl.misc newsgroup and the perl |
| 3645 | bug database at L<http://rt.perl.org/perlbug/>. There may also be |
| 3646 | information at L<http://www.perl.org/>, the Perl Home Page. |
| 3647 | |
| 3648 | If you believe you have an unreported bug, please run the L<perlbug> |
| 3649 | program included with your release. Be sure to trim your bug down |
| 3650 | to a tiny but sufficient test case. Your bug report, along with the |
| 3651 | output of C<perl -V>, will be sent off to perlbug@perl.org to be |
| 3652 | analysed by the Perl porting team. |
| 3653 | |
| 3654 | If the bug you are reporting has security implications, which make it |
| 3655 | inappropriate to send to a publicly archived mailing list, then please |
| 3656 | send it to perl5-security-report@perl.org. This points to a closed |
| 3657 | subscription unarchived mailing list, which includes all the core |
| 3658 | committers, who will be able to help assess the impact of issues, figure |
| 3659 | out a resolution, and help co-ordinate the release of patches to |
| 3660 | mitigate or fix the problem across all platforms on which Perl is |
| 3661 | supported. Please only use this address for security issues in the Perl |
| 3662 | core, not for modules independently distributed on CPAN. |
| 3663 | |
| 3664 | =head1 SEE ALSO |
| 3665 | |
| 3666 | The F<Changes> file for an explanation of how to view exhaustive details |
| 3667 | on what changed. |
| 3668 | |
| 3669 | The F<INSTALL> file for how to build Perl. |
| 3670 | |
| 3671 | The F<README> file for general stuff. |
| 3672 | |
| 3673 | The F<Artistic> and F<Copying> files for copyright information. |
| 3674 | |
| 3675 | =cut |