1N/A=head1 NAME
1N/A
1N/Aperl5004delta - what's new for perl5.004
1N/A
1N/A=head1 DESCRIPTION
1N/A
1N/AThis document describes differences between the 5.003 release (as
1N/Adocumented in I<Programming Perl>, second edition--the Camel Book) and
1N/Athis one.
1N/A
1N/A=head1 Supported Environments
1N/A
1N/APerl5.004 builds out of the box on Unix, Plan 9, LynxOS, VMS, OS/2,
1N/AQNX, AmigaOS, and Windows NT. Perl runs on Windows 95 as well, but it
1N/Acannot be built there, for lack of a reasonable command interpreter.
1N/A
1N/A=head1 Core Changes
1N/A
1N/AMost importantly, many bugs were fixed, including several security
1N/Aproblems. See the F<Changes> file in the distribution for details.
1N/A
1N/A=head2 List assignment to %ENV works
1N/A
1N/AC<%ENV = ()> and C<%ENV = @list> now work as expected (except on VMS
1N/Awhere it generates a fatal error).
1N/A
1N/A=head2 Change to "Can't locate Foo.pm in @INC" error
1N/A
1N/AThe error "Can't locate Foo.pm in @INC" now lists the contents of @INC
1N/Afor easier debugging.
1N/A
1N/A=head2 Compilation option: Binary compatibility with 5.003
1N/A
1N/AThere is a new Configure question that asks if you want to maintain
1N/Abinary compatibility with Perl 5.003. If you choose binary
1N/Acompatibility, you do not have to recompile your extensions, but you
1N/Amight have symbol conflicts if you embed Perl in another application,
1N/Ajust as in the 5.003 release. By default, binary compatibility
1N/Ais preserved at the expense of symbol table pollution.
1N/A
1N/A=head2 $PERL5OPT environment variable
1N/A
1N/AYou may now put Perl options in the $PERL5OPT environment variable.
1N/AUnless Perl is running with taint checks, it will interpret this
1N/Avariable as if its contents had appeared on a "#!perl" line at the
1N/Abeginning of your script, except that hyphens are optional. PERL5OPT
1N/Amay only be used to set the following switches: B<-[DIMUdmw]>.
1N/A
1N/A=head2 Limitations on B<-M>, B<-m>, and B<-T> options
1N/A
1N/AThe C<-M> and C<-m> options are no longer allowed on the C<#!> line of
1N/Aa script. If a script needs a module, it should invoke it with the
1N/AC<use> pragma.
1N/A
1N/AThe B<-T> option is also forbidden on the C<#!> line of a script,
1N/Aunless it was present on the Perl command line. Due to the way C<#!>
1N/Aworks, this usually means that B<-T> must be in the first argument.
1N/AThus:
1N/A
1N/A #!/usr/bin/perl -T -w
1N/A
1N/Awill probably work for an executable script invoked as C<scriptname>,
1N/Awhile:
1N/A
1N/A #!/usr/bin/perl -w -T
1N/A
1N/Awill probably fail under the same conditions. (Non-Unix systems will
1N/Aprobably not follow this rule.) But C<perl scriptname> is guaranteed
1N/Ato fail, since then there is no chance of B<-T> being found on the
1N/Acommand line before it is found on the C<#!> line.
1N/A
1N/A=head2 More precise warnings
1N/A
1N/AIf you removed the B<-w> option from your Perl 5.003 scripts because it
1N/Amade Perl too verbose, we recommend that you try putting it back when
1N/Ayou upgrade to Perl 5.004. Each new perl version tends to remove some
1N/Aundesirable warnings, while adding new warnings that may catch bugs in
1N/Ayour scripts.
1N/A
1N/A=head2 Deprecated: Inherited C<AUTOLOAD> for non-methods
1N/A
1N/ABefore Perl 5.004, C<AUTOLOAD> functions were looked up as methods
1N/A(using the C<@ISA> hierarchy), even when the function to be autoloaded
1N/Awas called as a plain function (e.g. C<Foo::bar()>), not a method
1N/A(e.g. C<< Foo->bar() >> or C<< $obj->bar() >>).
1N/A
1N/APerl 5.005 will use method lookup only for methods' C<AUTOLOAD>s.
1N/AHowever, there is a significant base of existing code that may be using
1N/Athe old behavior. So, as an interim step, Perl 5.004 issues an optional
1N/Awarning when a non-method uses an inherited C<AUTOLOAD>.
1N/A
1N/AThe simple rule is: Inheritance will not work when autoloading
1N/Anon-methods. The simple fix for old code is: In any module that used to
1N/Adepend on inheriting C<AUTOLOAD> for non-methods from a base class named
1N/AC<BaseClass>, execute C<*AUTOLOAD = \&BaseClass::AUTOLOAD> during startup.
1N/A
1N/A=head2 Previously deprecated %OVERLOAD is no longer usable
1N/A
1N/AUsing %OVERLOAD to define overloading was deprecated in 5.003.
1N/AOverloading is now defined using the overload pragma. %OVERLOAD is
1N/Astill used internally but should not be used by Perl scripts. See
1N/AL<overload> for more details.
1N/A
1N/A=head2 Subroutine arguments created only when they're modified
1N/A
1N/AIn Perl 5.004, nonexistent array and hash elements used as subroutine
1N/Aparameters are brought into existence only if they are actually
1N/Aassigned to (via C<@_>).
1N/A
1N/AEarlier versions of Perl vary in their handling of such arguments.
1N/APerl versions 5.002 and 5.003 always brought them into existence.
1N/APerl versions 5.000 and 5.001 brought them into existence only if
1N/Athey were not the first argument (which was almost certainly a bug).
1N/AEarlier versions of Perl never brought them into existence.
1N/A
1N/AFor example, given this code:
1N/A
1N/A undef @a; undef %a;
1N/A sub show { print $_[0] };
1N/A sub change { $_[0]++ };
1N/A show($a[2]);
1N/A change($a{b});
1N/A
1N/AAfter this code executes in Perl 5.004, $a{b} exists but $a[2] does
1N/Anot. In Perl 5.002 and 5.003, both $a{b} and $a[2] would have existed
1N/A(but $a[2]'s value would have been undefined).
1N/A
1N/A=head2 Group vector changeable with C<$)>
1N/A
1N/AThe C<$)> special variable has always (well, in Perl 5, at least)
1N/Areflected not only the current effective group, but also the group list
1N/Aas returned by the C<getgroups()> C function (if there is one).
1N/AHowever, until this release, there has not been a way to call the
1N/AC<setgroups()> C function from Perl.
1N/A
1N/AIn Perl 5.004, assigning to C<$)> is exactly symmetrical with examining
1N/Ait: The first number in its string value is used as the effective gid;
1N/Aif there are any numbers after the first one, they are passed to the
1N/AC<setgroups()> C function (if there is one).
1N/A
1N/A=head2 Fixed parsing of $$<digit>, &$<digit>, etc.
1N/A
1N/APerl versions before 5.004 misinterpreted any type marker followed by
1N/A"$" and a digit. For example, "$$0" was incorrectly taken to mean
1N/A"${$}0" instead of "${$0}". This bug is (mostly) fixed in Perl 5.004.
1N/A
1N/AHowever, the developers of Perl 5.004 could not fix this bug completely,
1N/Abecause at least two widely-used modules depend on the old meaning of
1N/A"$$0" in a string. So Perl 5.004 still interprets "$$<digit>" in the
1N/Aold (broken) way inside strings; but it generates this message as a
1N/Awarning. And in Perl 5.005, this special treatment will cease.
1N/A
1N/A=head2 Fixed localization of $<digit>, $&, etc.
1N/A
1N/APerl versions before 5.004 did not always properly localize the
1N/Aregex-related special variables. Perl 5.004 does localize them, as
1N/Athe documentation has always said it should. This may result in $1,
1N/A$2, etc. no longer being set where existing programs use them.
1N/A
1N/A=head2 No resetting of $. on implicit close
1N/A
1N/AThe documentation for Perl 5.0 has always stated that C<$.> is I<not>
1N/Areset when an already-open file handle is reopened with no intervening
1N/Acall to C<close>. Due to a bug, perl versions 5.000 through 5.003
1N/AI<did> reset C<$.> under that circumstance; Perl 5.004 does not.
1N/A
1N/A=head2 C<wantarray> may return undef
1N/A
1N/AThe C<wantarray> operator returns true if a subroutine is expected to
1N/Areturn a list, and false otherwise. In Perl 5.004, C<wantarray> can
1N/Aalso return the undefined value if a subroutine's return value will
1N/Anot be used at all, which allows subroutines to avoid a time-consuming
1N/Acalculation of a return value if it isn't going to be used.
1N/A
1N/A=head2 C<eval EXPR> determines value of EXPR in scalar context
1N/A
1N/APerl (version 5) used to determine the value of EXPR inconsistently,
1N/Asometimes incorrectly using the surrounding context for the determination.
1N/ANow, the value of EXPR (before being parsed by eval) is always determined in
1N/Aa scalar context. Once parsed, it is executed as before, by providing
1N/Athe context that the scope surrounding the eval provided. This change
1N/Amakes the behavior Perl4 compatible, besides fixing bugs resulting from
1N/Athe inconsistent behavior. This program:
1N/A
1N/A @a = qw(time now is time);
1N/A print eval @a;
1N/A print '|', scalar eval @a;
1N/A
1N/Aused to print something like "timenowis881399109|4", but now (and in perl4)
1N/Aprints "4|4".
1N/A
1N/A=head2 Changes to tainting checks
1N/A
1N/AA bug in previous versions may have failed to detect some insecure
1N/Aconditions when taint checks are turned on. (Taint checks are used
1N/Ain setuid or setgid scripts, or when explicitly turned on with the
1N/AC<-T> invocation option.) Although it's unlikely, this may cause a
1N/Apreviously-working script to now fail -- which should be construed
1N/Aas a blessing, since that indicates a potentially-serious security
1N/Ahole was just plugged.
1N/A
1N/AThe new restrictions when tainting include:
1N/A
1N/A=over 4
1N/A
1N/A=item No glob() or <*>
1N/A
1N/AThese operators may spawn the C shell (csh), which cannot be made
1N/Asafe. This restriction will be lifted in a future version of Perl
1N/Awhen globbing is implemented without the use of an external program.
1N/A
1N/A=item No spawning if tainted $CDPATH, $ENV, $BASH_ENV
1N/A
1N/AThese environment variables may alter the behavior of spawned programs
1N/A(especially shells) in ways that subvert security. So now they are
1N/Atreated as dangerous, in the manner of $IFS and $PATH.
1N/A
1N/A=item No spawning if tainted $TERM doesn't look like a terminal name
1N/A
1N/ASome termcap libraries do unsafe things with $TERM. However, it would be
1N/Aunnecessarily harsh to treat all $TERM values as unsafe, since only shell
1N/Ametacharacters can cause trouble in $TERM. So a tainted $TERM is
1N/Aconsidered to be safe if it contains only alphanumerics, underscores,
1N/Adashes, and colons, and unsafe if it contains other characters (including
1N/Awhitespace).
1N/A
1N/A=back
1N/A
1N/A=head2 New Opcode module and revised Safe module
1N/A
1N/AA new Opcode module supports the creation, manipulation and
1N/Aapplication of opcode masks. The revised Safe module has a new API
1N/Aand is implemented using the new Opcode module. Please read the new
1N/AOpcode and Safe documentation.
1N/A
1N/A=head2 Embedding improvements
1N/A
1N/AIn older versions of Perl it was not possible to create more than one
1N/APerl interpreter instance inside a single process without leaking like a
1N/Asieve and/or crashing. The bugs that caused this behavior have all been
1N/Afixed. However, you still must take care when embedding Perl in a C
1N/Aprogram. See the updated perlembed manpage for tips on how to manage
1N/Ayour interpreters.
1N/A
1N/A=head2 Internal change: FileHandle class based on IO::* classes
1N/A
1N/AFile handles are now stored internally as type IO::Handle. The
1N/AFileHandle module is still supported for backwards compatibility, but
1N/Ait is now merely a front end to the IO::* modules -- specifically,
1N/AIO::Handle, IO::Seekable, and IO::File. We suggest, but do not
1N/Arequire, that you use the IO::* modules in new code.
1N/A
1N/AIn harmony with this change, C<*GLOB{FILEHANDLE}> is now just a
1N/Abackward-compatible synonym for C<*GLOB{IO}>.
1N/A
1N/A=head2 Internal change: PerlIO abstraction interface
1N/A
1N/AIt is now possible to build Perl with AT&T's sfio IO package
1N/Ainstead of stdio. See L<perlapio> for more details, and
1N/Athe F<INSTALL> file for how to use it.
1N/A
1N/A=head2 New and changed syntax
1N/A
1N/A=over 4
1N/A
1N/A=item $coderef->(PARAMS)
1N/A
1N/AA subroutine reference may now be suffixed with an arrow and a
1N/A(possibly empty) parameter list. This syntax denotes a call of the
1N/Areferenced subroutine, with the given parameters (if any).
1N/A
1N/AThis new syntax follows the pattern of S<C<< $hashref->{FOO} >>> and
1N/AS<C<< $aryref->[$foo] >>>: You may now write S<C<&$subref($foo)>> as
1N/AS<C<< $subref->($foo) >>>. All these arrow terms may be chained;
1N/Athus, S<C<< &{$table->{FOO}}($bar) >>> may now be written
1N/AS<C<< $table->{FOO}->($bar) >>>.
1N/A
1N/A=back
1N/A
1N/A=head2 New and changed builtin constants
1N/A
1N/A=over 4
1N/A
1N/A=item __PACKAGE__
1N/A
1N/AThe current package name at compile time, or the undefined value if
1N/Athere is no current package (due to a C<package;> directive). Like
1N/AC<__FILE__> and C<__LINE__>, C<__PACKAGE__> does I<not> interpolate
1N/Ainto strings.
1N/A
1N/A=back
1N/A
1N/A=head2 New and changed builtin variables
1N/A
1N/A=over 4
1N/A
1N/A=item $^E
1N/A
1N/AExtended error message on some platforms. (Also known as
1N/A$EXTENDED_OS_ERROR if you C<use English>).
1N/A
1N/A=item $^H
1N/A
1N/AThe current set of syntax checks enabled by C<use strict>. See the
1N/Adocumentation of C<strict> for more details. Not actually new, but
1N/Anewly documented.
1N/ABecause it is intended for internal use by Perl core components,
1N/Athere is no C<use English> long name for this variable.
1N/A
1N/A=item $^M
1N/A
1N/ABy default, running out of memory it is not trappable. However, if
1N/Acompiled for this, Perl may use the contents of C<$^M> as an emergency
1N/Apool after die()ing with this message. Suppose that your Perl were
1N/Acompiled with -DPERL_EMERGENCY_SBRK and used Perl's malloc. Then
1N/A
1N/A $^M = 'a' x (1<<16);
1N/A
1N/Awould allocate a 64K buffer for use when in emergency.
1N/ASee the F<INSTALL> file for information on how to enable this option.
1N/AAs a disincentive to casual use of this advanced feature,
1N/Athere is no C<use English> long name for this variable.
1N/A
1N/A=back
1N/A
1N/A=head2 New and changed builtin functions
1N/A
1N/A=over 4
1N/A
1N/A=item delete on slices
1N/A
1N/AThis now works. (e.g. C<delete @ENV{'PATH', 'MANPATH'}>)
1N/A
1N/A=item flock
1N/A
1N/Ais now supported on more platforms, prefers fcntl to lockf when
1N/Aemulating, and always flushes before (un)locking.
1N/A
1N/A=item printf and sprintf
1N/A
1N/APerl now implements these functions itself; it doesn't use the C
1N/Alibrary function sprintf() any more, except for floating-point
1N/Anumbers, and even then only known flags are allowed. As a result, it
1N/Ais now possible to know which conversions and flags will work, and
1N/Awhat they will do.
1N/A
1N/AThe new conversions in Perl's sprintf() are:
1N/A
1N/A %i a synonym for %d
1N/A %p a pointer (the address of the Perl value, in hexadecimal)
1N/A %n special: *stores* the number of characters output so far
1N/A into the next variable in the parameter list
1N/A
1N/AThe new flags that go between the C<%> and the conversion are:
1N/A
1N/A # prefix octal with "0", hex with "0x"
1N/A h interpret integer as C type "short" or "unsigned short"
1N/A V interpret integer as Perl's standard integer type
1N/A
1N/AAlso, where a number would appear in the flags, an asterisk ("*") may
1N/Abe used instead, in which case Perl uses the next item in the
1N/Aparameter list as the given number (that is, as the field width or
1N/Aprecision). If a field width obtained through "*" is negative, it has
1N/Athe same effect as the '-' flag: left-justification.
1N/A
1N/ASee L<perlfunc/sprintf> for a complete list of conversion and flags.
1N/A
1N/A=item keys as an lvalue
1N/A
1N/AAs an lvalue, C<keys> allows you to increase the number of hash buckets
1N/Aallocated for the given hash. This can gain you a measure of efficiency if
1N/Ayou know the hash is going to get big. (This is similar to pre-extending
1N/Aan array by assigning a larger number to $#array.) If you say
1N/A
1N/A keys %hash = 200;
1N/A
1N/Athen C<%hash> will have at least 200 buckets allocated for it. These
1N/Abuckets will be retained even if you do C<%hash = ()>; use C<undef
1N/A%hash> if you want to free the storage while C<%hash> is still in scope.
1N/AYou can't shrink the number of buckets allocated for the hash using
1N/AC<keys> in this way (but you needn't worry about doing this by accident,
1N/Aas trying has no effect).
1N/A
1N/A=item my() in Control Structures
1N/A
1N/AYou can now use my() (with or without the parentheses) in the control
1N/Aexpressions of control structures such as:
1N/A
1N/A while (defined(my $line = <>)) {
1N/A $line = lc $line;
1N/A } continue {
1N/A print $line;
1N/A }
1N/A
1N/A if ((my $answer = <STDIN>) =~ /^y(es)?$/i) {
1N/A user_agrees();
1N/A } elsif ($answer =~ /^n(o)?$/i) {
1N/A user_disagrees();
1N/A } else {
1N/A chomp $answer;
1N/A die "`$answer' is neither `yes' nor `no'";
1N/A }
1N/A
1N/AAlso, you can declare a foreach loop control variable as lexical by
1N/Apreceding it with the word "my". For example, in:
1N/A
1N/A foreach my $i (1, 2, 3) {
1N/A some_function();
1N/A }
1N/A
1N/A$i is a lexical variable, and the scope of $i extends to the end of
1N/Athe loop, but not beyond it.
1N/A
1N/ANote that you still cannot use my() on global punctuation variables
1N/Asuch as $_ and the like.
1N/A
1N/A=item pack() and unpack()
1N/A
1N/AA new format 'w' represents a BER compressed integer (as defined in
1N/AASN.1). Its format is a sequence of one or more bytes, each of which
1N/Aprovides seven bits of the total value, with the most significant
1N/Afirst. Bit eight of each byte is set, except for the last byte, in
1N/Awhich bit eight is clear.
1N/A
1N/AIf 'p' or 'P' are given undef as values, they now generate a NULL
1N/Apointer.
1N/A
1N/ABoth pack() and unpack() now fail when their templates contain invalid
1N/Atypes. (Invalid types used to be ignored.)
1N/A
1N/A=item sysseek()
1N/A
1N/AThe new sysseek() operator is a variant of seek() that sets and gets the
1N/Afile's system read/write position, using the lseek(2) system call. It is
1N/Athe only reliable way to seek before using sysread() or syswrite(). Its
1N/Areturn value is the new position, or the undefined value on failure.
1N/A
1N/A=item use VERSION
1N/A
1N/AIf the first argument to C<use> is a number, it is treated as a version
1N/Anumber instead of a module name. If the version of the Perl interpreter
1N/Ais less than VERSION, then an error message is printed and Perl exits
1N/Aimmediately. Because C<use> occurs at compile time, this check happens
1N/Aimmediately during the compilation process, unlike C<require VERSION>,
1N/Awhich waits until runtime for the check. This is often useful if you
1N/Aneed to check the current Perl version before C<use>ing library modules
1N/Awhich have changed in incompatible ways from older versions of Perl.
1N/A(We try not to do this more than we have to.)
1N/A
1N/A=item use Module VERSION LIST
1N/A
1N/AIf the VERSION argument is present between Module and LIST, then the
1N/AC<use> will call the VERSION method in class Module with the given
1N/Aversion as an argument. The default VERSION method, inherited from
1N/Athe UNIVERSAL class, croaks if the given version is larger than the
1N/Avalue of the variable $Module::VERSION. (Note that there is not a
1N/Acomma after VERSION!)
1N/A
1N/AThis version-checking mechanism is similar to the one currently used
1N/Ain the Exporter module, but it is faster and can be used with modules
1N/Athat don't use the Exporter. It is the recommended method for new
1N/Acode.
1N/A
1N/A=item prototype(FUNCTION)
1N/A
1N/AReturns the prototype of a function as a string (or C<undef> if the
1N/Afunction has no prototype). FUNCTION is a reference to or the name of the
1N/Afunction whose prototype you want to retrieve.
1N/A(Not actually new; just never documented before.)
1N/A
1N/A=item srand
1N/A
1N/AThe default seed for C<srand>, which used to be C<time>, has been changed.
1N/ANow it's a heady mix of difficult-to-predict system-dependent values,
1N/Awhich should be sufficient for most everyday purposes.
1N/A
1N/APrevious to version 5.004, calling C<rand> without first calling C<srand>
1N/Awould yield the same sequence of random numbers on most or all machines.
1N/ANow, when perl sees that you're calling C<rand> and haven't yet called
1N/AC<srand>, it calls C<srand> with the default seed. You should still call
1N/AC<srand> manually if your code might ever be run on a pre-5.004 system,
1N/Aof course, or if you want a seed other than the default.
1N/A
1N/A=item $_ as Default
1N/A
1N/AFunctions documented in the Camel to default to $_ now in
1N/Afact do, and all those that do are so documented in L<perlfunc>.
1N/A
1N/A=item C<m//gc> does not reset search position on failure
1N/A
1N/AThe C<m//g> match iteration construct has always reset its target
1N/Astring's search position (which is visible through the C<pos> operator)
1N/Awhen a match fails; as a result, the next C<m//g> match after a failure
1N/Astarts again at the beginning of the string. With Perl 5.004, this
1N/Areset may be disabled by adding the "c" (for "continue") modifier,
1N/Ai.e. C<m//gc>. This feature, in conjunction with the C<\G> zero-width
1N/Aassertion, makes it possible to chain matches together. See L<perlop>
1N/Aand L<perlre>.
1N/A
1N/A=item C<m//x> ignores whitespace before ?*+{}
1N/A
1N/AThe C<m//x> construct has always been intended to ignore all unescaped
1N/Awhitespace. However, before Perl 5.004, whitespace had the effect of
1N/Aescaping repeat modifiers like "*" or "?"; for example, C</a *b/x> was
1N/A(mis)interpreted as C</a\*b/x>. This bug has been fixed in 5.004.
1N/A
1N/A=item nested C<sub{}> closures work now
1N/A
1N/APrior to the 5.004 release, nested anonymous functions didn't work
1N/Aright. They do now.
1N/A
1N/A=item formats work right on changing lexicals
1N/A
1N/AJust like anonymous functions that contain lexical variables
1N/Athat change (like a lexical index variable for a C<foreach> loop),
1N/Aformats now work properly. For example, this silently failed
1N/Abefore (printed only zeros), but is fine now:
1N/A
1N/A my $i;
1N/A foreach $i ( 1 .. 10 ) {
1N/A write;
1N/A }
1N/A format =
1N/A my i is @#
1N/A $i
1N/A .
1N/A
1N/AHowever, it still fails (without a warning) if the foreach is within a
1N/Asubroutine:
1N/A
1N/A my $i;
1N/A sub foo {
1N/A foreach $i ( 1 .. 10 ) {
1N/A write;
1N/A }
1N/A }
1N/A foo;
1N/A format =
1N/A my i is @#
1N/A $i
1N/A .
1N/A
1N/A=back
1N/A
1N/A=head2 New builtin methods
1N/A
1N/AThe C<UNIVERSAL> package automatically contains the following methods that
1N/Aare inherited by all other classes:
1N/A
1N/A=over 4
1N/A
1N/A=item isa(CLASS)
1N/A
1N/AC<isa> returns I<true> if its object is blessed into a subclass of C<CLASS>
1N/A
1N/AC<isa> is also exportable and can be called as a sub with two arguments. This
1N/Aallows the ability to check what a reference points to. Example:
1N/A
1N/A use UNIVERSAL qw(isa);
1N/A
1N/A if(isa($ref, 'ARRAY')) {
1N/A ...
1N/A }
1N/A
1N/A=item can(METHOD)
1N/A
1N/AC<can> checks to see if its object has a method called C<METHOD>,
1N/Aif it does then a reference to the sub is returned; if it does not then
1N/AI<undef> is returned.
1N/A
1N/A=item VERSION( [NEED] )
1N/A
1N/AC<VERSION> returns the version number of the class (package). If the
1N/ANEED argument is given then it will check that the current version (as
1N/Adefined by the $VERSION variable in the given package) not less than
1N/ANEED; it will die if this is not the case. This method is normally
1N/Acalled as a class method. This method is called automatically by the
1N/AC<VERSION> form of C<use>.
1N/A
1N/A use A 1.2 qw(some imported subs);
1N/A # implies:
1N/A A->VERSION(1.2);
1N/A
1N/A=back
1N/A
1N/AB<NOTE:> C<can> directly uses Perl's internal code for method lookup, and
1N/AC<isa> uses a very similar method and caching strategy. This may cause
1N/Astrange effects if the Perl code dynamically changes @ISA in any package.
1N/A
1N/AYou may add other methods to the UNIVERSAL class via Perl or XS code.
1N/AYou do not need to C<use UNIVERSAL> in order to make these methods
1N/Aavailable to your program. This is necessary only if you wish to
1N/Ahave C<isa> available as a plain subroutine in the current package.
1N/A
1N/A=head2 TIEHANDLE now supported
1N/A
1N/ASee L<perltie> for other kinds of tie()s.
1N/A
1N/A=over 4
1N/A
1N/A=item TIEHANDLE classname, LIST
1N/A
1N/AThis is the constructor for the class. That means it is expected to
1N/Areturn an object of some sort. The reference can be used to
1N/Ahold some internal information.
1N/A
1N/A sub TIEHANDLE {
1N/A print "<shout>\n";
1N/A my $i;
1N/A return bless \$i, shift;
1N/A }
1N/A
1N/A=item PRINT this, LIST
1N/A
1N/AThis method will be triggered every time the tied handle is printed to.
1N/ABeyond its self reference it also expects the list that was passed to
1N/Athe print function.
1N/A
1N/A sub PRINT {
1N/A $r = shift;
1N/A $$r++;
1N/A return print join( $, => map {uc} @_), $\;
1N/A }
1N/A
1N/A=item PRINTF this, LIST
1N/A
1N/AThis method will be triggered every time the tied handle is printed to
1N/Awith the C<printf()> function.
1N/ABeyond its self reference it also expects the format and list that was
1N/Apassed to the printf function.
1N/A
1N/A sub PRINTF {
1N/A shift;
1N/A my $fmt = shift;
1N/A print sprintf($fmt, @_)."\n";
1N/A }
1N/A
1N/A=item READ this LIST
1N/A
1N/AThis method will be called when the handle is read from via the C<read>
1N/Aor C<sysread> functions.
1N/A
1N/A sub READ {
1N/A $r = shift;
1N/A my($buf,$len,$offset) = @_;
1N/A print "READ called, \$buf=$buf, \$len=$len, \$offset=$offset";
1N/A }
1N/A
1N/A=item READLINE this
1N/A
1N/AThis method will be called when the handle is read from. The method
1N/Ashould return undef when there is no more data.
1N/A
1N/A sub READLINE {
1N/A $r = shift;
1N/A return "PRINT called $$r times\n"
1N/A }
1N/A
1N/A=item GETC this
1N/A
1N/AThis method will be called when the C<getc> function is called.
1N/A
1N/A sub GETC { print "Don't GETC, Get Perl"; return "a"; }
1N/A
1N/A=item DESTROY this
1N/A
1N/AAs with the other types of ties, this method will be called when the
1N/Atied handle is about to be destroyed. This is useful for debugging and
1N/Apossibly for cleaning up.
1N/A
1N/A sub DESTROY {
1N/A print "</shout>\n";
1N/A }
1N/A
1N/A=back
1N/A
1N/A=head2 Malloc enhancements
1N/A
1N/AIf perl is compiled with the malloc included with the perl distribution
1N/A(that is, if C<perl -V:d_mymalloc> is 'define') then you can print
1N/Amemory statistics at runtime by running Perl thusly:
1N/A
1N/A env PERL_DEBUG_MSTATS=2 perl your_script_here
1N/A
1N/AThe value of 2 means to print statistics after compilation and on
1N/Aexit; with a value of 1, the statistics are printed only on exit.
1N/A(If you want the statistics at an arbitrary time, you'll need to
1N/Ainstall the optional module Devel::Peek.)
1N/A
1N/AThree new compilation flags are recognized by malloc.c. (They have no
1N/Aeffect if perl is compiled with system malloc().)
1N/A
1N/A=over 4
1N/A
1N/A=item -DPERL_EMERGENCY_SBRK
1N/A
1N/AIf this macro is defined, running out of memory need not be a fatal
1N/Aerror: a memory pool can allocated by assigning to the special
1N/Avariable C<$^M>. See L<"$^M">.
1N/A
1N/A=item -DPACK_MALLOC
1N/A
1N/APerl memory allocation is by bucket with sizes close to powers of two.
1N/ABecause of these malloc overhead may be big, especially for data of
1N/Asize exactly a power of two. If C<PACK_MALLOC> is defined, perl uses
1N/Aa slightly different algorithm for small allocations (up to 64 bytes
1N/Along), which makes it possible to have overhead down to 1 byte for
1N/Aallocations which are powers of two (and appear quite often).
1N/A
1N/AExpected memory savings (with 8-byte alignment in C<alignbytes>) is
1N/Aabout 20% for typical Perl usage. Expected slowdown due to additional
1N/Amalloc overhead is in fractions of a percent (hard to measure, because
1N/Aof the effect of saved memory on speed).
1N/A
1N/A=item -DTWO_POT_OPTIMIZE
1N/A
1N/ASimilarly to C<PACK_MALLOC>, this macro improves allocations of data
1N/Awith size close to a power of two; but this works for big allocations
1N/A(starting with 16K by default). Such allocations are typical for big
1N/Ahashes and special-purpose scripts, especially image processing.
1N/A
1N/AOn recent systems, the fact that perl requires 2M from system for 1M
1N/Aallocation will not affect speed of execution, since the tail of such
1N/Aa chunk is not going to be touched (and thus will not require real
1N/Amemory). However, it may result in a premature out-of-memory error.
1N/ASo if you will be manipulating very large blocks with sizes close to
1N/Apowers of two, it would be wise to define this macro.
1N/A
1N/AExpected saving of memory is 0-100% (100% in applications which
1N/Arequire most memory in such 2**n chunks); expected slowdown is
1N/Anegligible.
1N/A
1N/A=back
1N/A
1N/A=head2 Miscellaneous efficiency enhancements
1N/A
1N/AFunctions that have an empty prototype and that do nothing but return
1N/Aa fixed value are now inlined (e.g. C<sub PI () { 3.14159 }>).
1N/A
1N/AEach unique hash key is only allocated once, no matter how many hashes
1N/Ahave an entry with that key. So even if you have 100 copies of the
1N/Asame hash, the hash keys never have to be reallocated.
1N/A
1N/A=head1 Support for More Operating Systems
1N/A
1N/ASupport for the following operating systems is new in Perl 5.004.
1N/A
1N/A=head2 Win32
1N/A
1N/APerl 5.004 now includes support for building a "native" perl under
1N/AWindows NT, using the Microsoft Visual C++ compiler (versions 2.0
1N/Aand above) or the Borland C++ compiler (versions 5.02 and above).
1N/AThe resulting perl can be used under Windows 95 (if it
1N/Ais installed in the same directory locations as it got installed
1N/Ain Windows NT). This port includes support for perl extension
1N/Abuilding tools like L<MakeMaker> and L<h2xs>, so that many extensions
1N/Aavailable on the Comprehensive Perl Archive Network (CPAN) can now be
1N/Areadily built under Windows NT. See http://www.perl.com/ for more
1N/Ainformation on CPAN and F<README.win32> in the perl distribution for more
1N/Adetails on how to get started with building this port.
1N/A
1N/AThere is also support for building perl under the Cygwin32 environment.
1N/ACygwin32 is a set of GNU tools that make it possible to compile and run
1N/Amany Unix programs under Windows NT by providing a mostly Unix-like
1N/Ainterface for compilation and execution. See F<README.cygwin32> in the
1N/Aperl distribution for more details on this port and how to obtain the
1N/ACygwin32 toolkit.
1N/A
1N/A=head2 Plan 9
1N/A
1N/ASee F<README.plan9> in the perl distribution.
1N/A
1N/A=head2 QNX
1N/A
1N/ASee F<README.qnx> in the perl distribution.
1N/A
1N/A=head2 AmigaOS
1N/A
1N/ASee F<README.amigaos> in the perl distribution.
1N/A
1N/A=head1 Pragmata
1N/A
1N/ASix new pragmatic modules exist:
1N/A
1N/A=over 4
1N/A
1N/A=item use autouse MODULE => qw(sub1 sub2 sub3)
1N/A
1N/ADefers C<require MODULE> until someone calls one of the specified
1N/Asubroutines (which must be exported by MODULE). This pragma should be
1N/Aused with caution, and only when necessary.
1N/A
1N/A=item use blib
1N/A
1N/A=item use blib 'dir'
1N/A
1N/ALooks for MakeMaker-like I<'blib'> directory structure starting in
1N/AI<dir> (or current directory) and working back up to five levels of
1N/Aparent directories.
1N/A
1N/AIntended for use on command line with B<-M> option as a way of testing
1N/Aarbitrary scripts against an uninstalled version of a package.
1N/A
1N/A=item use constant NAME => VALUE
1N/A
1N/AProvides a convenient interface for creating compile-time constants,
1N/ASee L<perlsub/"Constant Functions">.
1N/A
1N/A=item use locale
1N/A
1N/ATells the compiler to enable (or disable) the use of POSIX locales for
1N/Abuiltin operations.
1N/A
1N/AWhen C<use locale> is in effect, the current LC_CTYPE locale is used
1N/Afor regular expressions and case mapping; LC_COLLATE for string
1N/Aordering; and LC_NUMERIC for numeric formatting in printf and sprintf
1N/A(but B<not> in print). LC_NUMERIC is always used in write, since
1N/Alexical scoping of formats is problematic at best.
1N/A
1N/AEach C<use locale> or C<no locale> affects statements to the end of
1N/Athe enclosing BLOCK or, if not inside a BLOCK, to the end of the
1N/Acurrent file. Locales can be switched and queried with
1N/APOSIX::setlocale().
1N/A
1N/ASee L<perllocale> for more information.
1N/A
1N/A=item use ops
1N/A
1N/ADisable unsafe opcodes, or any named opcodes, when compiling Perl code.
1N/A
1N/A=item use vmsish
1N/A
1N/AEnable VMS-specific language features. Currently, there are three
1N/AVMS-specific features available: 'status', which makes C<$?> and
1N/AC<system> return genuine VMS status values instead of emulating POSIX;
1N/A'exit', which makes C<exit> take a genuine VMS status value instead of
1N/Aassuming that C<exit 1> is an error; and 'time', which makes all times
1N/Arelative to the local time zone, in the VMS tradition.
1N/A
1N/A=back
1N/A
1N/A=head1 Modules
1N/A
1N/A=head2 Required Updates
1N/A
1N/AThough Perl 5.004 is compatible with almost all modules that work
1N/Awith Perl 5.003, there are a few exceptions:
1N/A
1N/A Module Required Version for Perl 5.004
1N/A ------ -------------------------------
1N/A Filter Filter-1.12
1N/A LWP libwww-perl-5.08
1N/A Tk Tk400.202 (-w makes noise)
1N/A
1N/AAlso, the majordomo mailing list program, version 1.94.1, doesn't work
1N/Awith Perl 5.004 (nor with perl 4), because it executes an invalid
1N/Aregular expression. This bug is fixed in majordomo version 1.94.2.
1N/A
1N/A=head2 Installation directories
1N/A
1N/AThe I<installperl> script now places the Perl source files for
1N/Aextensions in the architecture-specific library directory, which is
1N/Awhere the shared libraries for extensions have always been. This
1N/Achange is intended to allow administrators to keep the Perl 5.004
1N/Alibrary directory unchanged from a previous version, without running
1N/Athe risk of binary incompatibility between extensions' Perl source and
1N/Ashared libraries.
1N/A
1N/A=head2 Module information summary
1N/A
1N/ABrand new modules, arranged by topic rather than strictly
1N/Aalphabetically:
1N/A
1N/A CGI.pm Web server interface ("Common Gateway Interface")
1N/A CGI/Apache.pm Support for Apache's Perl module
1N/A CGI/Carp.pm Log server errors with helpful context
1N/A CGI/Fast.pm Support for FastCGI (persistent server process)
1N/A CGI/Push.pm Support for server push
1N/A CGI/Switch.pm Simple interface for multiple server types
1N/A
1N/A CPAN Interface to Comprehensive Perl Archive Network
1N/A CPAN::FirstTime Utility for creating CPAN configuration file
1N/A CPAN::Nox Runs CPAN while avoiding compiled extensions
1N/A
1N/A IO.pm Top-level interface to IO::* classes
1N/A IO/File.pm IO::File extension Perl module
1N/A IO/Handle.pm IO::Handle extension Perl module
1N/A IO/Pipe.pm IO::Pipe extension Perl module
1N/A IO/Seekable.pm IO::Seekable extension Perl module
1N/A IO/Select.pm IO::Select extension Perl module
1N/A IO/Socket.pm IO::Socket extension Perl module
1N/A
1N/A Opcode.pm Disable named opcodes when compiling Perl code
1N/A
1N/A ExtUtils/Embed.pm Utilities for embedding Perl in C programs
1N/A ExtUtils/testlib.pm Fixes up @INC to use just-built extension
1N/A
1N/A FindBin.pm Find path of currently executing program
1N/A
1N/A Class/Struct.pm Declare struct-like datatypes as Perl classes
1N/A File/stat.pm By-name interface to Perl's builtin stat
1N/A Net/hostent.pm By-name interface to Perl's builtin gethost*
1N/A Net/netent.pm By-name interface to Perl's builtin getnet*
1N/A Net/protoent.pm By-name interface to Perl's builtin getproto*
1N/A Net/servent.pm By-name interface to Perl's builtin getserv*
1N/A Time/gmtime.pm By-name interface to Perl's builtin gmtime
1N/A Time/localtime.pm By-name interface to Perl's builtin localtime
1N/A Time/tm.pm Internal object for Time::{gm,local}time
1N/A User/grent.pm By-name interface to Perl's builtin getgr*
1N/A User/pwent.pm By-name interface to Perl's builtin getpw*
1N/A
1N/A Tie/RefHash.pm Base class for tied hashes with references as keys
1N/A
1N/A UNIVERSAL.pm Base class for *ALL* classes
1N/A
1N/A=head2 Fcntl
1N/A
1N/ANew constants in the existing Fcntl modules are now supported,
1N/Aprovided that your operating system happens to support them:
1N/A
1N/A F_GETOWN F_SETOWN
1N/A O_ASYNC O_DEFER O_DSYNC O_FSYNC O_SYNC
1N/A O_EXLOCK O_SHLOCK
1N/A
1N/AThese constants are intended for use with the Perl operators sysopen()
1N/Aand fcntl() and the basic database modules like SDBM_File. For the
1N/Aexact meaning of these and other Fcntl constants please refer to your
1N/Aoperating system's documentation for fcntl() and open().
1N/A
1N/AIn addition, the Fcntl module now provides these constants for use
1N/Awith the Perl operator flock():
1N/A
1N/A LOCK_SH LOCK_EX LOCK_NB LOCK_UN
1N/A
1N/AThese constants are defined in all environments (because where there is
1N/Ano flock() system call, Perl emulates it). However, for historical
1N/Areasons, these constants are not exported unless they are explicitly
1N/Arequested with the ":flock" tag (e.g. C<use Fcntl ':flock'>).
1N/A
1N/A=head2 IO
1N/A
1N/AThe IO module provides a simple mechanism to load all the IO modules at one
1N/Ago. Currently this includes:
1N/A
1N/A IO::Handle
1N/A IO::Seekable
1N/A IO::File
1N/A IO::Pipe
1N/A IO::Socket
1N/A
1N/AFor more information on any of these modules, please see its
1N/Arespective documentation.
1N/A
1N/A=head2 Math::Complex
1N/A
1N/AThe Math::Complex module has been totally rewritten, and now supports
1N/Amore operations. These are overloaded:
1N/A
1N/A + - * / ** <=> neg ~ abs sqrt exp log sin cos atan2 "" (stringify)
1N/A
1N/AAnd these functions are now exported:
1N/A
1N/A pi i Re Im arg
1N/A log10 logn ln cbrt root
1N/A tan
1N/A csc sec cot
1N/A asin acos atan
1N/A acsc asec acot
1N/A sinh cosh tanh
1N/A csch sech coth
1N/A asinh acosh atanh
1N/A acsch asech acoth
1N/A cplx cplxe
1N/A
1N/A=head2 Math::Trig
1N/A
1N/AThis new module provides a simpler interface to parts of Math::Complex for
1N/Athose who need trigonometric functions only for real numbers.
1N/A
1N/A=head2 DB_File
1N/A
1N/AThere have been quite a few changes made to DB_File. Here are a few of
1N/Athe highlights:
1N/A
1N/A=over 4
1N/A
1N/A=item *
1N/A
1N/AFixed a handful of bugs.
1N/A
1N/A=item *
1N/A
1N/ABy public demand, added support for the standard hash function exists().
1N/A
1N/A=item *
1N/A
1N/AMade it compatible with Berkeley DB 1.86.
1N/A
1N/A=item *
1N/A
1N/AMade negative subscripts work with RECNO interface.
1N/A
1N/A=item *
1N/A
1N/AChanged the default flags from O_RDWR to O_CREAT|O_RDWR and the default
1N/Amode from 0640 to 0666.
1N/A
1N/A=item *
1N/A
1N/AMade DB_File automatically import the open() constants (O_RDWR,
1N/AO_CREAT etc.) from Fcntl, if available.
1N/A
1N/A=item *
1N/A
1N/AUpdated documentation.
1N/A
1N/A=back
1N/A
1N/ARefer to the HISTORY section in DB_File.pm for a complete list of
1N/Achanges. Everything after DB_File 1.01 has been added since 5.003.
1N/A
1N/A=head2 Net::Ping
1N/A
1N/AMajor rewrite - support added for both udp echo and real icmp pings.
1N/A
1N/A=head2 Object-oriented overrides for builtin operators
1N/A
1N/AMany of the Perl builtins returning lists now have
1N/Aobject-oriented overrides. These are:
1N/A
1N/A File::stat
1N/A Net::hostent
1N/A Net::netent
1N/A Net::protoent
1N/A Net::servent
1N/A Time::gmtime
1N/A Time::localtime
1N/A User::grent
1N/A User::pwent
1N/A
1N/AFor example, you can now say
1N/A
1N/A use File::stat;
1N/A use User::pwent;
1N/A $his = (stat($filename)->st_uid == pwent($whoever)->pw_uid);
1N/A
1N/A=head1 Utility Changes
1N/A
1N/A=head2 pod2html
1N/A
1N/A=over 4
1N/A
1N/A=item Sends converted HTML to standard output
1N/A
1N/AThe I<pod2html> utility included with Perl 5.004 is entirely new.
1N/ABy default, it sends the converted HTML to its standard output,
1N/Ainstead of writing it to a file like Perl 5.003's I<pod2html> did.
1N/AUse the B<--outfile=FILENAME> option to write to a file.
1N/A
1N/A=back
1N/A
1N/A=head2 xsubpp
1N/A
1N/A=over 4
1N/A
1N/A=item C<void> XSUBs now default to returning nothing
1N/A
1N/ADue to a documentation/implementation bug in previous versions of
1N/APerl, XSUBs with a return type of C<void> have actually been
1N/Areturning one value. Usually that value was the GV for the XSUB,
1N/Abut sometimes it was some already freed or reused value, which would
1N/Asometimes lead to program failure.
1N/A
1N/AIn Perl 5.004, if an XSUB is declared as returning C<void>, it
1N/Aactually returns no value, i.e. an empty list (though there is a
1N/Abackward-compatibility exception; see below). If your XSUB really
1N/Adoes return an SV, you should give it a return type of C<SV *>.
1N/A
1N/AFor backward compatibility, I<xsubpp> tries to guess whether a
1N/AC<void> XSUB is really C<void> or if it wants to return an C<SV *>.
1N/AIt does so by examining the text of the XSUB: if I<xsubpp> finds
1N/Awhat looks like an assignment to C<ST(0)>, it assumes that the
1N/AXSUB's return type is really C<SV *>.
1N/A
1N/A=back
1N/A
1N/A=head1 C Language API Changes
1N/A
1N/A=over 4
1N/A
1N/A=item C<gv_fetchmethod> and C<perl_call_sv>
1N/A
1N/AThe C<gv_fetchmethod> function finds a method for an object, just like
1N/Ain Perl 5.003. The GV it returns may be a method cache entry.
1N/AHowever, in Perl 5.004, method cache entries are not visible to users;
1N/Atherefore, they can no longer be passed directly to C<perl_call_sv>.
1N/AInstead, you should use the C<GvCV> macro on the GV to extract its CV,
1N/Aand pass the CV to C<perl_call_sv>.
1N/A
1N/AThe most likely symptom of passing the result of C<gv_fetchmethod> to
1N/AC<perl_call_sv> is Perl's producing an "Undefined subroutine called"
1N/Aerror on the I<second> call to a given method (since there is no cache
1N/Aon the first call).
1N/A
1N/A=item C<perl_eval_pv>
1N/A
1N/AA new function handy for eval'ing strings of Perl code inside C code.
1N/AThis function returns the value from the eval statement, which can
1N/Abe used instead of fetching globals from the symbol table. See
1N/AL<perlguts>, L<perlembed> and L<perlcall> for details and examples.
1N/A
1N/A=item Extended API for manipulating hashes
1N/A
1N/AInternal handling of hash keys has changed. The old hashtable API is
1N/Astill fully supported, and will likely remain so. The additions to the
1N/AAPI allow passing keys as C<SV*>s, so that C<tied> hashes can be given
1N/Areal scalars as keys rather than plain strings (nontied hashes still
1N/Acan only use strings as keys). New extensions must use the new hash
1N/Aaccess functions and macros if they wish to use C<SV*> keys. These
1N/Aadditions also make it feasible to manipulate C<HE*>s (hash entries),
1N/Awhich can be more efficient. See L<perlguts> for details.
1N/A
1N/A=back
1N/A
1N/A=head1 Documentation Changes
1N/A
1N/AMany of the base and library pods were updated. These
1N/Anew pods are included in section 1:
1N/A
1N/A=over 4
1N/A
1N/A=item L<perldelta>
1N/A
1N/AThis document.
1N/A
1N/A=item L<perlfaq>
1N/A
1N/AFrequently asked questions.
1N/A
1N/A=item L<perllocale>
1N/A
1N/ALocale support (internationalization and localization).
1N/A
1N/A=item L<perltoot>
1N/A
1N/ATutorial on Perl OO programming.
1N/A
1N/A=item L<perlapio>
1N/A
1N/APerl internal IO abstraction interface.
1N/A
1N/A=item L<perlmodlib>
1N/A
1N/APerl module library and recommended practice for module creation.
1N/AExtracted from L<perlmod> (which is much smaller as a result).
1N/A
1N/A=item L<perldebug>
1N/A
1N/AAlthough not new, this has been massively updated.
1N/A
1N/A=item L<perlsec>
1N/A
1N/AAlthough not new, this has been massively updated.
1N/A
1N/A=back
1N/A
1N/A=head1 New Diagnostics
1N/A
1N/ASeveral new conditions will trigger warnings that were
1N/Asilent before. Some only affect certain platforms.
1N/AThe following new warnings and errors outline these.
1N/AThese messages are classified as follows (listed in
1N/Aincreasing order of desperation):
1N/A
1N/A (W) A warning (optional).
1N/A (D) A deprecation (optional).
1N/A (S) A severe warning (mandatory).
1N/A (F) A fatal error (trappable).
1N/A (P) An internal error you should never see (trappable).
1N/A (X) A very fatal error (nontrappable).
1N/A (A) An alien error message (not generated by Perl).
1N/A
1N/A=over 4
1N/A
1N/A=item "my" variable %s masks earlier declaration in same scope
1N/A
1N/A(W) A lexical variable has been redeclared in the same scope, effectively
1N/Aeliminating all access to the previous instance. This is almost always
1N/Aa typographical error. Note that the earlier variable will still exist
1N/Auntil the end of the scope or until all closure referents to it are
1N/Adestroyed.
1N/A
1N/A=item %s argument is not a HASH element or slice
1N/A
1N/A(F) The argument to delete() must be either a hash element, such as
1N/A
1N/A $foo{$bar}
1N/A $ref->[12]->{"susie"}
1N/A
1N/Aor a hash slice, such as
1N/A
1N/A @foo{$bar, $baz, $xyzzy}
1N/A @{$ref->[12]}{"susie", "queue"}
1N/A
1N/A=item Allocation too large: %lx
1N/A
1N/A(X) You can't allocate more than 64K on an MS-DOS machine.
1N/A
1N/A=item Allocation too large
1N/A
1N/A(F) You can't allocate more than 2^31+"small amount" bytes.
1N/A
1N/A=item Applying %s to %s will act on scalar(%s)
1N/A
1N/A(W) The pattern match (//), substitution (s///), and transliteration (tr///)
1N/Aoperators work on scalar values. If you apply one of them to an array
1N/Aor a hash, it will convert the array or hash to a scalar value -- the
1N/Alength of an array, or the population info of a hash -- and then work on
1N/Athat scalar value. This is probably not what you meant to do. See
1N/AL<perlfunc/grep> and L<perlfunc/map> for alternatives.
1N/A
1N/A=item Attempt to free nonexistent shared string
1N/A
1N/A(P) Perl maintains a reference counted internal table of strings to
1N/Aoptimize the storage and access of hash keys and other strings. This
1N/Aindicates someone tried to decrement the reference count of a string
1N/Athat can no longer be found in the table.
1N/A
1N/A=item Attempt to use reference as lvalue in substr
1N/A
1N/A(W) You supplied a reference as the first argument to substr() used
1N/Aas an lvalue, which is pretty strange. Perhaps you forgot to
1N/Adereference it first. See L<perlfunc/substr>.
1N/A
1N/A=item Bareword "%s" refers to nonexistent package
1N/A
1N/A(W) You used a qualified bareword of the form C<Foo::>, but
1N/Athe compiler saw no other uses of that namespace before that point.
1N/APerhaps you need to predeclare a package?
1N/A
1N/A=item Can't redefine active sort subroutine %s
1N/A
1N/A(F) Perl optimizes the internal handling of sort subroutines and keeps
1N/Apointers into them. You tried to redefine one such sort subroutine when it
1N/Awas currently active, which is not allowed. If you really want to do
1N/Athis, you should write C<sort { &func } @x> instead of C<sort func @x>.
1N/A
1N/A=item Can't use bareword ("%s") as %s ref while "strict refs" in use
1N/A
1N/A(F) Only hard references are allowed by "strict refs". Symbolic references
1N/Aare disallowed. See L<perlref>.
1N/A
1N/A=item Cannot resolve method `%s' overloading `%s' in package `%s'
1N/A
1N/A(P) Internal error trying to resolve overloading specified by a method
1N/Aname (as opposed to a subroutine reference).
1N/A
1N/A=item Constant subroutine %s redefined
1N/A
1N/A(S) You redefined a subroutine which had previously been eligible for
1N/Ainlining. See L<perlsub/"Constant Functions"> for commentary and
1N/Aworkarounds.
1N/A
1N/A=item Constant subroutine %s undefined
1N/A
1N/A(S) You undefined a subroutine which had previously been eligible for
1N/Ainlining. See L<perlsub/"Constant Functions"> for commentary and
1N/Aworkarounds.
1N/A
1N/A=item Copy method did not return a reference
1N/A
1N/A(F) The method which overloads "=" is buggy. See L<overload/Copy Constructor>.
1N/A
1N/A=item Died
1N/A
1N/A(F) You passed die() an empty string (the equivalent of C<die "">) or
1N/Ayou called it with no args and both C<$@> and C<$_> were empty.
1N/A
1N/A=item Exiting pseudo-block via %s
1N/A
1N/A(W) You are exiting a rather special block construct (like a sort block or
1N/Asubroutine) by unconventional means, such as a goto, or a loop control
1N/Astatement. See L<perlfunc/sort>.
1N/A
1N/A=item Identifier too long
1N/A
1N/A(F) Perl limits identifiers (names for variables, functions, etc.) to
1N/A252 characters for simple names, somewhat more for compound names (like
1N/AC<$A::B>). You've exceeded Perl's limits. Future versions of Perl are
1N/Alikely to eliminate these arbitrary limitations.
1N/A
1N/A=item Illegal character %s (carriage return)
1N/A
1N/A(F) A carriage return character was found in the input. This is an
1N/Aerror, and not a warning, because carriage return characters can break
1N/Amulti-line strings, including here documents (e.g., C<print <<EOF;>).
1N/A
1N/A=item Illegal switch in PERL5OPT: %s
1N/A
1N/A(X) The PERL5OPT environment variable may only be used to set the
1N/Afollowing switches: B<-[DIMUdmw]>.
1N/A
1N/A=item Integer overflow in hex number
1N/A
1N/A(S) The literal hex number you have specified is too big for your
1N/Aarchitecture. On a 32-bit architecture the largest hex literal is
1N/A0xFFFFFFFF.
1N/A
1N/A=item Integer overflow in octal number
1N/A
1N/A(S) The literal octal number you have specified is too big for your
1N/Aarchitecture. On a 32-bit architecture the largest octal literal is
1N/A037777777777.
1N/A
1N/A=item internal error: glob failed
1N/A
1N/A(P) Something went wrong with the external program(s) used for C<glob>
1N/Aand C<< <*.c> >>. This may mean that your csh (C shell) is
1N/Abroken. If so, you should change all of the csh-related variables in
1N/Aconfig.sh: If you have tcsh, make the variables refer to it as if it
1N/Awere csh (e.g. C<full_csh='/usr/bin/tcsh'>); otherwise, make them all
1N/Aempty (except that C<d_csh> should be C<'undef'>) so that Perl will
1N/Athink csh is missing. In either case, after editing config.sh, run
1N/AC<./Configure -S> and rebuild Perl.
1N/A
1N/A=item Invalid conversion in %s: "%s"
1N/A
1N/A(W) Perl does not understand the given format conversion.
1N/ASee L<perlfunc/sprintf>.
1N/A
1N/A=item Invalid type in pack: '%s'
1N/A
1N/A(F) The given character is not a valid pack type. See L<perlfunc/pack>.
1N/A
1N/A=item Invalid type in unpack: '%s'
1N/A
1N/A(F) The given character is not a valid unpack type. See L<perlfunc/unpack>.
1N/A
1N/A=item Name "%s::%s" used only once: possible typo
1N/A
1N/A(W) Typographical errors often show up as unique variable names.
1N/AIf you had a good reason for having a unique name, then just mention
1N/Ait again somehow to suppress the message (the C<use vars> pragma is
1N/Aprovided for just this purpose).
1N/A
1N/A=item Null picture in formline
1N/A
1N/A(F) The first argument to formline must be a valid format picture
1N/Aspecification. It was found to be empty, which probably means you
1N/Asupplied it an uninitialized value. See L<perlform>.
1N/A
1N/A=item Offset outside string
1N/A
1N/A(F) You tried to do a read/write/send/recv operation with an offset
1N/Apointing outside the buffer. This is difficult to imagine.
1N/AThe sole exception to this is that C<sysread()>ing past the buffer
1N/Awill extend the buffer and zero pad the new area.
1N/A
1N/A=item Out of memory!
1N/A
1N/A(X|F) The malloc() function returned 0, indicating there was insufficient
1N/Aremaining memory (or virtual memory) to satisfy the request.
1N/A
1N/AThe request was judged to be small, so the possibility to trap it
1N/Adepends on the way Perl was compiled. By default it is not trappable.
1N/AHowever, if compiled for this, Perl may use the contents of C<$^M> as
1N/Aan emergency pool after die()ing with this message. In this case the
1N/Aerror is trappable I<once>.
1N/A
1N/A=item Out of memory during request for %s
1N/A
1N/A(F) The malloc() function returned 0, indicating there was insufficient
1N/Aremaining memory (or virtual memory) to satisfy the request. However,
1N/Athe request was judged large enough (compile-time default is 64K), so
1N/Aa possibility to shut down by trapping this error is granted.
1N/A
1N/A=item panic: frexp
1N/A
1N/A(P) The library function frexp() failed, making printf("%f") impossible.
1N/A
1N/A=item Possible attempt to put comments in qw() list
1N/A
1N/A(W) qw() lists contain items separated by whitespace; as with literal
1N/Astrings, comment characters are not ignored, but are instead treated
1N/Aas literal data. (You may have used different delimiters than the
1N/Aparentheses shown here; braces are also frequently used.)
1N/A
1N/AYou probably wrote something like this:
1N/A
1N/A @list = qw(
1N/A a # a comment
1N/A b # another comment
1N/A );
1N/A
1N/Awhen you should have written this:
1N/A
1N/A @list = qw(
1N/A a
1N/A b
1N/A );
1N/A
1N/AIf you really want comments, build your list the
1N/Aold-fashioned way, with quotes and commas:
1N/A
1N/A @list = (
1N/A 'a', # a comment
1N/A 'b', # another comment
1N/A );
1N/A
1N/A=item Possible attempt to separate words with commas
1N/A
1N/A(W) qw() lists contain items separated by whitespace; therefore commas
1N/Aaren't needed to separate the items. (You may have used different
1N/Adelimiters than the parentheses shown here; braces are also frequently
1N/Aused.)
1N/A
1N/AYou probably wrote something like this:
1N/A
1N/A qw! a, b, c !;
1N/A
1N/Awhich puts literal commas into some of the list items. Write it without
1N/Acommas if you don't want them to appear in your data:
1N/A
1N/A qw! a b c !;
1N/A
1N/A=item Scalar value @%s{%s} better written as $%s{%s}
1N/A
1N/A(W) You've used a hash slice (indicated by @) to select a single element of
1N/Aa hash. Generally it's better to ask for a scalar value (indicated by $).
1N/AThe difference is that C<$foo{&bar}> always behaves like a scalar, both when
1N/Aassigning to it and when evaluating its argument, while C<@foo{&bar}> behaves
1N/Alike a list when you assign to it, and provides a list context to its
1N/Asubscript, which can do weird things if you're expecting only one subscript.
1N/A
1N/A=item Stub found while resolving method `%s' overloading `%s' in %s
1N/A
1N/A(P) Overloading resolution over @ISA tree may be broken by importing stubs.
1N/AStubs should never be implicitly created, but explicit calls to C<can>
1N/Amay break this.
1N/A
1N/A=item Too late for "B<-T>" option
1N/A
1N/A(X) The #! line (or local equivalent) in a Perl script contains the
1N/AB<-T> option, but Perl was not invoked with B<-T> in its argument
1N/Alist. This is an error because, by the time Perl discovers a B<-T> in
1N/Aa script, it's too late to properly taint everything from the
1N/Aenvironment. So Perl gives up.
1N/A
1N/A=item untie attempted while %d inner references still exist
1N/A
1N/A(W) A copy of the object returned from C<tie> (or C<tied>) was still
1N/Avalid when C<untie> was called.
1N/A
1N/A=item Unrecognized character %s
1N/A
1N/A(F) The Perl parser has no idea what to do with the specified character
1N/Ain your Perl script (or eval). Perhaps you tried to run a compressed
1N/Ascript, a binary program, or a directory as a Perl program.
1N/A
1N/A=item Unsupported function fork
1N/A
1N/A(F) Your version of executable does not support forking.
1N/A
1N/ANote that under some systems, like OS/2, there may be different flavors of
1N/APerl executables, some of which may support fork, some not. Try changing
1N/Athe name you call Perl by to C<perl_>, C<perl__>, and so on.
1N/A
1N/A=item Use of "$$<digit>" to mean "${$}<digit>" is deprecated
1N/A
1N/A(D) Perl versions before 5.004 misinterpreted any type marker followed
1N/Aby "$" and a digit. For example, "$$0" was incorrectly taken to mean
1N/A"${$}0" instead of "${$0}". This bug is (mostly) fixed in Perl 5.004.
1N/A
1N/AHowever, the developers of Perl 5.004 could not fix this bug completely,
1N/Abecause at least two widely-used modules depend on the old meaning of
1N/A"$$0" in a string. So Perl 5.004 still interprets "$$<digit>" in the
1N/Aold (broken) way inside strings; but it generates this message as a
1N/Awarning. And in Perl 5.005, this special treatment will cease.
1N/A
1N/A=item Value of %s can be "0"; test with defined()
1N/A
1N/A(W) In a conditional expression, you used <HANDLE>, <*> (glob), C<each()>,
1N/Aor C<readdir()> as a boolean value. Each of these constructs can return a
1N/Avalue of "0"; that would make the conditional expression false, which is
1N/Aprobably not what you intended. When using these constructs in conditional
1N/Aexpressions, test their values with the C<defined> operator.
1N/A
1N/A=item Variable "%s" may be unavailable
1N/A
1N/A(W) An inner (nested) I<anonymous> subroutine is inside a I<named>
1N/Asubroutine, and outside that is another subroutine; and the anonymous
1N/A(innermost) subroutine is referencing a lexical variable defined in
1N/Athe outermost subroutine. For example:
1N/A
1N/A sub outermost { my $a; sub middle { sub { $a } } }
1N/A
1N/AIf the anonymous subroutine is called or referenced (directly or
1N/Aindirectly) from the outermost subroutine, it will share the variable
1N/Aas you would expect. But if the anonymous subroutine is called or
1N/Areferenced when the outermost subroutine is not active, it will see
1N/Athe value of the shared variable as it was before and during the
1N/A*first* call to the outermost subroutine, which is probably not what
1N/Ayou want.
1N/A
1N/AIn these circumstances, it is usually best to make the middle
1N/Asubroutine anonymous, using the C<sub {}> syntax. Perl has specific
1N/Asupport for shared variables in nested anonymous subroutines; a named
1N/Asubroutine in between interferes with this feature.
1N/A
1N/A=item Variable "%s" will not stay shared
1N/A
1N/A(W) An inner (nested) I<named> subroutine is referencing a lexical
1N/Avariable defined in an outer subroutine.
1N/A
1N/AWhen the inner subroutine is called, it will probably see the value of
1N/Athe outer subroutine's variable as it was before and during the
1N/A*first* call to the outer subroutine; in this case, after the first
1N/Acall to the outer subroutine is complete, the inner and outer
1N/Asubroutines will no longer share a common value for the variable. In
1N/Aother words, the variable will no longer be shared.
1N/A
1N/AFurthermore, if the outer subroutine is anonymous and references a
1N/Alexical variable outside itself, then the outer and inner subroutines
1N/Awill I<never> share the given variable.
1N/A
1N/AThis problem can usually be solved by making the inner subroutine
1N/Aanonymous, using the C<sub {}> syntax. When inner anonymous subs that
1N/Areference variables in outer subroutines are called or referenced,
1N/Athey are automatically rebound to the current values of such
1N/Avariables.
1N/A
1N/A=item Warning: something's wrong
1N/A
1N/A(W) You passed warn() an empty string (the equivalent of C<warn "">) or
1N/Ayou called it with no args and C<$_> was empty.
1N/A
1N/A=item Ill-formed logical name |%s| in prime_env_iter
1N/A
1N/A(W) A warning peculiar to VMS. A logical name was encountered when preparing
1N/Ato iterate over %ENV which violates the syntactic rules governing logical
1N/Anames. Since it cannot be translated normally, it is skipped, and will not
1N/Aappear in %ENV. This may be a benign occurrence, as some software packages
1N/Amight directly modify logical name tables and introduce nonstandard names,
1N/Aor it may indicate that a logical name table has been corrupted.
1N/A
1N/A=item Got an error from DosAllocMem
1N/A
1N/A(P) An error peculiar to OS/2. Most probably you're using an obsolete
1N/Aversion of Perl, and this should not happen anyway.
1N/A
1N/A=item Malformed PERLLIB_PREFIX
1N/A
1N/A(F) An error peculiar to OS/2. PERLLIB_PREFIX should be of the form
1N/A
1N/A prefix1;prefix2
1N/A
1N/Aor
1N/A
1N/A prefix1 prefix2
1N/A
1N/Awith nonempty prefix1 and prefix2. If C<prefix1> is indeed a prefix
1N/Aof a builtin library search path, prefix2 is substituted. The error
1N/Amay appear if components are not found, or are too long. See
1N/A"PERLLIB_PREFIX" in F<README.os2>.
1N/A
1N/A=item PERL_SH_DIR too long
1N/A
1N/A(F) An error peculiar to OS/2. PERL_SH_DIR is the directory to find the
1N/AC<sh>-shell in. See "PERL_SH_DIR" in F<README.os2>.
1N/A
1N/A=item Process terminated by SIG%s
1N/A
1N/A(W) This is a standard message issued by OS/2 applications, while *nix
1N/Aapplications die in silence. It is considered a feature of the OS/2
1N/Aport. One can easily disable this by appropriate sighandlers, see
1N/AL<perlipc/"Signals">. See also "Process terminated by SIGTERM/SIGINT"
1N/Ain F<README.os2>.
1N/A
1N/A=back
1N/A
1N/A=head1 BUGS
1N/A
1N/AIf you find what you think is a bug, you might check the headers of
1N/Arecently posted articles in the comp.lang.perl.misc newsgroup.
1N/AThere may also be information at http://www.perl.com/perl/ , the Perl
1N/AHome Page.
1N/A
1N/AIf you believe you have an unreported bug, please run the B<perlbug>
1N/Aprogram included with your release. Make sure you trim your bug down
1N/Ato a tiny but sufficient test case. Your bug report, along with the
1N/Aoutput of C<perl -V>, will be sent off to <F<perlbug@perl.com>> to be
1N/Aanalysed by the Perl porting team.
1N/A
1N/A=head1 SEE ALSO
1N/A
1N/AThe F<Changes> file for exhaustive details on what changed.
1N/A
1N/AThe F<INSTALL> file for how to build Perl. This file has been
1N/Asignificantly updated for 5.004, so even veteran users should
1N/Alook through it.
1N/A
1N/AThe F<README> file for general stuff.
1N/A
1N/AThe F<Copying> file for copyright information.
1N/A
1N/A=head1 HISTORY
1N/A
1N/AConstructed by Tom Christiansen, grabbing material with permission
1N/Afrom innumerable contributors, with kibitzing by more than a few Perl
1N/Aporters.
1N/A
1N/ALast update: Wed May 14 11:14:09 EDT 1997