X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperldelta.pod;h=d3fbae5b87b232c2dc1eb3ea07fdf2d286a6b256;hb=0a92e3a8032b83483524fad83a5e76cf0cf6aa8d;hp=08c0a2d0660ec865458581fcc82ac2bebfa334ef;hpb=833d3f255ed68b969f062cec63d33f853ed9237c;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 08c0a2d..d3fbae5 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -1,1001 +1,666 @@ =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 +[XXX this needs more verbose summaries of the sub topics, instead of just +the "See foo." Scheduled for a second iteration. GSAR] -Perl5.004 builds out of the box on Unix, Plan9, LynxOS, VMS, OS/2, -QNX, and AmigaOS. +=head1 About the new versioning system -=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 +=head1 Incompatible Changes -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 WARNING: This version is not binary compatible with Perl 5.004. -=head2 New Opcode Module and Revised Safe Module +Starting with Perl 5.004_50 there were many deep and far-reaching changes +to the language internals. If you have dynamically loaded extensions +that you built under perl 5.003 or 5.004, you can continue to use them +with 5.004, but you will need to rebuild and reinstall those extensions +to use them 5.005. See L for detailed instructions on how to +upgrade. -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 Default installation structure has changed -=head2 Internal Change: FileHandle Deprecated +The new Configure defaults are designed to allow a smooth upgrade from +5.004 to 5.005, but you should read L for a detailed +discussion of the changes in order to adapt them to your system. -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 Perl Source Compatibility -=head2 Internal Change: PerlIO internal IO abstraction interface +When none of the experimental features are enabled, there should be +no user-visible Perl source compatibility issue. -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 +If threads are enabled, then some caveats apply. C<@_> and C<$_> become +lexical variables. The effect of this should be largely transparent to +the user, but there are some boundary conditions under which user will +need to be aware of the issues. [XXX Add e.g. here.] -=item $^E +Some new keywords have been introduced. These are generally expected to +have very little impact on compatibility. See L keyword>, +L keyword>, and L operator>. -Extended error message on some platforms. (Also known as -$EXTENDED_OS_ERROR if you C). +Certain barewords are now reserved. Use of these will provoke a warning +if you have asked for them with the C<-w> switch. +See L is now a reserved word>. -=item $^H +=head2 C Source Compatibility -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 Core sources now require ANSI C compiler -=item $^M +=item Enabling threads has source compatibility issues -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 +=head2 Binary Compatibility - $^M = 'a' x (1<<16); +This version is NOT binary compatible with older versions. All extensions +will need to be recompiled. -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 +=head2 Security fixes may affect compatibility -=item delete on slices +A few taint leaks and taint omissions have been corrected. This may lead +to "failure" of scripts that used to work with older versions. Compiling +with -DINCOMPLETE_TAINTS provides a perl with minimal amounts of changes +to the tainting behavior. But note that the resulting perl will have +known insecurities. -This now works. (e.g. C) +Oneliners with the C<-e> switch do not create temporary files anymore. -=item flock +=head2 Relaxed new mandatory warnings introduced in 5.004 -is now supported on more platforms, and prefers fcntl -to lockf when emulating. +Many new warnings that were introduced in 5.004 have been made +optional. Some of these warnings are still present, but perl's new +features make them less often a problem. See L. -=item printf and sprintf +=head2 Licensing -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". +Perl has a new Social Contract for contributors. See F. -=item keys as an lvalue +The license included in much of the Perl documentation has changed. +[XXX See where?] -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 +=head1 Core Changes - 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). +=head2 Threads -=item my() in Control Structures +WARNING: Threading is considered an experimental feature. Details of the +implementation may change without notice. There are known limitations +and and some bugs. -You can now use my() (with or without the parentheses) in the control -expressions of control structures such as: +See L. - while (my $line = <>) { - $line = lc $line; - } continue { - print $line; - } +=head2 Compiler - 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'"; - } +WARNING: The Compiler and related tools are considered experimental. +Features may change without notice, and there are known limitations +and bugs. -Also, you can declare a foreach loop control variable as lexical by -preceding it with the word "my". For example, in: +The Compiler produces three different types of transformations of a +perl program. The C backend generates C code that captures perl's state +just before execution begins. It eliminates the compile-time overheads +of the regular perl interpreter, but the run-time performance remains +comparatively the same. The CC backend generates optimized C code +equivivalent to the code path at run-time. The CC backend has greater +potential for big optimizations, but only a few optimizations are +implemented currently. The Bytecode backend generates a platform +independent bytecode representation of the interpreter's state +just before execution. Thus, the Bytecode back end also eliminates +much of the compilation overhead of the interpreter. - foreach my $i (1, 2, 3) { - some_function(); - } +The compiler comes with several valuable utilities. -$i is a lexical variable, and the scope of $i extends to the end of -the loop, but not beyond it. +C is an experimental module to detect and warn about suspicious +code, especially the cases that the C<-w> switch does not detect. -Note that you still cannot use my() on global punctuation variables -such as $_ and the like. +C can be used to demystify perl code, and understand +how perl optimizes certain constructs. -=item unpack() and pack() +C generates cross reference reports of all definition and use +of variables, subroutines and formats in a program. -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. +C show the lexical variables used by a subroutine or file +at a glance. -=item use VERSION +C is a simple frontend for compiling perl. -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.) +See C. -=item use Module VERSION LIST +=head2 Regular Expressions -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!) +See L and L. -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. +=head2 Improved malloc() -=item prototype(FUNCTION) +See banner at the beginning of C for details. -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.) +=head2 Quicksort is internally implemented -=item $_ as Default +See C. -Functions documented in the Camel to default to $_ now in -fact do, and all those that do are so documented in L. - -=item C does not trigger a pos() reset on failure - -The C match iteration construct used to reset the iteration -when it failed to match (so that the next C match would start at -the beginning of the string). You now have to explicitly do a -C to reset the "last match" position, or modify the -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 nested C closures work now - -Prior to the 5.004 release, nested anonymous functions -didn't work right. They do now. - -=item formats work right on changing lexicals - -Just like anonymous functions that contain lexical variables -that change (like a lexical index variable for a C loop), -formats now work properly. For example, this silently failed -before, and is fine now: - - my $i; - foreach $i ( 1 .. 10 ) { - format = - my i is @# - $i - . - write; - } +=head2 Reliable signals -=back +Two kinds. -=head2 New Built-in Methods +Via C. -The C package automatically contains the following methods that -are inherited by all other classes: +Via switched runtime op loop. [XXX Not yet available.] -=over +=head2 Reliable stack pointers -=item isa(CLASS) +The internals now reallocate the perl stack only at predictable times. +In particular, magic calls never trigger reallocations of the stack, +because all reentrancy of the runtime is handled using a "stack of stacks". +This should improve reliability of cached stack pointers in the internals +and in XSUBs. -C returns I if its object is blessed into a sub-class of C +=head2 Behavior of local() on composites is now well-defined -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: +See L. - use UNIVERSAL qw(isa); +=head2 C<%!> is transparently tied to the L module - if(isa($ref, 'ARRAY')) { - ... - } +See L, and L. -=item can(METHOD) +=head2 Pseudo-hashes are supported -C checks to see if its object has a method called C, -if it does then a reference to the sub is returned; if it does not then -I is returned. +See L. -=item VERSION( [NEED] ) +=head2 C is supported -C returns the version number of the class (package). If the -NEED argument is given then it will check that the current version (as -defined by the $VERSION variable in the given package) not less than -NEED; it will die if this is not the case. This method is normally -called as a class method. This method is called automatically by the -C form of C. +See L. - use A 1.2 qw(some imported subs); - # implies: - A->VERSION(1.2); +=head2 Slice notation on glob elements is supported -=back +[XXX See what?] -B C directly uses Perl's internal code for method lookup, and -C uses a very similar method and caching strategy. This may cause -strange effects if the Perl code dynamically changes @ISA in any package. +=head2 Keywords can be globally overridden -You may add other methods to the UNIVERSAL class via Perl or XS code. -You do not need to C in order to make these methods -available to your program. This is necessary only if you wish to -have C available as a plain subroutine in the current package. +See L. -=head2 TIEHANDLE Now Supported +=head2 C<$^E> is meaningful on Win32 -See L for other kinds of tie()s. +See L. -=over +=head2 C optimized -=item TIEHANDLE classname, LIST +C is now optimized into a counting loop. It does +not try to allocate a 1000000-size list anymore. -This is the constructor for the class. That means it is expected to -return an object of some sort. The reference can be used to -hold some internal information. +=head2 C can be used as implicitly quoted package name - sub TIEHANDLE { - print "\n"; - my $i; - return bless \$i, shift; - } +[XXX See what?] -=item PRINT this, LIST +=head2 C tests existence of a package -This method will be triggered every time the tied handle is printed to. -Beyond its self reference it also expects the list that was passed to -the print function. +[XXX See what?] - sub PRINT { - $r = shift; - $$r++; - return print join( $, => map {uc} @_), $\; - } +=head2 Better locale support -=item READLINE this +See L. -This method will be called when the handle is read from. The method -should return undef when there is no more data. +=head2 Experimental support for 64-bit platforms - sub READLINE { - $r = shift; - return "PRINT called $$r times\n"; - } +Perl5 has always had 64-bit support on systems with 64-bit longs. +Starting with 5.005, the beginnings of experimental support for systems +with 32-bit long and 64-bit 'long long' integers has been added. +If you add -DUSE_LONG_LONG to your ccflags in config.sh (or manually +define it in perl.h) then perl will be built with 'long long' support. +There will be many compiler warnings, and the resultant perl may not +work on all systems. There are many other issues related to +third-party extensions and libraries. This option exists to allow +people to work on those issues. -=item DESTROY this +=head2 prototype() returns useful results on builtins -As with the other types of ties, this method will be called when the -tied handle is about to be destroyed. This is useful for debugging and -possibly for cleaning up. +See L. - sub DESTROY { - print "\n"; - } +=head2 Extended support for exception handling -=back +C now accepts a reference value, and C<$@> gets set to that +value in exception traps. This makes it possible to propagate +exception objects. See L. [XXX there's nothing +about this in perlfunc/eval yet.] -=head2 Efficiency Enhancements +=head2 Re-blessing in DESTROY() supported for chaining DESTROY() methods -All hash keys with the same string are only allocated once, so -even if you have 100 copies of the same hash, the immutable keys -never have to be re-allocated. +See L. -Functions that have an empty prototype and that do nothing but return -a fixed value are now inlined (e.g. C). +=head2 All C format conversions are handled internally -=head2 Malloc Enhancements +See L. -If perl's malloc() is used, you can require memory statistics at -runtime by running perl thusly: +=head2 New C keyword - env PERL_DEBUG_MSTATS=2 perl your_script_here +C subs are like C and C, but they get run just before +the perl runtime begins execution. e.g., the Perl Compiler makes use of +C blocks to initialize and resolve pointers to XSUBs. -The value of 2 means that the statistics is required after the -compilation and on exit, if value is 1 the statistics is printed on -exit only. (If you want the statistics at an arbitrary time, you need -to install an optional module Devel::Peek.) +[XXX Needs to be documented in perlsub or perlmod.] -Three new flags are recognized by malloc.c. (They have no effect if -perl is compiled with system malloc().) +=head2 New C keyword -=over +The C keyword is the fundamental synchronization primitive +in threaded perl. When threads are not enabled, it is currently a noop. -=item B<-D>C +To minimize impact on source compatibility this keyword is "weak", i.e., any +user-defined subroutine of the same name overrides it, unless a C +has been seen. -If defined, running out of memory may be not a fatal error if a memory -pool is allocated by assigning to variable $^M, see L<"$^M">. +=head2 New C operator -=item B<-D>C +The C operator, which is syntactically similar to the other quote-like +operators, is used to create precompiled regular expressions. This compiled +form can now be explicitly passed around in variables, and interpolated in +other regular expressions. See L. -Perl memory allocation is by bucket with sizes close to powers of -two. Because of these malloc overhead may be big, especially for data -of size exactly a power of two. If C is defined, perl -uses a slightly different algorithm for small allocations (up to 64 -bytes long), which makes it possible to have overhead down to 1 byte -for allocations which are powers of two (and appear quite often). +=head2 C is now a reserved word -Expected memory savings (with 8-byte alignment in C) are -circa 20% for typical Perl usage. Expected slowdown due to additional -malloc overhead is in fractions of percent (hard to measure, because -of the effect of saved memory on speed). +=head2 Tied arrays are now fully supported -=item B<-D>C +See L. -Similarly to C, this improves allocations of data with -size close ot power of two, only it works for big allocations -(starting with 16K by default). Such allocations are typical for big -hashes and special-purpose scripts, say, image processing. +=head2 Tied handles support is better -On young systems the fact that perl requires 2M from system for 1M -allocation will not affect the speed, since the tail of such a chunk -is not going to be touched, however, this may affect the maximal -number of allocations (unless the system overcommits memory). +Several missing hooks have been added. There is also a new base class for +TIEARRAY implementations. See L. -Expected saving of memory is 0-100% (100% in applications which -require most memory in such 2**n chunks), expected slowdown -negligible. +=head2 4th argument to substr -=back +substr() can now both return and replace in one operation. The optional +4th argument is the replacement string. See L. -=head1 Pragmata +=head2 Negative LENGTH argument to splice -Four new pragmatic modules exist: +Splice() with a negative LENGTH argument now work similar to what the +LENGTH did for substr(). Previously a negative LENGTH was treated as +0. See L. -=over -=item use blib +=head1 Supported Platforms -=item use blib 'dir' +Configure has many incremental improvements. Site-wide policy for building +perl can now be made persistent, via Policy.sh. Configure also records +the command-line arguments used in F. -Looks for MakeMaker-like I<'blib'> directory structure starting in -I (or current directory) and working back up to five levels of -parent directories. +=head2 New Platforms -Intended for use on command line with B<-M> option as a way of testing -arbitrary scripts against an uninstalled version of a package. +BeOS is now supported. See L. -=item use locale +DOS is now supported under the DJGPP tools. See L. -Tells the compiler to enable (or disable) the use of POSIX locales for -built-in operations. +MPE/iX is now supported. See L. -When C is in effect, the current LC_CTYPE locale is used -for regular expressions and case mapping; LC_COLLATE for string -ordering; and LC_NUMERIC for numeric formating in printf and sprintf -(but B in print). LC_NUMERIC is always used in write, since -lexical scoping of formats is problematic at best. +=head2 Changes in existing support -Each C or C affects statements to the end of -the enclosing BLOCK or, if not inside a BLOCK, to the end of the -current file. Locales can be switched and queried with -POSIX::setlocale(). +Win32 support has been vastly enhanced. Support for Perl Object, a C++ +encapsulation of Perl. GCC and EGCS are now supported on Win32. +[XXX Perl Object needs a big explanation elsewhere, and a pointer to +that location here.] -See L for more information. +VMS configuration system has been rewritten. See L. -=item use ops +OpenBSD better supported. [XXX what others?] -Disable unsafe opcodes, or any named opcodes, when compiling Perl code. +=head1 Modules and Pragmata -=item use vmsish +=head2 New Modules -Enable VMS-specific language features. Currently, there are three -VMS-specific feature available: 'status', which makes C<$?> and -C return genuine VMS status values instead of emulating POSIX; -'exit', which makes C take a genuine VMS status value instead of -assuming that C is an error; and 'time', which makes all times -relative to the local time zone, in the VMS tradition. +=over -=back +=item B -=head1 Modules +Perl compiler and tools. See [XXX what?]. -=head2 Installation Directories +=item Data::Dumper -The I script now places the Perl source files for -extensions in the architecture-specific library directory, which is -where the shared libraries for extensions have always been. This -change is intended to allow administrators to keep the Perl 5.004 -library directory unchanged from a previous version, without running -the risk of binary incompatibility between extensions' Perl source and -shared libraries. +A module to pretty print Perl data. See L. -=head2 Fcntl +=item Errno -New constants in the existing Fcntl modules are now supported, -provided that your operating system happens to support them: +A module to look up errors more conveniently. See L. - F_GETOWN F_SETOWN - O_ASYNC O_DEFER O_DSYNC O_FSYNC O_SYNC - O_EXLOCK O_SHLOCK +=item File::Spec -These constants are intended for use with the Perl operators sysopen() -and fcntl() and the basic database modules like SDBM_File. For the -exact meaning of these and other Fcntl constants please refer to your -operating system's documentation for fcntl() and open(). +A portable API for file operations. -In addition, the Fcntl module now provides these constants for use -with the Perl operator flock(): +=item ExtUtils::Installed - LOCK_SH LOCK_EX LOCK_NB LOCK_UN +Query and manage installed modules. -These constants are defined in all environments (because where there is -no flock() system call, Perl emulates it). However, for historical -reasons, these constants are not exported unless they are explicitly -requested with the ":flock" tag (e.g. C). +=item ExtUtils::Packlist -=head2 Module Information Summary +Manipulate .packlist files. -Brand new modules, arranged by topic rather than strictly -alphabetically: +=item Fatal - CPAN interface to Comprehensive Perl Archive Network - CPAN::FirstTime create a CPAN configuration file - CPAN::Nox run CPAN while avoiding compiled extensions +Make functions/builtins succeed or die. - IO.pm Top-level interface to IO::* classes - IO/File.pm IO::File extension Perl module - IO/Handle.pm IO::Handle extension Perl module - IO/Pipe.pm IO::Pipe extension Perl module - IO/Seekable.pm IO::Seekable extension Perl module - IO/Select.pm IO::Select extension Perl module - IO/Socket.pm IO::Socket extension Perl module +=item IPC::SysV - Opcode.pm Disable named opcodes when compiling Perl code +Constants and other support infrastructure for System V IPC operations +in perl. - ExtUtils/Embed.pm Utilities for embedding Perl in C programs - ExtUtils/testlib.pm Fixes up @INC to use just-built extension +=item Test - FindBin.pm Find path of currently executing program +A framework for writing testsuites. - Class/Template.pm Structure/member template builder - File/stat.pm Object-oriented wrapper around CORE::stat - Net/hostent.pm Object-oriented wrapper around CORE::gethost* - Net/netent.pm Object-oriented wrapper around CORE::getnet* - Net/protoent.pm Object-oriented wrapper around CORE::getproto* - Net/servent.pm Object-oriented wrapper around CORE::getserv* - Time/gmtime.pm Object-oriented wrapper around CORE::gmtime - Time/localtime.pm Object-oriented wrapper around CORE::localtime - Time/tm.pm Perl implementation of "struct tm" for {gm,local}time - User/grent.pm Object-oriented wrapper around CORE::getgr* - User/pwent.pm Object-oriented wrapper around CORE::getpw* +=item Tie::Array - Tie/RefHash.pm Base class for tied hashes with references as keys +Base class for tied arrays. - UNIVERSAL.pm Base class for *ALL* classes +=item Tie::Handle -=head2 IO +Base class for tied handles. -The IO module provides a simple mechanism to load all of the IO modules at one -go. Currently this includes: +=item Thread - IO::Handle - IO::Seekable - IO::File - IO::Pipe - IO::Socket +Perl thread creation, manipulation, and support. -For more information on any of these modules, please see its -respective documentation. +=item attrs -=head2 Math::Complex +Set subroutine attributes. -The Math::Complex module has been totally rewritten, and now supports -more operations. These are overloaded: +=item fields - + - * / ** <=> neg ~ abs sqrt exp log sin cos atan2 "" (stringify) +Compile-time class fields. -And these functions are now exported: +=item re - pi i Re Im arg - log10 logn cbrt root - tan cotan asin acos atan acotan - sinh cosh tanh cotanh asinh acosh atanh acotanh - cplx cplxe +Various pragmata to control behavior of regular expressions. -=head2 DB_File +=back -There have been quite a few changes made to DB_File. Here are a few of -the highlights: +=head2 Changes in existing modules =over -=item * - -Fixed a handful of bugs. +=item CGI -=item * +CGI has been updated to version 2.42. -By public demand, added support for the standard hash function exists(). +=item POSIX -=item * +POSIX now has its own platform-specific hints files. -Made it compatible with Berkeley DB 1.86. +=item DB_File -=item * +DB_File supports version 2.x of Berkeley DB. See C. -Made negative subscripts work with RECNO interface. +=item MakeMaker -=item * +MakeMaker now supports writing empty makefiles, provides a way to +specify that site umask() policy should be honored. There is also +better support for manipulation of .packlist files, and getting +information about installed modules. -Changed the default flags from O_RDWR to O_CREAT|O_RDWR and the default -mode from 0640 to 0666. +Extensions that have both architecture-dependent and +architecture-independent files are now always installed completely in +the architecture-dependent locations. Previously, the shareable parts +were shared both across architectures and across perl versions and were +therefore liable to be overwritten with newer versions that might have +subtle incompatibilities. -=item * +=item CPAN -Made DB_File automatically import the open() constants (O_RDWR, -O_CREAT etc.) from Fcntl, if available. +[XXX What?] -=item * - -Updated documentation. - -=back +=item Cwd -Refer to the HISTORY section in DB_File.pm for a complete list of -changes. Everything after DB_File 1.01 has been added since 5.003. +Cwd::cwd is faster on most platforms. -=head2 Net::Ping +=item Benchmark -Major rewrite - support added for both udp echo and real icmp pings. +Keeps better time. -=head2 Overridden Built-ins - -Many of the Perl built-ins returning lists now have -object-oriented overrides. These are: - - File::stat - Net::hostent - Net::netent - Net::protoent - Net::servent - Time::gmtime - Time::localtime - User::grent - User::pwent - -For example, you can now say - - use File::stat; - use User::pwent; - $his = (stat($filename)->st_uid == pwent($whoever)->pw_uid); +=back =head1 Utility Changes -=head2 xsubpp +h2ph and related utilities have been vastly overhauled. -=over - -=item C XSUBs now default to returning nothing - -Due to a documentation/implementation bug in previous versions of -Perl, XSUBs with a return type of C have actually been -returning one value. Usually that value was the GV for the XSUB, -but sometimes it was some already freed or reused value, which would -sometimes lead to program failure. - -In Perl 5.004, if an XSUB is declared as returning C, it -actually returns no value, i.e. an empty list (though there is a -backward-compatibility exception; see below). If your XSUB really -does return an SV, you should give it a return type of C. - -For backward compatibility, I tries to guess whether a -C XSUB is really C or if it wants to return an C. -It does so by examining the text of the XSUB: if I finds -what looks like an assignment to C, it assumes that the -XSUB's return type is really C. +perlcc, a new experimental front end for the compiler is available. -=back - -=head1 C Language API Changes +The crude GNU configure emulator is now called configure.gnu. -=over +=head1 API Changes -=item C and C +=head2 Incompatible Changes -The C function finds a method for an object, just like -in Perl 5.003. The GV it returns may be a method cache entry. -However, in Perl 5.004, method cache entries are not visible to users; -therefore, they can no longer be passed directly to C. -Instead, you should use the C macro on the GV to extract its CV, -and pass the CV to C. +=head2 Deprecations, Extensions -The most likely symptom of passing the result of C to -C is Perl's producing an "Undefined subroutine called" -error on the I call to a given method (since there is no cache -on the first call). - -=back +=head2 C++ Support =head1 Documentation Changes -Many of the base and library pods were updated. These -new pods are included in section 1: +Config.pm now has a glossary of variables. -=over - -=item L - -This document. - -=item L - -Locale support (internationalization and localization). - -=item L - -Tutorial on Perl OO programming. - -=item L - -Perl internal IO abstraction interface. - -=item L - -Although not new, this has been massively updated. - -=item L - -Although not new, this has been massively updated. - -=back +Porting/patching.pod has detailed instructions on how to create and +submit patches for perl. =head1 New Diagnostics -Several new conditions will trigger warnings that were -silent before. Some only affect certain platforms. -The following new warnings and errors outline these. -These messages are classified as follows (listed in -increasing order of desperation): - - (W) A warning (optional). - (D) A deprecation (optional). - (S) A severe warning (mandatory). - (F) A fatal error (trappable). - (P) An internal error you should never see (trappable). - (X) A very fatal error (non-trappable). - (A) An alien error message (not generated by Perl). - =over -=item "my" variable %s masks earlier declaration in same scope - -(S) A lexical variable has been redeclared in the same scope, effectively -eliminating all access to the previous instance. This is almost always -a typographical error. Note that the earlier variable will still exist -until the end of the scope or until all closure referents to it are -destroyed. - -=item %s argument is not a HASH element or slice - -(F) The argument to delete() must be either a hash element, such as - - $foo{$bar} - $ref->[12]->{"susie"} +=item Ambiguous call resolved as CORE::%s(), qualify as such or use & -or a hash slice, such as +(W) A subroutine you have declared has the same name as a Perl keyword, +and you have used the name without qualification for calling one or the +other. Perl decided to call the builtin because the subroutine is +not imported. - @foo{$bar, $baz, $xyzzy} - @{$ref->[12]}{"susie", "queue"} +To force interpretation as a subroutine call, either put an ampersand +before the subroutine name, or qualify the name with its package. +Alternatively, you can import the subroutine (or pretend that it's +imported with the C pragma). -=item Allocation too large: %lx +To silently interpret it as the Perl operator, use the C prefix +on the operator (e.g. C) or by declaring the subroutine +to be an object method (see L). -(X) You can't allocate more than 64K on an MSDOS machine. +=item Bad index while coercing array into hash -=item Allocation too large +(F) The index looked up in the hash found as the 0'th element of a +pseudo-hash is not legal. Index values must be at 1 or greater. +See L. -(F) You can't allocate more than 2^31+"small amount" bytes. +=item Bareword "%s" refers to nonexistent package -=item Attempt to free non-existent shared string +(W) You used a qualified bareword of the form C, but +the compiler saw no other uses of that namespace before that point. +Perhaps you need to predeclare a package? -(P) Perl maintains a reference counted internal table of strings to -optimize the storage and access of hash keys and other strings. This -indicates someone tried to decrement the reference count of a string -that can no longer be found in the table. +=item Can't call method "%s" on an undefined value -=item Attempt to use reference as lvalue in substr +(F) You used the syntax of a method call, but the slot filled by the +object reference or package name contains an undefined value. +Something like this will reproduce the error: -(W) You supplied a reference as the first argument to substr() used -as an lvalue, which is pretty strange. Perhaps you forgot to -dereference it first. See L. + $BADREF = 42; + process $BADREF 1,2,3; + $BADREF->process(1,2,3); -=item Unsupported function fork +=item Can't coerce array into hash -(F) Your version of executable does not support forking. +(F) You used an array where a hash was expected, but the array has no +information on how to map from keys to array indices. You can do that +only with arrays that have a hash reference at index 0. -Note that under some systems, like OS/2, there may be different flavors of -Perl executables, some of which may support fork, some not. Try changing -the name you call Perl by to C, C, and so on. +=item Can't goto subroutine from an eval-string -=item Ill-formed logical name |%s| in prime_env_iter +(F) The "goto subroutine" call can't be used to jump out of an eval "string". +(You can use it to jump out of an eval {BLOCK}, but you probably don't want to.) -(W) A warning peculiar to VMS. A logical name was encountered when preparing -to iterate over %ENV which violates the syntactic rules governing logical -names. Since it cannot be translated normally, it is skipped, and will not -appear in %ENV. This may be a benign occurrence, as some software packages -might directly modify logical name tables and introduce non-standard names, -or it may indicate that a logical name table has been corrupted. +=item Can't use %%! because Errno.pm is not available -=item Can't use bareword ("%s") as %s ref while "strict refs" in use +(F) The first time the %! hash is used, perl automatically loads the +Errno.pm module. The Errno module is expected to tie the %! hash to +provide symbolic names for C<$!> errno values. -(F) Only hard references are allowed by "strict refs". Symbolic references -are disallowed. See L. +=item Cannot find an opnumber for "%s" -=item Constant subroutine %s redefined +(F) A string of a form C was given to prototype(), but +there is no builtin with the name C. -(S) You redefined a subroutine which had previously been eligible for -inlining. See L for commentary and -workarounds. +=item Character class syntax [. .] is reserved for future extensions -=item Died +(W) Within regular expression character classes ([]) the syntax beginning +with "[." and ending with ".]" is reserved for future extensions. +If you need to represent those character sequences inside a regular +expression character class, just quote the square brackets with the +backslash: "\[." and ".\]". -(F) You passed die() an empty string (the equivalent of C) or -you called it with no args and both C<$@> and C<$_> were empty. +=item Character class syntax [: :] is reserved for future extensions -=item Integer overflow in hex number +(W) Within regular expression character classes ([]) the syntax beginning +with "[:" and ending with ":]" is reserved for future extensions. +If you need to represent those character sequences inside a regular +expression character class, just quote the square brackets with the +backslash: "\[:" and ":\]". -(S) The literal hex number you have specified is too big for your -architecture. On a 32-bit architecture the largest hex literal is -0xFFFFFFFF. +=item Character class syntax [= =] is reserved for future extensions -=item Integer overflow in octal number +(W) Within regular expression character classes ([]) the syntax +beginning with "[=" and ending with "=]" is reserved for future extensions. +If you need to represent those character sequences inside a regular +expression character class, just quote the square brackets with the +backslash: "\[=" and "=\]". -(S) The literal octal number you have specified is too big for your -architecture. On a 32-bit architecture the largest octal literal is -037777777777. +=item %s: Eval-group in insecure regular expression -=item Name "%s::%s" used only once: possible typo +(F) Perl detected tainted data when trying to compile a regular expression +that contains the C<(?{ ... })> zero-width assertion, which is unsafe. +See L, and L. -(W) Typographical errors often show up as unique variable names. -If you had a good reason for having a unique name, then just mention -it again somehow to suppress the message (the C pragma is -provided for just this purpose). +=item %s: Eval-group not allowed, use re 'eval' -=item Null picture in formline +(F) A regular expression contained the C<(?{ ... })> zero-width assertion, +but that construct is only allowed when the C pragma is +in effect. See L. -(F) The first argument to formline must be a valid format picture -specification. It was found to be empty, which probably means you -supplied it an uninitialized value. See L. +=item %s: Eval-group not allowed at run time -=item Offset outside string +(F) Perl tried to compile a regular expression containing the C<(?{ ... })> +zero-width assertion at run time, as it would when the pattern contains +interpolated values. Since that is a security risk, it is not allowed. +If you insist, you may still do this by explicitly building the pattern +from an interpolated string at run time and using that in an eval(). +See L. -(F) You tried to do a read/write/send/recv operation with an offset -pointing outside the buffer. This is difficult to imagine. -The sole exception to this is that Cing past the buffer -will extend the buffer and zero pad the new area. +=item Explicit blessing to '' (assuming package main) -=item Stub found while resolving method `%s' overloading `%s' in package `%s' +(W) You are blessing a reference to a zero length string. This has +the effect of blessing the reference into the package main. This is +usually not what you want. Consider providing a default target +package, e.g. bless($ref, $p or 'MyPackage'); -(P) Overloading resolution over @ISA tree may be broken by importing stubs. -Stubs should never be implicitely created, but explicit calls to C -may break this. +=item Illegal hex digit ignored -=item Cannot resolve method `%s' overloading `%s' in package `s' +(W) You may have tried to use a character other than 0 - 9 or A - F in a +hexadecimal number. Interpretation of the hexadecimal number stopped +before the illegal character. -(P) Internal error trying to resolve overloading specified by a method -name (as opposed to a subroutine reference). +=item No such array field -=item Out of memory! +(F) You tried to access an array as a hash, but the field name used is +not defined. The hash at index 0 should map all valid field names to +array indices for that to work. -(X|F) The malloc() function returned 0, indicating there was insufficient -remaining memory (or virtual memory) to satisfy the request. +=item No such field "%s" in variable %s of type %s -The request was judged to be small, so the possibility to trap it -depends on the way Perl was compiled. By default 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. In this case the -error is trappable I. +(F) You tried to access a field of a typed variable where the type +does not know about the field name. The field names are looked up in +the %FIELDS hash in the type package at compile time. The %FIELDS hash +is usually set up with the 'fields' pragma. -=item Out of memory during request for %s +=item Out of memory during ridiculously large request -(F) The malloc() function returned 0, indicating there was insufficient -remaining memory (or virtual memory) to satisfy the request. However, -the request was judged large enough (compile-time default is 64K), so -a possibility to shut down by trapping this error is granted. +(F) You can't allocate more than 2^31+"small amount" bytes. This error +is most likely to be caused by a typo in the Perl program. e.g., C<$arr[time]> +instead of C<$arr[$time]>. -=item Possible attempt to put comments in qw() list +=item Range iterator outside integer range -(W) qw() lists contain items separated by whitespace; as with literal -strings, comment characters are not ignored, but are instead treated -as literal data. (You may have used different delimiters than the -exclamation marks parentheses shown here; braces are also frequently -used.) +(F) One (or both) of the numeric arguments to the range operator ".." +are outside the range which can be represented by integers internally. +One possible workaround is to force Perl to use magical string +increment by prepending "0" to your numbers. -You probably wrote something like this: +=item Recursive inheritance detected while looking for method '%s' in package '%s' - @list = qw( - a # a comment - b # another comment - ); +(F) More than 100 levels of inheritance were encountered while invoking a +method. Probably indicates an unintended loop in your inheritance hierarchy. -when you should have written this: +=item Reference found where even-sized list expected - @list = qw( - a - b - ); +(W) You gave a single reference where Perl was expecting a list with +an even number of elements (for assignment to a hash). This +usually means that you used the anon hash constructor when you meant +to use parens. In any case, a hash requires key/value B. -If you really want comments, build your list the -old-fashioned way, with quotes and commas: + %hash = { one => 1, two => 2, }; # WRONG + %hash = [ qw/ an anon array / ]; # WRONG + %hash = ( one => 1, two => 2, ); # right + %hash = qw( one 1 two 2 ); # also fine - @list = ( - 'a', # a comment - 'b', # another comment - ); +=item Undefined value assigned to typeglob -=item Possible attempt to separate words with commas +(W) An undefined value was assigned to a typeglob, a la C<*foo = undef>. +This does nothing. It's possible that you really mean C. -(W) qw() lists contain items separated by whitespace; therefore commas -aren't needed to separate the items. (You may have used different -delimiters than the parentheses shown here; braces are also frequently -used.) +=item Use of reserved word "%s" is deprecated -You probably wrote something like this: +(D) The indicated bareword is a reserved word. Future versions of perl +may use it as a keyword, so you're better off either explicitly quoting +the word in a manner appropriate for its context of use, or using a +different name altogether. The warning can be suppressed for subroutine +names by either adding a C<&> prefix, or using a package qualifier, +e.g. C<&our()>, or C. - qw! a, b, c !; +=item perl: warning: Setting locale failed. -which puts literal commas into some of the list items. Write it without -commas if you don't want them to appear in your data: +(S) The whole warning message will look something like: - qw! a b c !; + perl: warning: Setting locale failed. + perl: warning: Please check that your locale settings: + LC_ALL = "En_US", + LANG = (unset) + are supported and installed on your system. + perl: warning: Falling back to the standard locale ("C"). -=item Scalar value @%s{%s} better written as $%s{%s} +Exactly what were the failed locale settings varies. In the above the +settings were that the LC_ALL was "En_US" and the LANG had no value. +This error means that Perl detected that you and/or your system +administrator have set up the so-called variable system but Perl could +not use those settings. This was not dead serious, fortunately: there +is a "default locale" called "C" that Perl can and will use, the +script will be run. Before you really fix the problem, however, you +will get the same error message each time you run Perl. How to really +fix the problem can be found in L section B. -(W) You've used a hash slice (indicated by @) to select a single element of -a hash. Generally it's better to ask for a scalar value (indicated by $). -The difference is that C<$foo{&bar}> always behaves like a scalar, both when -assigning to it and when evaluating its argument, while C<@foo{&bar}> behaves -like a list when you assign to it, and provides a list context to its -subscript, which can do weird things if you're expecting only one subscript. - -=item untie attempted while %d inner references still exist - -(W) A copy of the object returned from C (or C) was still -valid when C was called. - -=item Value of %s construct can be "0"; test with defined() - -(W) In a conditional expression, you used , <*> (glob), or -C as a boolean value. Each of these constructs can return a -value of "0"; that would make the conditional expression false, which -is probably not what you intended. When using these constructs in -conditional expressions, test their values with the C operator. - -=item Variable "%s" may be unavailable - -(W) An inner (nested) I subroutine is inside a I -subroutine, and outside that is another subroutine; and the anonymous -(innermost) subroutine is referencing a lexical variable defined in -the outermost subroutine. For example: - - sub outermost { my $a; sub middle { sub { $a } } } - -If the anonymous subroutine is called or referenced (directly or -indirectly) from the outermost subroutine, it will share the variable -as you would expect. But if the anonymous subroutine is called or -referenced when the outermost subroutine is not active, it will see -the value of the shared variable as it was before and during the -*first* call to the outermost subroutine, which is probably not what -you want. - -In these circumstances, it is usually best to make the middle -subroutine anonymous, using the C syntax. Perl has specific -support for shared variables in nested anonymous subroutines; a named -subroutine in between interferes with this feature. - -=item Variable "%s" will not stay shared - -(W) An inner (nested) I subroutine is referencing a lexical -variable defined in an outer subroutine. - -When the inner subroutine is called, it will probably see the value of -the outer subroutine's variable as it was before and during the -*first* call to the outer subroutine; in this case, after the first -call to the outer subroutine is complete, the inner and outer -subroutines will no longer share a common value for the variable. In -other words, the variable will no longer be shared. - -Furthermore, if the outer subroutine is anonymous and references a -lexical variable outside itself, then the outer and inner subroutines -will I share the given variable. - -This problem can usually be solved by making the inner subroutine -anonymous, using the C syntax. When inner anonymous subs that -reference variables in outer subroutines are called or referenced, -they are automatically re-bound to the current values of such -variables. - -=item Warning: something's wrong - -(W) You passed warn() an empty string (the equivalent of C) or -you called it with no args and C<$_> was empty. - -=item Got an error from DosAllocMem - -(P) An error peculiar to OS/2. Most probably you're using an obsolete -version of Perl, and this should not happen anyway. +=back -=item Malformed PERLLIB_PREFIX -(F) An error peculiar to OS/2. PERLLIB_PREFIX should be of the form +=head1 Obsolete Diagnostics - prefix1;prefix2 +=over -or +=item Can't mktemp() - prefix1 prefix2 +(F) The mktemp() routine failed for some reason while trying to process +a B<-e> switch. Maybe your /tmp partition is full, or clobbered. -with non-empty prefix1 and prefix2. If C is indeed a prefix of -a builtin library search path, prefix2 is substituted. The error may appear -if components are not found, or are too long. See L. +=item Can't write to temp file for B<-e>: %s -=item PERL_SH_DIR too long +(F) The write routine failed for some reason while trying to process +a B<-e> switch. Maybe your /tmp partition is full, or clobbered. -(F) An error peculiar to OS/2. PERL_SH_DIR is the directory to find the -C-shell in. See L. +=item Cannot open temporary file -=item Process terminated by SIG%s +(F) The create routine failed for some reason while trying to process +a B<-e> switch. Maybe your /tmp partition is full, or clobbered. -(W) This is a standard message issued by OS/2 applications, while *nix -applications die in silence. It is considered a feature of the OS/2 -port. One can easily disable this by appropriate sighandlers, see -L. See L. =back @@ -1007,27 +672,21 @@ There may also be information at http://www.perl.com/perl/, the Perl Home Page. If you believe you have an unreported bug, please run the B -program included with your release. Make sure you trim your bug -down to a tiny but sufficient test case. Your bug report, along -with the output of C, will be sent off to perlbug@perl.com -to be analysed by the Perl porting team. +program included with your release. Make sure you trim your bug down +to a tiny but sufficient test case. Your bug report, along with the +output of C, will be sent off to > to be +analysed by the Perl porting team. =head1 SEE ALSO The F file for exhaustive details on what changed. -The F file for how to build Perl. This file has been -significantly updated for 5.004, so even veteran users should -look through it. +The F file for how to build Perl. The F file for general stuff. -The F file for copyright information. +The F and F files for copyright information. =head1 HISTORY -Constructed by Tom Christiansen, grabbing material with permission -from innumerable contributors, with kibitzing by more than a few Perl -porters. - -Last update: Tue Jan 14 14:03:02 EST 1997 +=cut