X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperldelta.pod;h=4ec71c8eb55ae8e51be7af4b985d529df28c4289;hb=f4dad39ef1a76c1f6bbf6733d7c2ee209381be78;hp=cf6036ff026d6a0fff4a884a0b229631549625a5;hpb=2ae324a7ad5d4e616e757c311984fd86d5857ddd;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perldelta.pod b/pod/perldelta.pod index cf6036f..4ec71c8 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -1,1082 +1,27 @@ =head1 NAME -perldelta - what's new for perl5.004 +perldelta - what's new for perl5.005 =head1 DESCRIPTION -This document describes differences between the 5.003 release (as -documented in I, second edition--the Camel Book) and -this one. +This document describes differences between the 5.004 release and this one. -=head1 Supported Environments - -Perl5.004 builds out of the box on Unix, Plan9, LynxOS, VMS, OS/2, -QNX, and AmigaOS. +=head1 Incompatible Changes =head1 Core Changes -Most importantly, many bugs were fixed. See the F -file in the distribution for details. - -=head2 Compilation Option: Binary Compatibility With 5.003 - -There is a new Configure question that asks if you want to maintain -binary compatibility with Perl 5.003. If you choose binary -compatibility, you do not have to recompile your extensions, but you -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 - -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')>. - -Perl 5.004 returns to the pre-5.002 behavior of I autovivifying -array and hash elements used as subroutine parameters. - -=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 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 -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 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 - -It is now possible to build Perl with AT&T's sfio IO package -instead of stdio. See L for more details, and -the F file for how to use it. - -=head2 New and Changed Built-in Variables - -=over - -=item $^E - -Extended error message on some platforms. (Also known as -$EXTENDED_OS_ERROR if you C). - -=item $^H - -The current set of syntax checks enabled by C. See the -documentation of C for more details. Not actually new, but -newly documented. -Because it is intended for internal use by Perl core components, -there is no C long name for this variable. - -=item $^M - -By default, running out of memory it is not trappable. However, if -compiled for this, Perl may use the contents of C<$^M> as an emergency -pool after die()ing with this message. Suppose that your Perl were -compiled with -DEMERGENCY_SBRK and used Perl's malloc. Then - - $^M = 'a' x (1<<16); - -would allocate a 64K buffer for use when in emergency. -See the F file for information on how to enable this option. -As a disincentive to casual use of this advanced feature, -there is no C long name for this variable. - -=back - -=head2 New and Changed Built-in Functions - -=over - -=item delete on slices - -This now works. (e.g. C) - -=item flock - -is now supported on more platforms, and prefers fcntl -to lockf when emulating. - -=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 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; - -then C<%hash> will have at least 200 buckets allocated for it. These -buckets will be retained even if you do C<%hash = ()>; use C if you want to free the storage while C<%hash> is still in scope. -You can't shrink the number of buckets allocated for the hash using -C in this way (but you needn't worry about doing this by accident, -as trying has no effect). - -=item my() in Control Structures - -You can now use my() (with or without the parentheses) in the control -expressions of control structures such as: - - while (defined(my $line = <>)) { - $line = lc $line; - } continue { - print $line; - } - - if ((my $answer = ) =~ /^y(es)?$/i) { - user_agrees(); - } elsif ($answer =~ /^n(o)?$/i) { - user_disagrees(); - } else { - chomp $answer; - die "`$answer' is neither `yes' nor `no'"; - } - -Also, you can declare a foreach loop control variable as lexical by -preceding it with the word "my". For example, in: - - foreach my $i (1, 2, 3) { - some_function(); - } - -$i is a lexical variable, and the scope of $i extends to the end of -the loop, but not beyond it. - -Note that you still cannot use my() on global punctuation variables -such as $_ and the like. - -=item unpack() and pack() - -A new format 'w' represents a BER compressed integer (as defined in -ASN.1). Its format is a sequence of one or more bytes, each of which -provides seven bits of the total value, with the most significant -first. Bit eight of each byte is set, except for the last byte, in -which bit eight is clear. - -=item use VERSION - -If the first argument to C is a number, it is treated as a version -number instead of a module name. If the version of the Perl interpreter -is less than VERSION, then an error message is printed and Perl exits -immediately. Because C occurs at compile time, this check happens -immediately during the compilation process, unlike C, -which waits until run-time for the check. This is often useful if you -need to check the current Perl version before Cing library modules -which have changed in incompatible ways from older versions of Perl. -(We try not to do this more than we have to.) - -=item use Module VERSION LIST - -If the VERSION argument is present between Module and LIST, then the -C will call the VERSION method in class Module with the given -version as an argument. The default VERSION method, inherited from -the Universal class, croaks if the given version is larger than the -value of the variable $Module::VERSION. (Note that there is not a -comma after VERSION!) - -This version-checking mechanism is similar to the one currently used -in the Exporter module, but it is faster and can be used with modules -that don't use the Exporter. It is the recommended method for new -code. - -=item prototype(FUNCTION) - -Returns the prototype of a function as a string (or C if the -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