X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperldelta.pod;h=46bd59b04f6f7d466d5d22d266bc72f9aa51bd93;hb=69cddaa00596e831c0492189df41823d75a1b069;hp=04e9a45ab83cce7cab3a6ff23dd89ee6baf6f53e;hpb=0a753a764065f2260004b6e6975085378b850346;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 04e9a45..46bd59b 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -27,6 +27,55 @@ 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 arguments created only when they're modified + +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<@_>). + +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. + +A bug in previous versions of Perl 5.0 prevented proper parsing of +numeric special variables as symbolic references. That bug has been +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 +conditions when taint checks are turned on. (Taint checks are used +in setuid or setgid scripts, or when explicitly turned on with the +C<-T> invocation option.) Although it's unlikely, this may cause a +previously-working script to now fail -- which should be construed +as a blessing, since that indicates a potentially-serious security +hole was just plugged. + =head2 New Opcode Module and Revised Safe Module A new Opcode module supports the creation, manipulation and @@ -34,13 +83,25 @@ 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 Internal Change: FileHandle Deprecated +=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. -Filehandles are now stored internally as type IO::Handle. -Although C and C<*STDOUT{FILEHANDLE}> -are still supported for backwards compatibility, -C (or C or C) and -C<*STDOUT{IO}> are the way of the future. +=head2 Internal Change: FileHandle Class Based on IO::* Classes + +File handles are now stored internally as type IO::Handle. The +FileHandle module is still supported for backwards compatibility, but +it is now merely a front end to the IO::* modules -- specifically, +IO::Handle, IO::Seekable, and IO::File. We suggest, but do not +require, that you use the IO::* modules in new code. + +In harmony with this change, C<*GLOB{FILEHANDLE}> is now a +backward-compatible synonym for C<*STDOUT{IO}>. =head2 Internal Change: PerlIO internal IO abstraction interface @@ -54,8 +115,8 @@ the F file for how to use it. =item $^E -Extended error message under some platforms ($EXTENDED_OS_ERROR -if you C). +Extended error message on some platforms. (Also known as +$EXTENDED_OS_ERROR if you C). =item $^H @@ -91,16 +152,21 @@ 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 + +now support "%i" as a synonym for "%d", and the "h" modifier. +So "%hi" means "short integer in decimal", and "%ho" means +"unsigned short integer as octal". =item keys as an lvalue As an lvalue, C allows you to increase the number of hash buckets -allocated for the given associative array. This can gain you a measure -of efficiency if you know the hash is going to get big. (This is -similar to pre-extending an array by assigning a larger number to -$#array.) If you say +allocated for the given hash. This can gain you a measure of efficiency if +you know the hash is going to get big. (This is similar to pre-extending +an array by assigning a larger number to $#array.) If you say keys %hash = 200; @@ -116,7 +182,7 @@ as trying has no effect). You can now use my() (with or without the parentheses) in the control expressions of control structures such as: - while (my $line = <>) { + while (defined(my $line = <>)) { $line = lc $line; } continue { print $line; @@ -185,6 +251,19 @@ function has no prototype). FUNCTION is a reference to or the name of the function whose prototype you want to retrieve. (Not actually new; just never documented before.) +=item srand + +The default seed for C, which used to be C