X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperldelta.pod;h=c5104b0e27938081c7b1c7206afba936bd4c4412;hb=ab4f32c297ca404165732c897d45e499965c42dc;hp=628ca22f27f4c66843678d5c788523c89aaa9272;hpb=aa6893958c2bfb6fa4ab923c8466c188c65748fd;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 628ca22..c5104b0 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -1,1011 +1,659 @@ =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 L." 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 +=head1 Incompatible Changes -Most importantly, many bugs were fixed. See the F -file in the distribution for details. +=head2 WARNING: This version is not binary compatible with Perl 5.004. -=head2 Compilation Option: Binary Compatibility With 5.003 +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. -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 Default installation structure has changed -=head2 New Opcode Module and Revised Safe Module +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. -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 Perl Source Compatibility -=head2 Fixed Parsing of $$, &$, etc. +When none of the experimental features are enabled, there should be +no user-visible Perl source compatibility issue. -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 "${$}". +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.] -=head2 Internal Change: FileHandle Deprecated +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>. -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. +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>. -=head2 Internal Change: PerlIO internal IO abstraction interface +=head2 C Source Compatibility -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. +=item Core sources now require ANSI C compiler -=head2 New and Changed Built-in Variables +=item Enabling threads has source compatibility issues -=over +=head2 Binary Compatibility -=item $^E +This version is NOT binary compatible with older versions. All extensions +will need to be recompiled. -Extended error message on some platforms. (Also known as -$EXTENDED_OS_ERROR if you C). +=head2 Security fixes may affect compatibility -=item $^H +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. -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. +Oneliners with the C<-e> switch do not create temporary files anymore. -=item $^M +=head2 Relaxed new mandatory warnings introduced in 5.004 -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 +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. - $^M = 'a' x (1<<16); +=head2 Licensing -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. +Perl has a new Social Contract for contributors. See F. -=back +The license included in much of the Perl documentation has changed. +[XXX See where?] -=head2 New and Changed Built-in Functions +=head1 Core Changes -=over -=item delete on slices +=head2 Threads -This now works. (e.g. C) +WARNING: Threading is considered an experimental feature. Details of the +implementation may change without notice. There are known limitations +and and some bugs. -=item flock +See L. -is now supported on more platforms, and prefers fcntl -to lockf when emulating. +=head2 Compiler -=item printf and sprintf +WARNING: The Compiler and related tools are considered experimental. +Features may change without notice, and there are known limitations +and bugs. -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". +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. -=item keys as an lvalue +The compiler comes with several valuable utilities. -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 +C is an experimental module to detect and warn about suspicious +code, especially the cases that the C<-w> switch does not detect. - keys %hash = 200; +C can be used to demystify perl code, and understand +how perl optimizes certain constructs. -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). +C generates cross reference reports of all definition and use +of variables, subroutines and formats in a program. -=item my() in Control Structures +C show the lexical variables used by a subroutine or file +at a glance. -You can now use my() (with or without the parentheses) in the control -expressions of control structures such as: +C is a simple frontend for compiling perl. - while (defined(my $line = <>)) { - $line = lc $line; - } continue { - print $line; - } +See C. - 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'"; - } +=head2 Regular Expressions -Also, you can declare a foreach loop control variable as lexical by -preceding it with the word "my". For example, in: +See L and L. - foreach my $i (1, 2, 3) { - some_function(); - } +=head2 Improved malloc() -$i is a lexical variable, and the scope of $i extends to the end of -the loop, but not beyond it. +See banner at the beginning of C for details. -Note that you still cannot use my() on global punctuation variables -such as $_ and the like. +=head2 Quicksort is internally implemented -=item unpack() and pack() +See C. -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. +=head2 Reliable signals -=item use VERSION +Two kinds. -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.) +Via C. -=item use Module VERSION LIST +Via switched runtime op loop. [XXX Not yet available.] -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!) +=head2 Reliable stack pointers -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. +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. -=item prototype(FUNCTION) +=head2 Behavior of local() on composites is now well-defined -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.) +See L. -=item $_ as Default +=head2 C<%!> is transparently tied to the L module -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; - } +See L, and L. -=back +=head2 Pseudo-hashes are supported -=head2 New Built-in Methods +See L. -The C package automatically contains the following methods that -are inherited by all other classes: +=head2 C is supported -=over +See L. -=item isa(CLASS) +=head2 Slice notation on glob elements is supported -C returns I if its object is blessed into a sub-class of C +[XXX See what?] -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: +=head2 Keywords can be globally overridden - use UNIVERSAL qw(isa); +See L. - if(isa($ref, 'ARRAY')) { - ... - } +=head2 C<$^E> is meaningful on Win32 -=item can(METHOD) +See L. -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. +=head2 C optimized -=item VERSION( [NEED] ) +C is now optimized into a counting loop. It does +not try to allocate a 1000000-size list anymore. -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. +=head2 C can be used as implicitly quoted package name - use A 1.2 qw(some imported subs); - # implies: - A->VERSION(1.2); +[XXX See what?] -=back +=head2 C tests existence of a package -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. +[XXX See what?] -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. +=head2 Better locale support -=head2 TIEHANDLE Now Supported +See L. -See L for other kinds of tie()s. +=head2 Experimental support for 64-bit platforms -=over +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 TIEHANDLE classname, LIST +=head2 prototype() returns useful results on builtins -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. +See L. - sub TIEHANDLE { - print "\n"; - my $i; - return bless \$i, shift; - } +=head2 Extended support for exception handling -=item PRINT this, LIST +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.] -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. +=head2 Re-blessing in DESTROY() supported for chaining DESTROY() methods - sub PRINT { - $r = shift; - $$r++; - return print join( $, => map {uc} @_), $\; - } +See L. -=item READLINE this +=head2 All C format conversions are handled internally -This method will be called when the handle is read from. The method -should return undef when there is no more data. +See L. - sub READLINE { - $r = shift; - return "PRINT called $$r times\n"; - } +=head2 New C keyword -=item DESTROY this +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. -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. +[XXX Needs to be documented in perlsub or perlmod.] - sub DESTROY { - print "\n"; - } - -=back +=head2 New C keyword -=head2 Malloc Enhancements +The C keyword is the fundamental synchronization primitive +in threaded perl. When threads are not enabled, it is currently a noop. -If perl's malloc() is used, you can print memory statistics at runtime -by running Perl thusly: +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. - env PERL_DEBUG_MSTATS=2 perl your_script_here +=head2 New C operator -The value of 2 means to print statistics after compilation and on -exit; with a value of 1, the statistics ares printed only on exit. -(If you want the statistics at an arbitrary time, you'll need to -install the optional module Devel::Peek.) +The C operator, which is syntactically similar to the other quote-like +operators, is used to create compiled regular expressions. This compiled +form can now be explicitly passed around in variables, and interpolated in +other regular expressions. See L and L. -In addition, three new compilation flags are recognized by malloc.c. -(They have no effect if perl is compiled with system malloc().) +=head2 C is now a reserved word -=over +=head2 Tied arrays are now fully supported -=item -DEMERGENCY_SBRK +See L. -If this macro is defined, running out of memory need not be a fatal -error: a memory pool can allocated by assigning to the special -variable C<$^M>. See L<"$^M">. +=head2 Tied handles support is better -=item -DPACK_MALLOC +Several missing hooks have been added. There is also a new base class for +TIEARRAY implementations. 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). -Expected memory savings (with 8-byte alignment in C) is -about 20% for typical Perl usage. Expected slowdown due to additional -malloc overhead is in fractions of a percent (hard to measure, because -of the effect of saved memory on speed). +=head1 Supported Platforms -=item -DTWO_POT_OPTIMIZE +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. -Similarly to C, this macro improves allocations of data -with size close to a power of two; but this works for big allocations -(starting with 16K by default). Such allocations are typical for big -hashes and special-purpose scripts, especially image processing. +=head2 New Platforms -On recent systems, the fact that perl requires 2M from system for 1M -allocation will not affect speed of execution, since the tail of such -a chunk is not going to be touched (and thus will not require real -memory). However, it may result in a premature out-of-memory error. -So if you will be manipulating very large blocks with sizes close to -powers of two, it would be wise to define this macro. +BeOS is now supported. See L. -Expected saving of memory is 0-100% (100% in applications which -require most memory in such 2**n chunks); expected slowdown is -negligible. +DOS is now supported under the DJGPP tools. See L. -=back +=head2 Changes in existing support -=head2 Miscellaneous Efficiency Enhancements +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.] -Functions that have an empty prototype and that do nothing but return -a fixed value are now inlined (e.g. C). +VMS configuration system has been rewritten. See L. -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. +OpenBSD better supported. [XXX what others?] -=head1 Pragmata +=head1 Modules and Pragmata -Four new pragmatic modules exist: +=head2 New Modules =over -=item use blib - -=item use blib 'dir' - -Looks for MakeMaker-like I<'blib'> directory structure starting in -I (or current directory) and working back up to five levels of -parent directories. - -Intended for use on command line with B<-M> option as a way of testing -arbitrary scripts against an uninstalled version of a package. - -=item use locale - -Tells the compiler to enable (or disable) the use of POSIX locales for -built-in operations. - -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. - -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(). - -See L for more information. - -=item use ops +=item B -Disable unsafe opcodes, or any named opcodes, when compiling Perl code. +Perl compiler and tools. See [XXX what?]. -=item use vmsish +=item Data::Dumper -Enable VMS-specific language features. Currently, there are three -VMS-specific features 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. +A module to pretty print Perl data. See L. -=back - -=head1 Modules - -=head2 Installation Directories +=item Errno -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 look up errors more conveniently. See L. -=head2 Fcntl +=item File::Spec -New constants in the existing Fcntl modules are now supported, -provided that your operating system happens to support them: +A portable API for file operations. - F_GETOWN F_SETOWN - O_ASYNC O_DEFER O_DSYNC O_FSYNC O_SYNC - O_EXLOCK O_SHLOCK +=item ExtUtils::Installed -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(). +Query and manage installed modules. -In addition, the Fcntl module now provides these constants for use -with the Perl operator flock(): +=item ExtUtils::Packlist - LOCK_SH LOCK_EX LOCK_NB LOCK_UN +Manipulate .packlist files. -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 Fatal -=head2 Module Information Summary +Make functions/builtins succeed or die. -Brand new modules, arranged by topic rather than strictly -alphabetically: +=item IPC::SysV - CPAN interface to Comprehensive Perl Archive Network - CPAN::FirstTime create a CPAN configuration file - CPAN::Nox run CPAN while avoiding compiled extensions +Constants and other support infrastructure for System V IPC operations +in perl. - 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 Test - Opcode.pm Disable named opcodes when compiling Perl code +A framework for writing testsuites. - ExtUtils/Embed.pm Utilities for embedding Perl in C programs - ExtUtils/testlib.pm Fixes up @INC to use just-built extension +=item Tie::Array - FindBin.pm Find path of currently executing program +Base class for tied arrays. - 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::Handle - Tie/RefHash.pm Base class for tied hashes with references as keys +Base class for tied handles. - UNIVERSAL.pm Base class for *ALL* classes +=item Thread -=head2 IO +Perl thread creation, manipulation, and support. -The IO module provides a simple mechanism to load all of the IO modules at one -go. Currently this includes: +=item attrs - IO::Handle - IO::Seekable - IO::File - IO::Pipe - IO::Socket +Set subroutine attributes. -For more information on any of these modules, please see its -respective documentation. +=item fields -=head2 Math::Complex +Compile-time class fields. -The Math::Complex module has been totally rewritten, and now supports -more operations. These are overloaded: +=item re - + - * / ** <=> neg ~ abs sqrt exp log sin cos atan2 "" (stringify) +Various pragmata to control behavior of regular expressions. -And these functions are now exported: - - 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 - -=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 * - -By public demand, added support for the standard hash function exists(). - -=item * - -Made it compatible with Berkeley DB 1.86. +=item CGI -=item * +CGI has been updated to version 2.42. -Made negative subscripts work with RECNO interface. +=item POSIX -=item * +POSIX now has its own platform-specific hints files. -Changed the default flags from O_RDWR to O_CREAT|O_RDWR and the default -mode from 0640 to 0666. +=item DB_File -=item * +DB_File supports version 2.x of Berkeley DB. See C. -Made DB_File automatically import the open() constants (O_RDWR, -O_CREAT etc.) from Fcntl, if available. +=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. -Updated documentation. +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. -=back - -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. - -=head2 Net::Ping +=item CPAN -Major rewrite - support added for both udp echo and real icmp pings. +[XXX What?] -=head2 Overridden Built-ins +=item Cwd -Many of the Perl built-ins returning lists now have -object-oriented overrides. These are: +Cwd::cwd is faster on most platforms. - File::stat - Net::hostent - Net::netent - Net::protoent - Net::servent - Time::gmtime - Time::localtime - User::grent - User::pwent +=item Benchmark -For example, you can now say +Keeps better time. - use File::stat; - use User::pwent; - $his = (stat($filename)->st_uid == pwent($whoever)->pw_uid); +=back =head1 Utility Changes -=head2 xsubpp - -=over +h2ph and related utilities have been vastly overhauled. -=item C XSUBs now default to returning nothing +perlcc, a new experimental front end for the compiler is available. -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. +The crude GNU configure emulator is now called configure.gnu. -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. +=head1 API Changes -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. - -=back - -=head1 C Language API Changes - -=over +=head2 Incompatible Changes -=item C and C +=head2 Deprecations, Extensions -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. - -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: - -=over - -=item L - -This document. - -=item L - -Locale support (internationalization and localization). - -=item L - -Tutorial on Perl OO programming. +Config.pm now has a glossary of variables. -=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 +=item Ambiguous call resolved as CORE::%s(), qualify as such or use & -(F) The argument to delete() must be either a hash element, 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} - $ref->[12]->{"susie"} +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). -or a hash slice, such as +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). - @foo{$bar, $baz, $xyzzy} - @{$ref->[12]}{"susie", "queue"} +=item Bad index while coercing array into hash -=item Allocation too large: %lx +(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. -(X) You can't allocate more than 64K on an MSDOS machine. +=item Bareword "%s" refers to nonexistent package -=item Allocation too large +(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? -(F) You can't allocate more than 2^31+"small amount" bytes. +=item Can't call method "%s" on an undefined value -=item Attempt to free non-existent shared string +(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: -(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. + $BADREF = 42; + process $BADREF 1,2,3; + $BADREF->process(1,2,3); -=item Attempt to use reference as lvalue in substr +=item Can't coerce array into hash -(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. +(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. -=item Unsupported function fork +=item Can't goto subroutine from an eval-string -(F) Your version of executable does not support forking. +(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.) -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 use %%! because Errno.pm is not available -=item Ill-formed logical name |%s| in prime_env_iter +(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. -(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 @@ -1017,27 +665,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