1=encoding utf8 2 3=head1 NAME 4 5perl5100delta - what is new for perl 5.10.0 6 7=head1 DESCRIPTION 8 9This document describes the differences between the 5.8.8 release and 10the 5.10.0 release. 11 12Many of the bug fixes in 5.10.0 were already seen in the 5.8.X maintenance 13releases; they are not duplicated here and are documented in the set of 14man pages named perl58[1-8]?delta. 15 16=head1 Core Enhancements 17 18=head2 The C<feature> pragma 19 20The C<feature> pragma is used to enable new syntax that would break Perl's 21backwards-compatibility with older releases of the language. It's a lexical 22pragma, like C<strict> or C<warnings>. 23 24Currently the following new features are available: C<switch> (adds a 25switch statement), C<say> (adds a C<say> built-in function), and C<state> 26(adds a C<state> keyword for declaring "static" variables). Those 27features are described in their own sections of this document. 28 29The C<feature> pragma is also implicitly loaded when you require a minimal 30perl version (with the C<use VERSION> construct) greater than, or equal 31to, 5.9.5. See L<feature> for details. 32 33=head2 New B<-E> command-line switch 34 35B<-E> is equivalent to B<-e>, but it implicitly enables all 36optional features (like C<use feature ":5.10">). 37 38=head2 Defined-or operator 39 40A new operator C<//> (defined-or) has been implemented. 41The following expression: 42 43 $a // $b 44 45is merely equivalent to 46 47 defined $a ? $a : $b 48 49and the statement 50 51 $c //= $d; 52 53can now be used instead of 54 55 $c = $d unless defined $c; 56 57The C<//> operator has the same precedence and associativity as C<||>. 58Special care has been taken to ensure that this operator Do What You Mean 59while not breaking old code, but some edge cases involving the empty 60regular expression may now parse differently. See L<perlop> for 61details. 62 63=head2 Switch and Smart Match operator 64 65Perl 5 now has a switch statement. It's available when C<use feature 66'switch'> is in effect. This feature introduces three new keywords, 67C<given>, C<when>, and C<default>: 68 69 given ($foo) { 70 when (/^abc/) { $abc = 1; } 71 when (/^def/) { $def = 1; } 72 when (/^xyz/) { $xyz = 1; } 73 default { $nothing = 1; } 74 } 75 76A more complete description of how Perl matches the switch variable 77against the C<when> conditions is given in L<perlsyn/"Switch statements">. 78 79This kind of match is called I<smart match>, and it's also possible to use 80it outside of switch statements, via the new C<~~> operator. See 81L<perlsyn/"Smart matching in detail">. 82 83This feature was contributed by Robin Houston. 84 85=head2 Regular expressions 86 87=over 4 88 89=item Recursive Patterns 90 91It is now possible to write recursive patterns without using the C<(??{})> 92construct. This new way is more efficient, and in many cases easier to 93read. 94 95Each capturing parenthesis can now be treated as an independent pattern 96that can be entered by using the C<(?PARNO)> syntax (C<PARNO> standing for 97"parenthesis number"). For example, the following pattern will match 98nested balanced angle brackets: 99 100 / 101 ^ # start of line 102 ( # start capture buffer 1 103 < # match an opening angle bracket 104 (?: # match one of: 105 (?> # don't backtrack over the inside of this group 106 [^<>]+ # one or more non angle brackets 107 ) # end non backtracking group 108 | # ... or ... 109 (?1) # recurse to bracket 1 and try it again 110 )* # 0 or more times. 111 > # match a closing angle bracket 112 ) # end capture buffer one 113 $ # end of line 114 /x 115 116PCRE users should note that Perl's recursive regex feature allows 117backtracking into a recursed pattern, whereas in PCRE the recursion is 118atomic or "possessive" in nature. As in the example above, you can 119add (?>) to control this selectively. (Yves Orton) 120 121=item Named Capture Buffers 122 123It is now possible to name capturing parenthesis in a pattern and refer to 124the captured contents by name. The naming syntax is C<< (?<NAME>....) >>. 125It's possible to backreference to a named buffer with the C<< \k<NAME> >> 126syntax. In code, the new magical hashes C<%+> and C<%-> can be used to 127access the contents of the capture buffers. 128 129Thus, to replace all doubled chars with a single copy, one could write 130 131 s/(?<letter>.)\k<letter>/$+{letter}/g 132 133Only buffers with defined contents will be "visible" in the C<%+> hash, so 134it's possible to do something like 135 136 foreach my $name (keys %+) { 137 print "content of buffer '$name' is $+{$name}\n"; 138 } 139 140The C<%-> hash is a bit more complete, since it will contain array refs 141holding values from all capture buffers similarly named, if there should 142be many of them. 143 144C<%+> and C<%-> are implemented as tied hashes through the new module 145C<Tie::Hash::NamedCapture>. 146 147Users exposed to the .NET regex engine will find that the perl 148implementation differs in that the numerical ordering of the buffers 149is sequential, and not "unnamed first, then named". Thus in the pattern 150 151 /(A)(?<B>B)(C)(?<D>D)/ 152 153$1 will be 'A', $2 will be 'B', $3 will be 'C' and $4 will be 'D' and not 154$1 is 'A', $2 is 'C' and $3 is 'B' and $4 is 'D' that a .NET programmer 155would expect. This is considered a feature. :-) (Yves Orton) 156 157=item Possessive Quantifiers 158 159Perl now supports the "possessive quantifier" syntax of the "atomic match" 160pattern. Basically a possessive quantifier matches as much as it can and never 161gives any back. Thus it can be used to control backtracking. The syntax is 162similar to non-greedy matching, except instead of using a '?' as the modifier 163the '+' is used. Thus C<?+>, C<*+>, C<++>, C<{min,max}+> are now legal 164quantifiers. (Yves Orton) 165 166=item Backtracking control verbs 167 168The regex engine now supports a number of special-purpose backtrack 169control verbs: (*THEN), (*PRUNE), (*MARK), (*SKIP), (*COMMIT), (*FAIL) 170and (*ACCEPT). See L<perlre> for their descriptions. (Yves Orton) 171 172=item Relative backreferences 173 174A new syntax C<\g{N}> or C<\gN> where "N" is a decimal integer allows a 175safer form of back-reference notation as well as allowing relative 176backreferences. This should make it easier to generate and embed patterns 177that contain backreferences. See L<perlre/"Capture buffers">. (Yves Orton) 178 179=item C<\K> escape 180 181The functionality of Jeff Pinyan's module Regexp::Keep has been added to 182the core. In regular expressions you can now use the special escape C<\K> 183as a way to do something like floating length positive lookbehind. It is 184also useful in substitutions like: 185 186 s/(foo)bar/$1/g 187 188that can now be converted to 189 190 s/foo\Kbar//g 191 192which is much more efficient. (Yves Orton) 193 194=item Vertical and horizontal whitespace, and linebreak 195 196Regular expressions now recognize the C<\v> and C<\h> escapes that match 197vertical and horizontal whitespace, respectively. C<\V> and C<\H> 198logically match their complements. 199 200C<\R> matches a generic linebreak, that is, vertical whitespace, plus 201the multi-character sequence C<"\x0D\x0A">. 202 203=item Optional pre-match and post-match captures with the /p flag 204 205There is a new flag C</p> for regular expressions. Using this 206makes the engine preserve a copy of the part of the matched string before 207the matching substring to the new special variable C<${^PREMATCH}>, the 208part after the matching substring to C<${^POSTMATCH}>, and the matched 209substring itself to C<${^MATCH}>. 210 211Perl is still able to store these substrings to the special variables 212C<$`>, C<$'>, C<$&>, but using these variables anywhere in the program 213adds a penalty to all regular expression matches, whereas if you use 214the C</p> flag and the new special variables instead, you pay only for 215the regular expressions where the flag is used. 216 217For more detail on the new variables, see L<perlvar>; for the use of 218the regular expression flag, see L<perlop> and L<perlre>. 219 220=back 221 222=head2 C<say()> 223 224say() is a new built-in, only available when C<use feature 'say'> is in 225effect, that is similar to print(), but that implicitly appends a newline 226to the printed string. See L<perlfunc/say>. (Robin Houston) 227 228=head2 Lexical C<$_> 229 230The default variable C<$_> can now be lexicalized, by declaring it like 231any other lexical variable, with a simple 232 233 my $_; 234 235The operations that default on C<$_> will use the lexically-scoped 236version of C<$_> when it exists, instead of the global C<$_>. 237 238In a C<map> or a C<grep> block, if C<$_> was previously my'ed, then the 239C<$_> inside the block is lexical as well (and scoped to the block). 240 241In a scope where C<$_> has been lexicalized, you can still have access to 242the global version of C<$_> by using C<$::_>, or, more simply, by 243overriding the lexical declaration with C<our $_>. (Rafael Garcia-Suarez) 244 245=head2 The C<_> prototype 246 247A new prototype character has been added. C<_> is equivalent to C<$> but 248defaults to C<$_> if the corresponding argument isn't supplied (both C<$> 249and C<_> denote a scalar). Due to the optional nature of the argument, 250you can only use it at the end of a prototype, or before a semicolon. 251 252This has a small incompatible consequence: the prototype() function has 253been adjusted to return C<_> for some built-ins in appropriate cases (for 254example, C<prototype('CORE::rmdir')>). (Rafael Garcia-Suarez) 255 256=head2 UNITCHECK blocks 257 258C<UNITCHECK>, a new special code block has been introduced, in addition to 259C<BEGIN>, C<CHECK>, C<INIT> and C<END>. 260 261C<CHECK> and C<INIT> blocks, while useful for some specialized purposes, 262are always executed at the transition between the compilation and the 263execution of the main program, and thus are useless whenever code is 264loaded at runtime. On the other hand, C<UNITCHECK> blocks are executed 265just after the unit which defined them has been compiled. See L<perlmod> 266for more information. (Alex Gough) 267 268=head2 New Pragma, C<mro> 269 270A new pragma, C<mro> (for Method Resolution Order) has been added. It 271permits to switch, on a per-class basis, the algorithm that perl uses to 272find inherited methods in case of a multiple inheritance hierarchy. The 273default MRO hasn't changed (DFS, for Depth First Search). Another MRO is 274available: the C3 algorithm. See L<mro> for more information. 275(Brandon Black) 276 277Note that, due to changes in the implementation of class hierarchy search, 278code that used to undef the C<*ISA> glob will most probably break. Anyway, 279undef'ing C<*ISA> had the side-effect of removing the magic on the @ISA 280array and should not have been done in the first place. Also, the 281cache C<*::ISA::CACHE::> no longer exists; to force reset the @ISA cache, 282you now need to use the C<mro> API, or more simply to assign to @ISA 283(e.g. with C<@ISA = @ISA>). 284 285=head2 readdir() may return a "short filename" on Windows 286 287The readdir() function may return a "short filename" when the long 288filename contains characters outside the ANSI codepage. Similarly 289Cwd::cwd() may return a short directory name, and glob() may return short 290names as well. On the NTFS file system these short names can always be 291represented in the ANSI codepage. This will not be true for all other file 292system drivers; e.g. the FAT filesystem stores short filenames in the OEM 293codepage, so some files on FAT volumes remain inaccessible through the 294ANSI APIs. 295 296Similarly, $^X, @INC, and $ENV{PATH} are preprocessed at startup to make 297sure all paths are valid in the ANSI codepage (if possible). 298 299The Win32::GetLongPathName() function now returns the UTF-8 encoded 300correct long file name instead of using replacement characters to force 301the name into the ANSI codepage. The new Win32::GetANSIPathName() 302function can be used to turn a long pathname into a short one only if the 303long one cannot be represented in the ANSI codepage. 304 305Many other functions in the C<Win32> module have been improved to accept 306UTF-8 encoded arguments. Please see L<Win32> for details. 307 308=head2 readpipe() is now overridable 309 310The built-in function readpipe() is now overridable. Overriding it permits 311also to override its operator counterpart, C<qx//> (a.k.a. C<``>). 312Moreover, it now defaults to C<$_> if no argument is provided. (Rafael 313Garcia-Suarez) 314 315=head2 Default argument for readline() 316 317readline() now defaults to C<*ARGV> if no argument is provided. (Rafael 318Garcia-Suarez) 319 320=head2 state() variables 321 322A new class of variables has been introduced. State variables are similar 323to C<my> variables, but are declared with the C<state> keyword in place of 324C<my>. They're visible only in their lexical scope, but their value is 325persistent: unlike C<my> variables, they're not undefined at scope entry, 326but retain their previous value. (Rafael Garcia-Suarez, Nicholas Clark) 327 328To use state variables, one needs to enable them by using 329 330 use feature 'state'; 331 332or by using the C<-E> command-line switch in one-liners. 333See L<perlsub/"Persistent Private Variables">. 334 335=head2 Stacked filetest operators 336 337As a new form of syntactic sugar, it's now possible to stack up filetest 338operators. You can now write C<-f -w -x $file> in a row to mean 339C<-x $file && -w _ && -f _>. See L<perlfunc/-X>. 340 341=head2 UNIVERSAL::DOES() 342 343The C<UNIVERSAL> class has a new method, C<DOES()>. It has been added to 344solve semantic problems with the C<isa()> method. C<isa()> checks for 345inheritance, while C<DOES()> has been designed to be overridden when 346module authors use other types of relations between classes (in addition 347to inheritance). (chromatic) 348 349See L<< UNIVERSAL/"$obj->DOES( ROLE )" >>. 350 351=head2 Formats 352 353Formats were improved in several ways. A new field, C<^*>, can be used for 354variable-width, one-line-at-a-time text. Null characters are now handled 355correctly in picture lines. Using C<@#> and C<~~> together will now 356produce a compile-time error, as those format fields are incompatible. 357L<perlform> has been improved, and miscellaneous bugs fixed. 358 359=head2 Byte-order modifiers for pack() and unpack() 360 361There are two new byte-order modifiers, C<E<gt>> (big-endian) and C<E<lt>> 362(little-endian), that can be appended to most pack() and unpack() template 363characters and groups to force a certain byte-order for that type or group. 364See L<perlfunc/pack> and L<perlpacktut> for details. 365 366=head2 C<no VERSION> 367 368You can now use C<no> followed by a version number to specify that you 369want to use a version of perl older than the specified one. 370 371=head2 C<chdir>, C<chmod> and C<chown> on filehandles 372 373C<chdir>, C<chmod> and C<chown> can now work on filehandles as well as 374filenames, if the system supports respectively C<fchdir>, C<fchmod> and 375C<fchown>, thanks to a patch provided by Gisle Aas. 376 377=head2 OS groups 378 379C<$(> and C<$)> now return groups in the order where the OS returns them, 380thanks to Gisle Aas. This wasn't previously the case. 381 382=head2 Recursive sort subs 383 384You can now use recursive subroutines with sort(), thanks to Robin Houston. 385 386=head2 Exceptions in constant folding 387 388The constant folding routine is now wrapped in an exception handler, and 389if folding throws an exception (such as attempting to evaluate 0/0), perl 390now retains the current optree, rather than aborting the whole program. 391Without this change, programs would not compile if they had expressions that 392happened to generate exceptions, even though those expressions were in code 393that could never be reached at runtime. (Nicholas Clark, Dave Mitchell) 394 395=head2 Source filters in @INC 396 397It's possible to enhance the mechanism of subroutine hooks in @INC by 398adding a source filter on top of the filehandle opened and returned by the 399hook. This feature was planned a long time ago, but wasn't quite working 400until now. See L<perlfunc/require> for details. (Nicholas Clark) 401 402=head2 New internal variables 403 404=over 4 405 406=item C<${^RE_DEBUG_FLAGS}> 407 408This variable controls what debug flags are in effect for the regular 409expression engine when running under C<use re "debug">. See L<re> for 410details. 411 412=item C<${^CHILD_ERROR_NATIVE}> 413 414This variable gives the native status returned by the last pipe close, 415backtick command, successful call to wait() or waitpid(), or from the 416system() operator. See L<perlvar> for details. (Contributed by Gisle Aas.) 417 418=item C<${^RE_TRIE_MAXBUF}> 419 420See L</"Trie optimisation of literal string alternations">. 421 422=item C<${^WIN32_SLOPPY_STAT}> 423 424See L</"Sloppy stat on Windows">. 425 426=back 427 428=head2 Miscellaneous 429 430C<unpack()> now defaults to unpacking the C<$_> variable. 431 432C<mkdir()> without arguments now defaults to C<$_>. 433 434The internal dump output has been improved, so that non-printable characters 435such as newline and backspace are output in C<\x> notation, rather than 436octal. 437 438The B<-C> option can no longer be used on the C<#!> line. It wasn't 439working there anyway, since the standard streams are already set up 440at this point in the execution of the perl interpreter. You can use 441binmode() instead to get the desired behaviour. 442 443=head2 UCD 5.0.0 444 445The copy of the Unicode Character Database included in Perl 5 has 446been updated to version 5.0.0. 447 448=head2 MAD 449 450MAD, which stands for I<Miscellaneous Attribute Decoration>, is a 451still-in-development work leading to a Perl 5 to Perl 6 converter. To 452enable it, it's necessary to pass the argument C<-Dmad> to Configure. The 453obtained perl isn't binary compatible with a regular perl 5.10, and has 454space and speed penalties; moreover not all regression tests still pass 455with it. (Larry Wall, Nicholas Clark) 456 457=head2 kill() on Windows 458 459On Windows platforms, C<kill(-9, $pid)> now kills a process tree. 460(On Unix, this delivers the signal to all processes in the same process 461group.) 462 463=head1 Incompatible Changes 464 465=head2 Packing and UTF-8 strings 466 467The semantics of pack() and unpack() regarding UTF-8-encoded data has been 468changed. Processing is now by default character per character instead of 469byte per byte on the underlying encoding. Notably, code that used things 470like C<pack("a*", $string)> to see through the encoding of string will now 471simply get back the original $string. Packed strings can also get upgraded 472during processing when you store upgraded characters. You can get the old 473behaviour by using C<use bytes>. 474 475To be consistent with pack(), the C<C0> in unpack() templates indicates 476that the data is to be processed in character mode, i.e. character by 477character; on the contrary, C<U0> in unpack() indicates UTF-8 mode, where 478the packed string is processed in its UTF-8-encoded Unicode form on a byte 479by byte basis. This is reversed with regard to perl 5.8.X, but now consistent 480between pack() and unpack(). 481 482Moreover, C<C0> and C<U0> can also be used in pack() templates to specify 483respectively character and byte modes. 484 485C<C0> and C<U0> in the middle of a pack or unpack format now switch to the 486specified encoding mode, honoring parens grouping. Previously, parens were 487ignored. 488 489Also, there is a new pack() character format, C<W>, which is intended to 490replace the old C<C>. C<C> is kept for unsigned chars coded as bytes in 491the strings internal representation. C<W> represents unsigned (logical) 492character values, which can be greater than 255. It is therefore more 493robust when dealing with potentially UTF-8-encoded data (as C<C> will wrap 494values outside the range 0..255, and not respect the string encoding). 495 496In practice, that means that pack formats are now encoding-neutral, except 497C<C>. 498 499For consistency, C<A> in unpack() format now trims all Unicode whitespace 500from the end of the string. Before perl 5.9.2, it used to strip only the 501classical ASCII space characters. 502 503=head2 Byte/character count feature in unpack() 504 505A new unpack() template character, C<".">, returns the number of bytes or 506characters (depending on the selected encoding mode, see above) read so far. 507 508=head2 The C<$*> and C<$#> variables have been removed 509 510C<$*>, which was deprecated in favor of the C</s> and C</m> regexp 511modifiers, has been removed. 512 513The deprecated C<$#> variable (output format for numbers) has been 514removed. 515 516Two new severe warnings, C<$#/$* is no longer supported>, have been added. 517 518=head2 substr() lvalues are no longer fixed-length 519 520The lvalues returned by the three argument form of substr() used to be a 521"fixed length window" on the original string. In some cases this could 522cause surprising action at distance or other undefined behaviour. Now the 523length of the window adjusts itself to the length of the string assigned to 524it. 525 526=head2 Parsing of C<-f _> 527 528The identifier C<_> is now forced to be a bareword after a filetest 529operator. This solves a number of misparsing issues when a global C<_> 530subroutine is defined. 531 532=head2 C<:unique> 533 534The C<:unique> attribute has been made a no-op, since its current 535implementation was fundamentally flawed and not threadsafe. 536 537=head2 Effect of pragmas in eval 538 539The compile-time value of the C<%^H> hint variable can now propagate into 540eval("")uated code. This makes it more useful to implement lexical 541pragmas. 542 543As a side-effect of this, the overloaded-ness of constants now propagates 544into eval(""). 545 546=head2 chdir FOO 547 548A bareword argument to chdir() is now recognized as a file handle. 549Earlier releases interpreted the bareword as a directory name. 550(Gisle Aas) 551 552=head2 Handling of .pmc files 553 554An old feature of perl was that before C<require> or C<use> look for a 555file with a F<.pm> extension, they will first look for a similar filename 556with a F<.pmc> extension. If this file is found, it will be loaded in 557place of any potentially existing file ending in a F<.pm> extension. 558 559Previously, F<.pmc> files were loaded only if more recent than the 560matching F<.pm> file. Starting with 5.9.4, they'll be always loaded if 561they exist. 562 563=head2 $^V is now a C<version> object instead of a v-string 564 565$^V can still be used with the C<%vd> format in printf, but any 566character-level operations will now access the string representation 567of the C<version> object and not the ordinals of a v-string. 568Expressions like C<< substr($^V, 0, 2) >> or C<< split //, $^V >> 569no longer work and must be rewritten. 570 571=head2 @- and @+ in patterns 572 573The special arrays C<@-> and C<@+> are no longer interpolated in regular 574expressions. (Sadahiro Tomoyuki) 575 576=head2 $AUTOLOAD can now be tainted 577 578If you call a subroutine by a tainted name, and if it defers to an 579AUTOLOAD function, then $AUTOLOAD will be (correctly) tainted. 580(Rick Delaney) 581 582=head2 Tainting and printf 583 584When perl is run under taint mode, C<printf()> and C<sprintf()> will now 585reject any tainted format argument. (Rafael Garcia-Suarez) 586 587=head2 undef and signal handlers 588 589Undefining or deleting a signal handler via C<undef $SIG{FOO}> is now 590equivalent to setting it to C<'DEFAULT'>. (Rafael Garcia-Suarez) 591 592=head2 strictures and dereferencing in defined() 593 594C<use strict 'refs'> was ignoring taking a hard reference in an argument 595to defined(), as in : 596 597 use strict 'refs'; 598 my $x = 'foo'; 599 if (defined $$x) {...} 600 601This now correctly produces the run-time error C<Can't use string as a 602SCALAR ref while "strict refs" in use>. 603 604C<defined @$foo> and C<defined %$bar> are now also subject to C<strict 605'refs'> (that is, C<$foo> and C<$bar> shall be proper references there.) 606(C<defined(@foo)> and C<defined(%bar)> are discouraged constructs anyway.) 607(Nicholas Clark) 608 609=head2 C<(?p{})> has been removed 610 611The regular expression construct C<(?p{})>, which was deprecated in perl 6125.8, has been removed. Use C<(??{})> instead. (Rafael Garcia-Suarez) 613 614=head2 Pseudo-hashes have been removed 615 616Support for pseudo-hashes has been removed from Perl 5.9. (The C<fields> 617pragma remains here, but uses an alternate implementation.) 618 619=head2 Removal of the bytecode compiler and of perlcc 620 621C<perlcc>, the byteloader and the supporting modules (B::C, B::CC, 622B::Bytecode, etc.) are no longer distributed with the perl sources. Those 623experimental tools have never worked reliably, and, due to the lack of 624volunteers to keep them in line with the perl interpreter developments, it 625was decided to remove them instead of shipping a broken version of those. 626The last version of those modules can be found with perl 5.9.4. 627 628However the B compiler framework stays supported in the perl core, as with 629the more useful modules it has permitted (among others, B::Deparse and 630B::Concise). 631 632=head2 Removal of the JPL 633 634The JPL (Java-Perl Lingo) has been removed from the perl sources tarball. 635 636=head2 Recursive inheritance detected earlier 637 638Perl will now immediately throw an exception if you modify any package's 639C<@ISA> in such a way that it would cause recursive inheritance. 640 641Previously, the exception would not occur until Perl attempted to make 642use of the recursive inheritance while resolving a method or doing a 643C<$foo-E<gt>isa($bar)> lookup. 644 645=head2 warnings::enabled and warnings::warnif changed to favor users of modules 646 647The behaviour in 5.10.x favors the person using the module; 648The behaviour in 5.8.x favors the module writer; 649 650Assume the following code: 651 652 main calls Foo::Bar::baz() 653 Foo::Bar inherits from Foo::Base 654 Foo::Bar::baz() calls Foo::Base::_bazbaz() 655 Foo::Base::_bazbaz() calls: warnings::warnif('substr', 'some warning 656message'); 657 658On 5.8.x, the code warns when Foo::Bar contains C<use warnings;> 659It does not matter if Foo::Base or main have warnings enabled 660to disable the warning one has to modify Foo::Bar. 661 662On 5.10.0 and newer, the code warns when main contains C<use warnings;> 663It does not matter if Foo::Base or Foo::Bar have warnings enabled 664to disable the warning one has to modify main. 665 666=head2 Removal of C<package;> (C<package> without arguments) 667 668The C<package;> syntax that would let code switch out of any package (and thus 669require the use of either lexical or fully-qualified names) has been removed. 670Its semantics were never that clear and its implementation even less so. (It 671was previously deprecated in perl 5.8.0.) 672 673=head1 Modules and Pragmata 674 675=head2 Upgrading individual core modules 676 677Even more core modules are now also available separately through the 678CPAN. If you wish to update one of these modules, you don't need to 679wait for a new perl release. From within the cpan shell, running the 680'r' command will report on modules with upgrades available. See 681C<perldoc CPAN> for more information. 682 683=head2 Pragmata Changes 684 685=over 4 686 687=item C<feature> 688 689The new pragma C<feature> is used to enable new features that might break 690old code. See L</"The C<feature> pragma"> above. 691 692=item C<mro> 693 694This new pragma enables to change the algorithm used to resolve inherited 695methods. See L</"New Pragma, C<mro>"> above. 696 697=item Scoping of the C<sort> pragma 698 699The C<sort> pragma is now lexically scoped. Its effect used to be global. 700 701=item Scoping of C<bignum>, C<bigint>, C<bigrat> 702 703The three numeric pragmas C<bignum>, C<bigint> and C<bigrat> are now 704lexically scoped. (Tels) 705 706=item C<base> 707 708The C<base> pragma now warns if a class tries to inherit from itself. 709(Curtis "Ovid" Poe) 710 711=item C<strict> and C<warnings> 712 713C<strict> and C<warnings> will now complain loudly if they are loaded via 714incorrect casing (as in C<use Strict;>). (Johan Vromans) 715 716=item C<version> 717 718The C<version> module provides support for version objects. 719 720=item C<warnings> 721 722The C<warnings> pragma doesn't load C<Carp> anymore. That means that code 723that used C<Carp> routines without having loaded it at compile time might 724need to be adjusted; typically, the following (faulty) code won't work 725anymore, and will require parentheses to be added after the function name: 726 727 use warnings; 728 require Carp; 729 Carp::confess 'argh'; 730 731=item C<less> 732 733C<less> now does something useful (or at least it tries to). In fact, it 734has been turned into a lexical pragma. So, in your modules, you can now 735test whether your users have requested to use less CPU, or less memory, 736less magic, or maybe even less fat. See L<less> for more. (Joshua ben 737Jore) 738 739=back 740 741=head2 New modules 742 743=over 4 744 745=item * 746 747C<encoding::warnings>, by Audrey Tang, is a module to emit warnings 748whenever an ASCII character string containing high-bit bytes is implicitly 749converted into UTF-8. It's a lexical pragma since Perl 5.9.4; on older 750perls, its effect is global. 751 752=item * 753 754C<Module::CoreList>, by Richard Clamp, is a small handy module that tells 755you what versions of core modules ship with any versions of Perl 5. It 756comes with a command-line frontend, C<corelist>. 757 758=item * 759 760C<Math::BigInt::FastCalc> is an XS-enabled, and thus faster, version of 761C<Math::BigInt::Calc>. 762 763=item * 764 765C<Compress::Zlib> is an interface to the zlib compression library. It 766comes with a bundled version of zlib, so having a working zlib is not a 767prerequisite to install it. It's used by C<Archive::Tar> (see below). 768 769=item * 770 771C<IO::Zlib> is an C<IO::>-style interface to C<Compress::Zlib>. 772 773=item * 774 775C<Archive::Tar> is a module to manipulate C<tar> archives. 776 777=item * 778 779C<Digest::SHA> is a module used to calculate many types of SHA digests, 780has been included for SHA support in the CPAN module. 781 782=item * 783 784C<ExtUtils::CBuilder> and C<ExtUtils::ParseXS> have been added. 785 786=item * 787 788C<Hash::Util::FieldHash>, by Anno Siegel, has been added. This module 789provides support for I<field hashes>: hashes that maintain an association 790of a reference with a value, in a thread-safe garbage-collected way. 791Such hashes are useful to implement inside-out objects. 792 793=item * 794 795C<Module::Build>, by Ken Williams, has been added. It's an alternative to 796C<ExtUtils::MakeMaker> to build and install perl modules. 797 798=item * 799 800C<Module::Load>, by Jos Boumans, has been added. It provides a single 801interface to load Perl modules and F<.pl> files. 802 803=item * 804 805C<Module::Loaded>, by Jos Boumans, has been added. It's used to mark 806modules as loaded or unloaded. 807 808=item * 809 810C<Package::Constants>, by Jos Boumans, has been added. It's a simple 811helper to list all constants declared in a given package. 812 813=item * 814 815C<Win32API::File>, by Tye McQueen, has been added (for Windows builds). 816This module provides low-level access to Win32 system API calls for 817files/dirs. 818 819=item * 820 821C<Locale::Maketext::Simple>, needed by CPANPLUS, is a simple wrapper around 822C<Locale::Maketext::Lexicon>. Note that C<Locale::Maketext::Lexicon> isn't 823included in the perl core; the behaviour of C<Locale::Maketext::Simple> 824gracefully degrades when the later isn't present. 825 826=item * 827 828C<Params::Check> implements a generic input parsing/checking mechanism. It 829is used by CPANPLUS. 830 831=item * 832 833C<Term::UI> simplifies the task to ask questions at a terminal prompt. 834 835=item * 836 837C<Object::Accessor> provides an interface to create per-object accessors. 838 839=item * 840 841C<Module::Pluggable> is a simple framework to create modules that accept 842pluggable sub-modules. 843 844=item * 845 846C<Module::Load::Conditional> provides simple ways to query and possibly 847load installed modules. 848 849=item * 850 851C<Time::Piece> provides an object oriented interface to time functions, 852overriding the built-ins localtime() and gmtime(). 853 854=item * 855 856C<IPC::Cmd> helps to find and run external commands, possibly 857interactively. 858 859=item * 860 861C<File::Fetch> provide a simple generic file fetching mechanism. 862 863=item * 864 865C<Log::Message> and C<Log::Message::Simple> are used by the log facility 866of C<CPANPLUS>. 867 868=item * 869 870C<Archive::Extract> is a generic archive extraction mechanism 871for F<.tar> (plain, gzipped or bzipped) or F<.zip> files. 872 873=item * 874 875C<CPANPLUS> provides an API and a command-line tool to access the CPAN 876mirrors. 877 878=item * 879 880C<Pod::Escapes> provides utilities that are useful in decoding Pod 881EE<lt>...E<gt> sequences. 882 883=item * 884 885C<Pod::Simple> is now the backend for several of the Pod-related modules 886included with Perl. 887 888=back 889 890=head2 Selected Changes to Core Modules 891 892=over 4 893 894=item C<Attribute::Handlers> 895 896C<Attribute::Handlers> can now report the caller's file and line number. 897(David Feldman) 898 899All interpreted attributes are now passed as array references. (Damian 900Conway) 901 902=item C<B::Lint> 903 904C<B::Lint> is now based on C<Module::Pluggable>, and so can be extended 905with plugins. (Joshua ben Jore) 906 907=item C<B> 908 909It's now possible to access the lexical pragma hints (C<%^H>) by using the 910method B::COP::hints_hash(). It returns a C<B::RHE> object, which in turn 911can be used to get a hash reference via the method B::RHE::HASH(). (Joshua 912ben Jore) 913 914=item C<Thread> 915 916As the old 5005thread threading model has been removed, in favor of the 917ithreads scheme, the C<Thread> module is now a compatibility wrapper, to 918be used in old code only. It has been removed from the default list of 919dynamic extensions. 920 921=back 922 923=head1 Utility Changes 924 925=over 4 926 927=item perl -d 928 929The Perl debugger can now save all debugger commands for sourcing later; 930notably, it can now emulate stepping backwards, by restarting and 931rerunning all bar the last command from a saved command history. 932 933It can also display the parent inheritance tree of a given class, with the 934C<i> command. 935 936=item ptar 937 938C<ptar> is a pure perl implementation of C<tar> that comes with 939C<Archive::Tar>. 940 941=item ptardiff 942 943C<ptardiff> is a small utility used to generate a diff between the contents 944of a tar archive and a directory tree. Like C<ptar>, it comes with 945C<Archive::Tar>. 946 947=item shasum 948 949C<shasum> is a command-line utility, used to print or to check SHA 950digests. It comes with the new C<Digest::SHA> module. 951 952=item corelist 953 954The C<corelist> utility is now installed with perl (see L</"New modules"> 955above). 956 957=item h2ph and h2xs 958 959C<h2ph> and C<h2xs> have been made more robust with regard to 960"modern" C code. 961 962C<h2xs> implements a new option C<--use-xsloader> to force use of 963C<XSLoader> even in backwards compatible modules. 964 965The handling of authors' names that had apostrophes has been fixed. 966 967Any enums with negative values are now skipped. 968 969=item perlivp 970 971C<perlivp> no longer checks for F<*.ph> files by default. Use the new C<-a> 972option to run I<all> tests. 973 974=item find2perl 975 976C<find2perl> now assumes C<-print> as a default action. Previously, it 977needed to be specified explicitly. 978 979Several bugs have been fixed in C<find2perl>, regarding C<-exec> and 980C<-eval>. Also the options C<-path>, C<-ipath> and C<-iname> have been 981added. 982 983=item config_data 984 985C<config_data> is a new utility that comes with C<Module::Build>. It 986provides a command-line interface to the configuration of Perl modules 987that use Module::Build's framework of configurability (that is, 988C<*::ConfigData> modules that contain local configuration information for 989their parent modules.) 990 991=item cpanp 992 993C<cpanp>, the CPANPLUS shell, has been added. (C<cpanp-run-perl>, a 994helper for CPANPLUS operation, has been added too, but isn't intended for 995direct use). 996 997=item cpan2dist 998 999C<cpan2dist> is a new utility that comes with CPANPLUS. It's a tool to 1000create distributions (or packages) from CPAN modules. 1001 1002=item pod2html 1003 1004The output of C<pod2html> has been enhanced to be more customizable via 1005CSS. Some formatting problems were also corrected. (Jari Aalto) 1006 1007=back 1008 1009=head1 New Documentation 1010 1011The L<perlpragma> manpage documents how to write one's own lexical 1012pragmas in pure Perl (something that is possible starting with 5.9.4). 1013 1014The new L<perlglossary> manpage is a glossary of terms used in the Perl 1015documentation, technical and otherwise, kindly provided by O'Reilly Media, 1016Inc. 1017 1018The L<perlreguts> manpage, courtesy of Yves Orton, describes internals of the 1019Perl regular expression engine. 1020 1021The L<perlreapi> manpage describes the interface to the perl interpreter 1022used to write pluggable regular expression engines (by Ævar Arnfjörð 1023Bjarmason). 1024 1025The L<perlunitut> manpage is a tutorial for programming with Unicode and 1026string encodings in Perl, courtesy of Juerd Waalboer. 1027 1028A new manual page, L<perlunifaq> (the Perl Unicode FAQ), has been added 1029(Juerd Waalboer). 1030 1031The L<perlcommunity> manpage gives a description of the Perl community 1032on the Internet and in real life. (Edgar "Trizor" Bering) 1033 1034The L<CORE> manual page documents the C<CORE::> namespace. (Tels) 1035 1036The long-existing feature of C</(?{...})/> regexps setting C<$_> and pos() 1037is now documented. 1038 1039=head1 Performance Enhancements 1040 1041=head2 In-place sorting 1042 1043Sorting arrays in place (C<@a = sort @a>) is now optimized to avoid 1044making a temporary copy of the array. 1045 1046Likewise, C<reverse sort ...> is now optimized to sort in reverse, 1047avoiding the generation of a temporary intermediate list. 1048 1049=head2 Lexical array access 1050 1051Access to elements of lexical arrays via a numeric constant between 0 and 1052255 is now faster. (This used to be only the case for global arrays.) 1053 1054=head2 XS-assisted SWASHGET 1055 1056Some pure-perl code that perl was using to retrieve Unicode properties and 1057transliteration mappings has been reimplemented in XS. 1058 1059=head2 Constant subroutines 1060 1061The interpreter internals now support a far more memory efficient form of 1062inlineable constants. Storing a reference to a constant value in a symbol 1063table is equivalent to a full typeglob referencing a constant subroutine, 1064but using about 400 bytes less memory. This proxy constant subroutine is 1065automatically upgraded to a real typeglob with subroutine if necessary. 1066The approach taken is analogous to the existing space optimisation for 1067subroutine stub declarations, which are stored as plain scalars in place 1068of the full typeglob. 1069 1070Several of the core modules have been converted to use this feature for 1071their system dependent constants - as a result C<use POSIX;> now takes about 1072200K less memory. 1073 1074=head2 C<PERL_DONT_CREATE_GVSV> 1075 1076The new compilation flag C<PERL_DONT_CREATE_GVSV>, introduced as an option 1077in perl 5.8.8, is turned on by default in perl 5.9.3. It prevents perl 1078from creating an empty scalar with every new typeglob. See L<perl589delta> 1079for details. 1080 1081=head2 Weak references are cheaper 1082 1083Weak reference creation is now I<O(1)> rather than I<O(n)>, courtesy of 1084Nicholas Clark. Weak reference deletion remains I<O(n)>, but if deletion only 1085happens at program exit, it may be skipped completely. 1086 1087=head2 sort() enhancements 1088 1089Salvador Fandiño provided improvements to reduce the memory usage of C<sort> 1090and to speed up some cases. 1091 1092=head2 Memory optimisations 1093 1094Several internal data structures (typeglobs, GVs, CVs, formats) have been 1095restructured to use less memory. (Nicholas Clark) 1096 1097=head2 UTF-8 cache optimisation 1098 1099The UTF-8 caching code is now more efficient, and used more often. 1100(Nicholas Clark) 1101 1102=head2 Sloppy stat on Windows 1103 1104On Windows, perl's stat() function normally opens the file to determine 1105the link count and update attributes that may have been changed through 1106hard links. Setting ${^WIN32_SLOPPY_STAT} to a true value speeds up 1107stat() by not performing this operation. (Jan Dubois) 1108 1109=head2 Regular expressions optimisations 1110 1111=over 4 1112 1113=item Engine de-recursivised 1114 1115The regular expression engine is no longer recursive, meaning that 1116patterns that used to overflow the stack will either die with useful 1117explanations, or run to completion, which, since they were able to blow 1118the stack before, will likely take a very long time to happen. If you were 1119experiencing the occasional stack overflow (or segfault) and upgrade to 1120discover that now perl apparently hangs instead, look for a degenerate 1121regex. (Dave Mitchell) 1122 1123=item Single char char-classes treated as literals 1124 1125Classes of a single character are now treated the same as if the character 1126had been used as a literal, meaning that code that uses char-classes as an 1127escaping mechanism will see a speedup. (Yves Orton) 1128 1129=item Trie optimisation of literal string alternations 1130 1131Alternations, where possible, are optimised into more efficient matching 1132structures. String literal alternations are merged into a trie and are 1133matched simultaneously. This means that instead of O(N) time for matching 1134N alternations at a given point, the new code performs in O(1) time. 1135A new special variable, ${^RE_TRIE_MAXBUF}, has been added to fine-tune 1136this optimization. (Yves Orton) 1137 1138B<Note:> Much code exists that works around perl's historic poor 1139performance on alternations. Often the tricks used to do so will disable 1140the new optimisations. Hopefully the utility modules used for this purpose 1141will be educated about these new optimisations. 1142 1143=item Aho-Corasick start-point optimisation 1144 1145When a pattern starts with a trie-able alternation and there aren't 1146better optimisations available, the regex engine will use Aho-Corasick 1147matching to find the start point. (Yves Orton) 1148 1149=back 1150 1151=head1 Installation and Configuration Improvements 1152 1153=head2 Configuration improvements 1154 1155=over 4 1156 1157=item C<-Dusesitecustomize> 1158 1159Run-time customization of @INC can be enabled by passing the 1160C<-Dusesitecustomize> flag to Configure. When enabled, this will make perl 1161run F<$sitelibexp/sitecustomize.pl> before anything else. This script can 1162then be set up to add additional entries to @INC. 1163 1164=item Relocatable installations 1165 1166There is now Configure support for creating a relocatable perl tree. If 1167you Configure with C<-Duserelocatableinc>, then the paths in @INC (and 1168everything else in %Config) can be optionally located via the path of the 1169perl executable. 1170 1171That means that, if the string C<".../"> is found at the start of any 1172path, it's substituted with the directory of $^X. So, the relocation can 1173be configured on a per-directory basis, although the default with 1174C<-Duserelocatableinc> is that everything is relocated. The initial 1175install is done to the original configured prefix. 1176 1177=item strlcat() and strlcpy() 1178 1179The configuration process now detects whether strlcat() and strlcpy() are 1180available. When they are not available, perl's own version is used (from 1181Russ Allbery's public domain implementation). Various places in the perl 1182interpreter now use them. (Steve Peters) 1183 1184=item C<d_pseudofork> and C<d_printf_format_null> 1185 1186A new configuration variable, available as C<$Config{d_pseudofork}> in 1187the L<Config> module, has been added, to distinguish real fork() support 1188from fake pseudofork used on Windows platforms. 1189 1190A new configuration variable, C<d_printf_format_null>, has been added, 1191to see if printf-like formats are allowed to be NULL. 1192 1193=item Configure help 1194 1195C<Configure -h> has been extended with the most commonly used options. 1196 1197=back 1198 1199=head2 Compilation improvements 1200 1201=over 4 1202 1203=item Parallel build 1204 1205Parallel makes should work properly now, although there may still be problems 1206if C<make test> is instructed to run in parallel. 1207 1208=item Borland's compilers support 1209 1210Building with Borland's compilers on Win32 should work more smoothly. In 1211particular Steve Hay has worked to side step many warnings emitted by their 1212compilers and at least one C compiler internal error. 1213 1214=item Static build on Windows 1215 1216Perl extensions on Windows now can be statically built into the Perl DLL. 1217 1218Also, it's now possible to build a C<perl-static.exe> that doesn't depend 1219on the Perl DLL on Win32. See the Win32 makefiles for details. 1220(Vadim Konovalov) 1221 1222=item ppport.h files 1223 1224All F<ppport.h> files in the XS modules bundled with perl are now 1225autogenerated at build time. (Marcus Holland-Moritz) 1226 1227=item C++ compatibility 1228 1229Efforts have been made to make perl and the core XS modules compilable 1230with various C++ compilers (although the situation is not perfect with 1231some of the compilers on some of the platforms tested.) 1232 1233=item Support for Microsoft 64-bit compiler 1234 1235Support for building perl with Microsoft's 64-bit compiler has been 1236improved. (ActiveState) 1237 1238=item Visual C++ 1239 1240Perl can now be compiled with Microsoft Visual C++ 2005 (and 2008 Beta 2). 1241 1242=item Win32 builds 1243 1244All win32 builds (MS-Win, WinCE) have been merged and cleaned up. 1245 1246=back 1247 1248=head2 Installation improvements 1249 1250=over 4 1251 1252=item Module auxiliary files 1253 1254README files and changelogs for CPAN modules bundled with perl are no 1255longer installed. 1256 1257=back 1258 1259=head2 New Or Improved Platforms 1260 1261Perl has been reported to work on Symbian OS. See L<perlsymbian> for more 1262information. 1263 1264Many improvements have been made towards making Perl work correctly on 1265z/OS. 1266 1267Perl has been reported to work on DragonFlyBSD and MidnightBSD. 1268 1269Perl has also been reported to work on NexentaOS 1270( http://www.gnusolaris.org/ ). 1271 1272The VMS port has been improved. See L<perlvms>. 1273 1274Support for Cray XT4 Catamount/Qk has been added. See 1275F<hints/catamount.sh> in the source code distribution for more 1276information. 1277 1278Vendor patches have been merged for RedHat and Gentoo. 1279 1280DynaLoader::dl_unload_file() now works on Windows. 1281 1282=head1 Selected Bug Fixes 1283 1284=over 4 1285 1286=item strictures in regexp-eval blocks 1287 1288C<strict> wasn't in effect in regexp-eval blocks (C</(?{...})/>). 1289 1290=item Calling CORE::require() 1291 1292CORE::require() and CORE::do() were always parsed as require() and do() 1293when they were overridden. This is now fixed. 1294 1295=item Subscripts of slices 1296 1297You can now use a non-arrowed form for chained subscripts after a list 1298slice, like in: 1299 1300 ({foo => "bar"})[0]{foo} 1301 1302This used to be a syntax error; a C<< -> >> was required. 1303 1304=item C<no warnings 'category'> works correctly with -w 1305 1306Previously when running with warnings enabled globally via C<-w>, selective 1307disabling of specific warning categories would actually turn off all warnings. 1308This is now fixed; now C<no warnings 'io';> will only turn off warnings in the 1309C<io> class. Previously it would erroneously turn off all warnings. 1310 1311=item threads improvements 1312 1313Several memory leaks in ithreads were closed. Also, ithreads were made 1314less memory-intensive. 1315 1316C<threads> is now a dual-life module, also available on CPAN. It has been 1317expanded in many ways. A kill() method is available for thread signalling. 1318One can get thread status, or the list of running or joinable threads. 1319 1320A new C<< threads->exit() >> method is used to exit from the application 1321(this is the default for the main thread) or from the current thread only 1322(this is the default for all other threads). On the other hand, the exit() 1323built-in now always causes the whole application to terminate. (Jerry 1324D. Hedden) 1325 1326=item chr() and negative values 1327 1328chr() on a negative value now gives C<\x{FFFD}>, the Unicode replacement 1329character, unless when the C<bytes> pragma is in effect, where the low 1330eight bits of the value are used. 1331 1332=item PERL5SHELL and tainting 1333 1334On Windows, the PERL5SHELL environment variable is now checked for 1335taintedness. (Rafael Garcia-Suarez) 1336 1337=item Using *FILE{IO} 1338 1339C<stat()> and C<-X> filetests now treat *FILE{IO} filehandles like *FILE 1340filehandles. (Steve Peters) 1341 1342=item Overloading and reblessing 1343 1344Overloading now works when references are reblessed into another class. 1345Internally, this has been implemented by moving the flag for "overloading" 1346from the reference to the referent, which logically is where it should 1347always have been. (Nicholas Clark) 1348 1349=item Overloading and UTF-8 1350 1351A few bugs related to UTF-8 handling with objects that have 1352stringification overloaded have been fixed. (Nicholas Clark) 1353 1354=item eval memory leaks fixed 1355 1356Traditionally, C<eval 'syntax error'> has leaked badly. Many (but not all) 1357of these leaks have now been eliminated or reduced. (Dave Mitchell) 1358 1359=item Random device on Windows 1360 1361In previous versions, perl would read the file F</dev/urandom> if it 1362existed when seeding its random number generator. That file is unlikely 1363to exist on Windows, and if it did would probably not contain appropriate 1364data, so perl no longer tries to read it on Windows. (Alex Davies) 1365 1366=item PERLIO_DEBUG 1367 1368The C<PERLIO_DEBUG> environment variable no longer has any effect for 1369setuid scripts and for scripts run with B<-T>. 1370 1371Moreover, with a thread-enabled perl, using C<PERLIO_DEBUG> could lead to 1372an internal buffer overflow. This has been fixed. 1373 1374=item PerlIO::scalar and read-only scalars 1375 1376PerlIO::scalar will now prevent writing to read-only scalars. Moreover, 1377seek() is now supported with PerlIO::scalar-based filehandles, the 1378underlying string being zero-filled as needed. (Rafael, Jarkko Hietaniemi) 1379 1380=item study() and UTF-8 1381 1382study() never worked for UTF-8 strings, but could lead to false results. 1383It's now a no-op on UTF-8 data. (Yves Orton) 1384 1385=item Critical signals 1386 1387The signals SIGILL, SIGBUS and SIGSEGV are now always delivered in an 1388"unsafe" manner (contrary to other signals, that are deferred until the 1389perl interpreter reaches a reasonably stable state; see 1390L<perlipc/"Deferred Signals (Safe Signals)">). (Rafael) 1391 1392=item @INC-hook fix 1393 1394When a module or a file is loaded through an @INC-hook, and when this hook 1395has set a filename entry in %INC, __FILE__ is now set for this module 1396accordingly to the contents of that %INC entry. (Rafael) 1397 1398=item C<-t> switch fix 1399 1400The C<-w> and C<-t> switches can now be used together without messing 1401up which categories of warnings are activated. (Rafael) 1402 1403=item Duping UTF-8 filehandles 1404 1405Duping a filehandle which has the C<:utf8> PerlIO layer set will now 1406properly carry that layer on the duped filehandle. (Rafael) 1407 1408=item Localisation of hash elements 1409 1410Localizing a hash element whose key was given as a variable didn't work 1411correctly if the variable was changed while the local() was in effect (as 1412in C<local $h{$x}; ++$x>). (Bo Lindbergh) 1413 1414=back 1415 1416=head1 New or Changed Diagnostics 1417 1418=over 4 1419 1420=item Use of uninitialized value 1421 1422Perl will now try to tell you the name of the variable (if any) that was 1423undefined. 1424 1425=item Deprecated use of my() in false conditional 1426 1427A new deprecation warning, I<Deprecated use of my() in false conditional>, 1428has been added, to warn against the use of the dubious and deprecated 1429construct 1430 1431 my $x if 0; 1432 1433See L<perldiag>. Use C<state> variables instead. 1434 1435=item !=~ should be !~ 1436 1437A new warning, C<!=~ should be !~>, is emitted to prevent this misspelling 1438of the non-matching operator. 1439 1440=item Newline in left-justified string 1441 1442The warning I<Newline in left-justified string> has been removed. 1443 1444=item Too late for "-T" option 1445 1446The error I<Too late for "-T" option> has been reformulated to be more 1447descriptive. 1448 1449=item "%s" variable %s masks earlier declaration 1450 1451This warning is now emitted in more consistent cases; in short, when one 1452of the declarations involved is a C<my> variable: 1453 1454 my $x; my $x; # warns 1455 my $x; our $x; # warns 1456 our $x; my $x; # warns 1457 1458On the other hand, the following: 1459 1460 our $x; our $x; 1461 1462now gives a C<"our" variable %s redeclared> warning. 1463 1464=item readdir()/closedir()/etc. attempted on invalid dirhandle 1465 1466These new warnings are now emitted when a dirhandle is used but is 1467either closed or not really a dirhandle. 1468 1469=item Opening dirhandle/filehandle %s also as a file/directory 1470 1471Two deprecation warnings have been added: (Rafael) 1472 1473 Opening dirhandle %s also as a file 1474 Opening filehandle %s also as a directory 1475 1476=item Use of -P is deprecated 1477 1478Perl's command-line switch C<-P> is now deprecated. 1479 1480=item v-string in use/require is non-portable 1481 1482Perl will warn you against potential backwards compatibility problems with 1483the C<use VERSION> syntax. 1484 1485=item perl -V 1486 1487C<perl -V> has several improvements, making it more useable from shell 1488scripts to get the value of configuration variables. See L<perlrun> for 1489details. 1490 1491=back 1492 1493=head1 Changed Internals 1494 1495In general, the source code of perl has been refactored, tidied up, 1496and optimized in many places. Also, memory management and allocation 1497has been improved in several points. 1498 1499When compiling the perl core with gcc, as many gcc warning flags are 1500turned on as is possible on the platform. (This quest for cleanliness 1501doesn't extend to XS code because we cannot guarantee the tidiness of 1502code we didn't write.) Similar strictness flags have been added or 1503tightened for various other C compilers. 1504 1505=head2 Reordering of SVt_* constants 1506 1507The relative ordering of constants that define the various types of C<SV> 1508have changed; in particular, C<SVt_PVGV> has been moved before C<SVt_PVLV>, 1509C<SVt_PVAV>, C<SVt_PVHV> and C<SVt_PVCV>. This is unlikely to make any 1510difference unless you have code that explicitly makes assumptions about that 1511ordering. (The inheritance hierarchy of C<B::*> objects has been changed 1512to reflect this.) 1513 1514=head2 Elimination of SVt_PVBM 1515 1516Related to this, the internal type C<SVt_PVBM> has been removed. This 1517dedicated type of C<SV> was used by the C<index> operator and parts of the 1518regexp engine to facilitate fast Boyer-Moore matches. Its use internally has 1519been replaced by C<SV>s of type C<SVt_PVGV>. 1520 1521=head2 New type SVt_BIND 1522 1523A new type C<SVt_BIND> has been added, in readiness for the project to 1524implement Perl 6 on 5. There deliberately is no implementation yet, and 1525they cannot yet be created or destroyed. 1526 1527=head2 Removal of CPP symbols 1528 1529The C preprocessor symbols C<PERL_PM_APIVERSION> and 1530C<PERL_XS_APIVERSION>, which were supposed to give the version number of 1531the oldest perl binary-compatible (resp. source-compatible) with the 1532present one, were not used, and sometimes had misleading values. They have 1533been removed. 1534 1535=head2 Less space is used by ops 1536 1537The C<BASEOP> structure now uses less space. The C<op_seq> field has been 1538removed and replaced by a single bit bit-field C<op_opt>. C<op_type> is now 9 1539bits long. (Consequently, the C<B::OP> class doesn't provide an C<seq> 1540method anymore.) 1541 1542=head2 New parser 1543 1544perl's parser is now generated by bison (it used to be generated by 1545byacc.) As a result, it seems to be a bit more robust. 1546 1547Also, Dave Mitchell improved the lexer debugging output under C<-DT>. 1548 1549=head2 Use of C<const> 1550 1551Andy Lester supplied many improvements to determine which function 1552parameters and local variables could actually be declared C<const> to the C 1553compiler. Steve Peters provided new C<*_set> macros and reworked the core to 1554use these rather than assigning to macros in LVALUE context. 1555 1556=head2 Mathoms 1557 1558A new file, F<mathoms.c>, has been added. It contains functions that are 1559no longer used in the perl core, but that remain available for binary or 1560source compatibility reasons. However, those functions will not be 1561compiled in if you add C<-DNO_MATHOMS> in the compiler flags. 1562 1563=head2 C<AvFLAGS> has been removed 1564 1565The C<AvFLAGS> macro has been removed. 1566 1567=head2 C<av_*> changes 1568 1569The C<av_*()> functions, used to manipulate arrays, no longer accept null 1570C<AV*> parameters. 1571 1572=head2 $^H and %^H 1573 1574The implementation of the special variables $^H and %^H has changed, to 1575allow implementing lexical pragmas in pure Perl. 1576 1577=head2 B:: modules inheritance changed 1578 1579The inheritance hierarchy of C<B::> modules has changed; C<B::NV> now 1580inherits from C<B::SV> (it used to inherit from C<B::IV>). 1581 1582=head2 Anonymous hash and array constructors 1583 1584The anonymous hash and array constructors now take 1 op in the optree 1585instead of 3, now that pp_anonhash and pp_anonlist return a reference to 1586a hash/array when the op is flagged with OPf_SPECIAL. (Nicholas Clark) 1587 1588=head1 Known Problems 1589 1590There's still a remaining problem in the implementation of the lexical 1591C<$_>: it doesn't work inside C</(?{...})/> blocks. (See the TODO test in 1592F<t/op/mydef.t>.) 1593 1594Stacked filetest operators won't work when the C<filetest> pragma is in 1595effect, because they rely on the stat() buffer C<_> being populated, and 1596filetest bypasses stat(). 1597 1598=head2 UTF-8 problems 1599 1600The handling of Unicode still is unclean in several places, where it's 1601dependent on whether a string is internally flagged as UTF-8. This will 1602be made more consistent in perl 5.12, but that won't be possible without 1603a certain amount of backwards incompatibility. 1604 1605=head1 Platform Specific Problems 1606 1607When compiled with g++ and thread support on Linux, it's reported that the 1608C<$!> stops working correctly. This is related to the fact that the glibc 1609provides two strerror_r(3) implementation, and perl selects the wrong 1610one. 1611 1612=head1 Reporting Bugs 1613 1614If you find what you think is a bug, you might check the articles 1615recently posted to the comp.lang.perl.misc newsgroup and the perl 1616bug database at http://rt.perl.org/rt3/ . There may also be 1617information at http://www.perl.org/ , the Perl Home Page. 1618 1619If you believe you have an unreported bug, please run the B<perlbug> 1620program included with your release. Be sure to trim your bug down 1621to a tiny but sufficient test case. Your bug report, along with the 1622output of C<perl -V>, will be sent off to perlbug@perl.org to be 1623analysed by the Perl porting team. 1624 1625=head1 SEE ALSO 1626 1627The F<Changes> file and the perl590delta to perl595delta man pages for 1628exhaustive details on what changed. 1629 1630The F<INSTALL> file for how to build Perl. 1631 1632The F<README> file for general stuff. 1633 1634The F<Artistic> and F<Copying> files for copyright information. 1635 1636=cut 1637