X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperldelta.pod;h=46bd59b04f6f7d466d5d22d266bc72f9aa51bd93;hb=69cddaa00596e831c0492189df41823d75a1b069;hp=c99fe8b34f55d5055fdfbd51b2be8e11c745f58d;hpb=63a6ff3a1dc8d86edb4d8a7ec1548205e32a7114;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perldelta.pod b/pod/perldelta.pod index c99fe8b..46bd59b 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -27,17 +27,29 @@ might have symbol conflicts if you embed Perl in another application, just as in the 5.003 release. By default, binary compatibility is preserved at the expense of symbol table pollution. -=head2 Subroutine Parameters Are Not Autovivified +=head2 Subroutine arguments created only when they're modified -In Perl versions 5.002 and 5.003, array and hash elements used as -subroutine parameters were "autovivified"; that is, they were brought -into existence if they did not already exist. For example, calling -C would create C<$h{foo}> if it did not already exist, -causing C to become true and C to return -C<('foo')>. +In Perl 5.004, nonexistent array and hash elements used as subroutine +parameters are brought into existence only if they are actually +assigned to (via C<@_>). -Perl 5.004 returns to the pre-5.002 behavior of I autovivifying -array and hash elements used as subroutine parameters. +Earlier versions of Perl vary in their handling of such arguments. +Perl versions 5.002 and 5.003 always brought them into existence. +Perl versions 5.000, 5.001, and 5.002 brought them into existence only +if they were not the first argument (which was almost certainly a +bug). Earlier versions of Perl never brought them into existence. + +For example, given this code: + + undef @a; undef %a; + sub show { print $_[0] }; + sub change { $_[0]++ }; + show($a[2]); + change($a{b}); + +After this code executes in Perl 5.004, $a{b} exists but $a[2] does +not. In Perl 5.002 and 5.003, both $a{b} and $a[2] would have existed +(but $a[2]'s value would have been undefined). =head2 Fixed Parsing of $$, &$, etc. @@ -47,6 +59,13 @@ fixed. As a result, the string "$$0" is no longer equivalent to C<$$."0">, but rather to C<${$0}>. To get the old behavior, change "$$" followed by a digit to "${$}". +=head2 No Resetting of $. on Implicit Close + +The documentation for Perl 5.0 has always stated that C<$.> is I +reset when an already-open file handle is re-opened with no intervening +call to C. Due to a bug, perl versions 5.000 through 5.0003 +I reset C<$.> under that circumstance; Perl 5.004 does not. + =head2 Changes to Tainting Checks A bug in previous versions may have failed to detect some insecure @@ -64,6 +83,15 @@ application of opcode masks. The revised Safe module has a new API and is implemented using the new Opcode module. Please read the new Opcode and Safe documentation. +=head2 Embedding Improvements + +In older versions of Perl it was not possible to create more than one +Perl interpreter instance inside a single process without leaking like a +sieve and/or crashing. The bugs that caused this behavior have all been +fixed. However, you still must take care when embedding Perl in a C +program. See the updated perlembed manpage for tips on how to manage +your interpreters. + =head2 Internal Change: FileHandle Class Based on IO::* Classes File handles are now stored internally as type IO::Handle. The @@ -124,8 +152,8 @@ This now works. (e.g. C) =item flock -is now supported on more platforms, and prefers fcntl -to lockf when emulating. +is now supported on more platforms, prefers fcntl to lockf when +emulating, and always flushes before (un)locking. =item printf and sprintf @@ -251,6 +279,13 @@ string in some way. This change makes it practical to chain C matches together in conjunction with ordinary matches using the C<\G> zero-width assertion. See L and L. +=item C ignores whitespace before ?*+{} + +The C construct has always been intended to ignore all unescaped +whitespace. However, before Perl 5.004, whitespace had the effect of +esacping repeat modifier like "*" or "?". For example, C was +(mis)interpreted as C. This bug has been fixed in 5.004. + =item nested C closures work now Prior to the 5.004 release, nested anonymous functions didn't work @@ -283,7 +318,7 @@ are inherited by all other classes: =item isa(CLASS) -C returns I if its object is blessed into a sub-class of C +C returns I if its object is blessed into a subclass of C C is also exportable and can be called as a sub with two arguments. This allows the ability to check what a reference points to. Example: @@ -459,7 +494,7 @@ a fixed value are now inlined (e.g. C). Each unique hash key is only allocated once, no matter how many hashes have an entry with that key. So even if you have 100 copies of the -same hash, the hash keys never have to be re-allocated. +same hash, the hash keys never have to be reallocated. =head1 Pragmata @@ -739,15 +774,6 @@ access functions and macros if they wish to use C keys. These additions also make it feasible to manipulate Cs (hash entries), which can be more efficient. See L for details. -=item Embedding improvements - -In older versions of Perl it was not possible to create more than one -instance of a Perl interpreter inside the same process without leaking -like mad and/or crashing. The major bugs which caused this behavior -have been fixed, however, you still must take care when embedding Perl -in a C program. See the updated perlembed manpage for tips on how to -manage your interpreters. - =back =head1 Documentation Changes