These messages are classified as follows (listed in increasing order of desperation):
| Class | Meaning |
|---|---|
| (W) | A warning (optional) |
| (D) | A deprecation (optional) |
| (S) | A severe warning (mandatory) |
| (F) | A fatal error (trappable) |
| (P) | An internal error (panic) that you should never see (trappable) |
| (X) | A very fatal error (non-trappable) |
| (A) | An alien error message (not generated by Perl) |
Optional warnings are enabled by using the -w switch. Warnings may be captured by setting $SIG{_ _WARN_ _} to a reference to a routine that will be called on each warning before printing it. Trappable errors may be trapped using eval. You can also capture control before a trappable error "dies" by setting $SIG{_ _DIE_ _} to a subroutine reference, but if you don't call die within that handler, the fatal exception is still thrown when you return from it. In other words, you're not allowed to "de-fatalize" an exception that way. You must use an eval wrapper for that.
In the following messages %s stands for an interpolated string that is determined only when the message is generated. (Similarly, %d stands for an interpolated number--think printf formats, but we use %d to mean a number in any base here.) Note that some messages begin with %s --which means that listing them alphabetically is problematical. You should search among these messages if the one you are looking for does not appear in the expected place. The symbols " % - ? @ sort before alphabetic characters, while [ and \ sort after.
References of the form, "See unpack," refer to entries in Chapter 3, Functions.
If you decide a bug is a Perl bug and not your bug, you should try to reduce it to a minimal test case and then report it with the perlbug program that comes with Perl.
(F) Lexically scoped variables aren't in a package, so it doesn't make sense to try to declare one with a package qualifier on the front. Use local if you want to localize a package variable.
(F) The no keyword is recognized and executed at compile time, and returns no useful value.
(F) The use keyword is recognized and executed at compile time, and returns no useful value.
(F) You can't pack a string by supplying a checksum, since the checksumming process loses information, and you can't go the other way. See unpack.
(W) You've run afoul of the rule that says that any list operator followed by parentheses turns into a function, with all the list operator's arguments found inside the parens. See the section "Terms and List Operators (Leftward)" in Chapter 2, The Gory Details.
(F) The argument to delete or exists must be a hash element, such as
$foo{$bar}
$ref->[12]->{"susie"}
(F) A required (or used) file must return a true value to indicate that it compiled correctly and ran its initialization code correctly. It's traditional to end such a file with a "1;", though any true value would do. See require.
(S) The Perl lexer knows whether to expect a term or an operator. If it sees what it knows to be a term when it was expecting to see an operator, it gives you this warning. Usually it indicates that an operator or delimiter was omitted, such as a semicolon.
(F) The final summary message when a perl -c command fails.
(F) The parser has given up trying to parse the program after 10 errors. Further error messages would likely be uninformative.
(W) The pattern you've specified would be an infinite loop if the regular expression engine didn't specifically check for that.
(S) The symbol in question was declared but somehow went out of scope before it could possibly have been used.
(F) The final summary message when a perl -c command succeeds.
(A) You've accidentally run your script through csh instead of perl. Check the #! line, or manually feed your script into perl yourself.
(A) You've accidentally run your script through csh instead of perl. Check the #! line, or manually feed your script into perl yourself.
(A) You've accidentally run your script through csh instead of perl. Check the #! line, or manually feed your script into perl yourself.
(A) You've accidentally run your script through the Bourne shell instead of perl. Check the #! line, or manually feed your script into perl yourself.
(F) The script would have to be opened by the C preprocessor by name, which provides a race condition that breaks security.
(F) Perl can't peek at the stdio buffer of filehandles when it doesn't know about your kind of stdio. You'll have to use a filename instead.
See Server error.
(F) You started a regular expression with a quantifier. Backslash it if you meant it literally.
(F) You had a pack template that specified an absolute position outside the string being unpacked. See pack.
(W) You tried to do an accept on a closed socket. Did you forget to check the return value of your socket call? See accept.
(F) You can't allocate more than 64K on an MS-DOS machine.
(F) msgsnd requires a string at least as long as sizeof(long).
(W)(S) You said something that may not be interpreted the way you thought. Normally it's pretty easy to disambiguate it by supplying a missing quote, operator, pair of parentheses, or declaration.
(F) The setuid emulator requires that the switches perl was invoked with match the switches specified on the #! line.
(W) The indicated string was fed as an argument to an operator that expected a numeric value instead. If you're fortunate the message will identify which operator was so unfortunate.
(D) Really old Perl let you omit the @ on array names in some spots. This is now heavily deprecated.
(P) The malloc (3) package that comes with Perl had an internal failure.
(P) A general assertion failed. The file in question must be examined.
(F) If you assign to a conditional operator, the second and third arguments must either both be scalars or both be lists. Otherwise Perl won't know which context to supply to the right side.
(P) All SV objects are supposed to be allocated from arenas that will be garbage collected upon exit. An SV was discovered to be outside any of those arenas. This probably means that someone screwed up in a C extension module.
(W) Mortalized values are supposed to be freed by the internal free_tmps() routine. This indicates that something else is freeing the SV before the free_tmps() routine gets a chance, which means that the free_tmps() routine will be freeing an unreferenced scalar when it does try to free it.
(P) The reference counts got screwed up on symbol aliases.
(W) Perl went to decrement the reference count of a scalar to see if it would go to 0, and discovered that it had already gone to 0 earlier, and should have been freed, and in fact, probably was freed. This could indicate that SvREFCNT_dec() was called too many times, or that SvREFCNT_inc() was called too few times, or that the SV was mortalized when it shouldn't have been, or that memory has been corrupted. In any event, it's likely a problem with the C extension module you're developing.
(F) You passed a buffer of the wrong size to one of msgctl, semctl or shmctl. In C parlance, the correct sizes are sizeof(struct msqid_ds *), sizeof(struct semid_ds *) and sizeof(struct shmid_ds *), respectively.
(P) One of the internal hash routines was passed a null HV pointer.
(F) A symbol was passed to something wanting a filehandle, but the symbol has no filehandle associated with it. Perhaps you didn't do an open, or did it in another package.
(S) An internal routine called free (3) on something that had never been malloc (3)ed in the first place.
(F) You started to name a symbol by using a package prefix, and then didn't finish the symbol. In particular, you can't interpolate outside of quotes, so
$var = 'myvar'; $sym = mypack::$var;
is not the same as
$var = 'myvar'; $sym = "mypack::$var";
(P) An internal request asked to add an array entry to something that wasn't a symbol table entry.
(P) An internal request asked to add a filehandle entry to something that wasn't a symbol table entry.
(P) An internal request asked to add a hash entry to something that wasn't a symbol table entry.
(A) You've accidentally run your script through csh instead of perl. Check the #! line, or manually feed your script into perl yourself.
(F) An untrapped exception was raised while executing a BEGIN subroutine. Compilation stops immediately and the interpreter is exited.
(W) You tried to do a bind on a closed socket. Did you forget to check the return value of your socket call? See bind.
(P) Perl detected an attempt to copy an internal value that is not copiable.
(F) A subroutine invoked from an external package via perl_call_sv() exited by calling exit.
(F) A last statement was executed to break out of the current block, except that there's this itty bitty problem called there isn't a current block. See note on the next entry.
(F) A next statement was executed to reiterate the current block, but there isn't a current block. Note that an if or else block doesn't count as a "loopish" block. You can usually double the curly brackets to get the same effect though, since the inner brackets will be considered a block that loops once. See last.
(F) A redo statement was executed to restart the current block, but there isn't a current block. See note on the previous entry.
(F) Only hard references may be blessed. This is how Perl "enforces" encapsulation of objects.
(S) A debugger warning indicating the line number specified wasn't the location of a statement that could be stopped at.
(F) You called a method correctly, and it correctly indicated a package functioning as a class, but that package doesn't have anything at all defined in it, let alone methods.
(F) A method call must know what package it's supposed to run in. It ordinarily finds this out from the object reference you supply, but you didn't supply an object reference in this case. A reference isn't an object reference until it has been blessed.
(F) You used the syntax of a method call, but the slot filled by the object reference or package name contains an expression that returns neither an object reference nor a package name. (Perhaps it's null?) Something like this will reproduce the error:
$BADREF = undef; process $BADREF 1,2,3; $BADREF->process(1,2,3);
(F) You called perl -x/foo/bar, but /foo/bar is not a directory that you can chdir (2) to, possibly because it doesn't exist.
(F) Certain types of SVs, in particular real symbol table entries (type GLOB), can't be forced to stop being what they are. So you can't say things like:
*foo += 1; # ERROR
You can say
$foo = *foo; # make a "fake" glob value $foo += 1;
but then $foo no longer contains a glob.
(F) Certain types of SVs, in particular real symbol table entries (type GLOB), can't be forced to stop being what they are. See preceding entry.
(F) Certain types of SVs, in particular real symbol table entries (type GLOB), can't be forced to stop being what they are. See previous two entries.
(P) An error peculiar to VMS. The process is suffering from exhausted quotas or other plumbing problems.
(F) Only scalar, array and hash variables may be declared as lexical variables. They must have ordinary identifiers as names, since lexical variables don't live in a symbol table, and can't be package qualified.
(S) The creation of the new file failed for the indicated reason.
(F) You're on a system such as MS-DOS that gets confused if you try reading from a deleted (but still opened) file. You have to use the switch, -i.bak, or some such.
(S) There isn't enough room in the filename to make a backup name for the file. Perhaps you should get a system with longer filenames. :-)
(S) You tried to use the -i switch on a special file, such as a file in /dev, or a FIFO. The file was ignored.
(P) The setegid() call failed for some reason in the setuid emulator of suidperl.
(P) The setuid emulator of suidperl failed for some reason.
(F) This typically means that ordinary perl tried to exec suidperl to do setuid emulation, but couldn't exec it. If you're running /usr/local/bin/perl5.003, it looks for a corresponding /usr/local/bin/sperl5.003. (Note the "s".) If the file is there, check the execute permissions. If it isn't, ask your sysadmin why he and/or she removed it.
(F) This machine doesn't have either waitpid (2) or wait4 (2), so only waitpid without flags is emulated.
(F) Minima must be less than or equal to maxima. If you really want your regular expression to match something 0 times, just put {0}.
(F) The #! line specifies a switch that doesn't make sense at this point. For example, it'd be kind of silly to put a -x on the #! line.
(W) A system, exec or piped open call could not execute the named program for the indicated reason. Typical reasons include: the permissions were wrong on the file, the file wasn't found in $ENV{PATH}, the executable in question was compiled for another architecture, or the #! line in a script points to an interpreter that can't be run for similar reasons. (Or maybe your system doesn't support #! at all.)
(F) Perl was trying to execute the indicated program for you because that's what the #! line said. If that's not what you wanted, you may need to mention "perl" on the #! line somewhere.
(F) You used the -S switch, but the script to execute could not be found in the PATH, or at least not with the correct permissions.
(F) You said to goto a label that isn't mentioned anywhere that it's possible for us to go to. See goto.
(F) Perl strings can stretch over multiple lines. This message means that the closing delimiter was omitted. Since bracketed quotes count nesting levels, the following is missing its final parenthesis:
print q(The character '(' starts a s(n)ide comment.)
(F) A fatal error occurred while trying to fork while opening a pipeline.
(S) A warning peculiar to VMS. This arises because of the difference between access checks under VMS and under the UNIX model Perl assumes. Under VMS, access checks are done by filename, rather than by bits in the stat buffer, so that ACLs and other protections can be taken into account. Unfortunately, Perl assumes that the stat buffer contains all the necessary information, and passes it, instead of the filespec, to the access-checking routine. It will try to retrieve the filespec using the device name and FID present in the stat buffer, but this works only if you haven't made a subsequent call to the CRTL stat routine, since the device name is overwritten with each call. If this warning appears, the name lookup failed, and the access-checking routine gave up and returned FALSE, just to be conservative. (Note: The access-checking routine knows about the Perl stat operator and file tests, so you shouldn't ever see this warning in response to a Perl command; it arises only if some internal code takes stat buffers lightly.)
(P) An error peculiar to VMS. After creating a mailbox to act as a pipe, Perl can't retrieve its name for later use.
(P) An error peculiar to VMS. Perl asked $GETSYI how big you want your mailbox buffers to be, and didn't get an answer.
(F) The deeply magical goto SUBROUTINE call can only replace one subroutine call for another. It can't manufacture one out of whole cloth. In general you should only be calling it out of an AUTOLOAD routine anyway. See goto.
(F) You said something like local $$ref, which is not allowed because the compiler can't determine whether $ref will end up pointing to anything with a symbol table entry, and a symbol table entry is necessary to do a local.
(F) You used local on a variable name that was previous declared as a lexical variable using my. This is not allowed. If you want to localize a package variable of the same name, qualify it with the package name.
(F) You said to use (or require, or do) a file that couldn't be found in any of the libraries mentioned in @INC. Perhaps you need to set the PERL5LIB environment variable to say where the extra library is, or maybe the script needs to add the library name to @INC with the use lib directive. Or maybe you just misspelled the name of the file. See require.
(F) You called a method correctly, and it correctly indicated a package functioning as a class, but the package doesn't define that method name, nor do any of its base classes (which is why the message says "via" rather than "in").
(W) The @ISA array contained the name of another package that doesn't seem to exist.
(F) The mktemp routine failed for some reason while trying to process a -e switch. Maybe your /tmp partition is full, or clobbered.
(F) You aren't allowed to assign to the item indicated, or otherwise try to change it, such as with an autoincrement.
(P) The internal routine that does assignment to a substr was handed a NULL pointer.
(F) The target of a msgrcv must be modifiable in order to be used as a receive buffer.
(S) An inplace edit couldn't open the original file for the indicated reason. Usually this is because you don't have read permission for the file.
(W) You tried to say open(CMD, `|cmd|`), which is not supported. You can try any of several modules in the Perl library to do this, such as Open2. Alternately, direct the pipe's output to a file using ">", and then read it in under a different filehandle.
(F) An error peculiar to VMS. Perl does its own command-line redirection, and couldn't open for writing the file specified after 2> or 2>> on the command line.
(F) An error peculiar to VMS. Perl does its own command-line redirection, and couldn't open for reading the file specified after < on the command line.
(F) An error peculiar to VMS. Perl does its own command-line redirection, and couldn't open for writing the file specified after > or >> on the command line.
(P) An error peculiar to VMS. Perl does its own command-line redirection, and couldn't open the pipe into which to send data destined for STDOUT.
(F) The script you specified can't be opened for the indicated reason.
(S) The rename done by the -i switch failed for some reason, probably because you don't have write permission to the directory.
(P) An error peculiar to VMS. Perl thought STDIN was a pipe, and tried to reopen it to accept binary data. Alas, it failed.
(P) The setreuid call failed for some reason in the setuid emulator of suidperl.
(F) The return statement was executed in mainline code, that is, where there was no subroutine call to return out of.
(P) For some reason you can't fstat (2) the script even though you have it open already. Bizarre.
(P) The setreuid call failed for some reason in the setuid emulator of suidperl.
(F) Logarithms are only defined on positive real numbers.
(F) For ordinary real numbers, you can't take the square root of a negative number. There's a Complex module available for Perl, though, if you really want to do that.
(F) You can't undefine a routine that's currently running. You can, however, redefine it while it's running, and you can even undef the redefined subroutine while the old routine is running. Go figure.
(F) You tried to unshift an "unreal" array that can't be unshifted, such as the main Perl stack.
(P) The internal sv_upgrade( ) routine adds "members" to an SV, making it into a more specialized kind of SV. The top several SV types are so specialized, however, that they cannot be interconverted. This message indicates that such a conversion was attempted.
(P) The undefined SV is the bottom of the totem pole, in the scheme of upgradability. Upgrading to undef indicates an error in the code calling sv_upgrade().
(F) The global variables $a and $b are reserved for sort comparisons. You mentioned $a or $b in the same line as the <=> or cmp operator, and the variable had earlier been declared as a lexical variable. Either qualify the sort variable with the package name, or rename the lexical variable.
(F) Only a simple scalar variable may be used as a loop variable on a foreach.
(F) You've mixed up your reference types. You have to dereference a reference of the type needed. You can use the ref function to test the type of the reference, if need be.
(W) In an ordinary expression, backslash is a unary operator that creates a reference to its argument. The use of backslash to indicate a backreference to a matched substring is only valid as part of a regular expression pattern. Trying to do this in ordinary Perl code produces a value that prints out looking like SCALAR(0xdecaf). Use the $1 form instead.
(F) Only hard references are allowed by use strict refs. Symbolic references are disallowed.
(F) A value used as either a hard reference or a symbolic reference must be a defined value. This helps to de-lurk some insidious errors.
(F) You tried to declare a magical variable as a lexical variable. This is not allowed, because the magic can only be tied to one location (namely the global variable) and it would be incredibly confusing to have variables in your program that looked like magical variables but weren't.
(F) The compiler tried to interpret a bracketed expression as a subscript, but to the left of the brackets was an expression that didn't look like an array reference, or anything else subscriptable.
(F) The write (2) routine failed for some reason while trying to process a -e switch. Maybe your /tmp partition is full, or clobbered.
(F) You tried to repeat a constant value (perhaps the undefined value) with an assignment operator, which implies modifying the value itself. Perhaps you need to copy the value to a temporary, and repeat that.
(F) The creat (2) routine failed for some reason while trying to process a -e switch. Maybe your /tmp partition is full, or clobbered.
(W) A novice will sometimes say
chmod 777, $filename
not realizing that 777 will be interpreted as a decimal number, equivalent to 01411. Octal constants are introduced with a leading 0 in Perl, as in C.
(W) You tried to close a filehandle that was never opened.
(W) You tried to do a connect on a closed socket. Did you forget to check the return value of your socket call? See connect.
(P) The malloc (3) package that comes with Perl had an internal failure.
(P) The regular expression engine got confused by what the regular expression compiler gave it.
(P) The regular expression engine got passed a regular expression program without a valid magic number.
(W) This subroutine has called itself (directly or indirectly) 100 more times than it has returned. This probably indicates an infinite recursion, unless you're writing strange benchmark programs, in which case it indicates something else.
(W) You probably referred to an imported subroutine &FOO as $FOO or some such.
(W) You probably said %hash{$key} when you meant $hash{$key} or @hash{@keys}. On the other hand, maybe you just meant %hash and got carried away.
(S) This is an educated guess made in conjunction with the message "%s found where operator expected". It often means a subroutine or module name is being referenced that hasn't been declared yet. This may be because of ordering problems in your file, or because of a missing sub, package, require, or use statement. If you're referencing something that isn't defined yet, you don't actually have to define the subroutine or package before the current location. You can use an empty sub foo; or package FOO; to enter a "forward" declaration.
(P) The internal handling of magical variables has been cursed.
(P) This should have been caught by safemalloc() instead.
(S) An internal routine has called free() on something that had already been freed.
(S) There is no keyword elseif in Perl because Larry thinks it's ugly. Your code will be interpreted as an attempt to call a method named elseif() for the class returned by the following block. This is unlikely to do what you want.
(F) An untrapped exception was raised while executing an END subroutine. The interpreter is immediately exited.
(F) An error peculiar to VMS. Since Perl may have to deal with file specifications in either VMS or UNIX syntax, it converts them to a single form when it must operate on them directly. Either you've passed an invalid file specification to Perl, or you've found a case the conversion routines don't handle. Drat.
(F) The final summary message when a Perl compilation fails.
(W) You are exiting an eval by unconventional means, such as a goto, or a loop control statement.
(W) You are exiting a subroutine by unconventional means, such as a goto, or a loop control statement.
(W) You are exiting a substitution by unconventional means, such as a return, a goto, or a loop control statement.
(P) An error peculiar to VMS. Something untoward happened in a VMS system service or RTL routine; Perl's exit status should provide more details. The filename in %s and the line number in %d tell you which section of the Perl source code is distressed.
(F) Your machine apparently doesn't implement fcntl (2). What is this, a PDP-11 or something?
(W) An I/O operation was attempted on a filehandle that was never initialized. You need to do an open or a socket call, or call a constructor from the FileHandle package.
(W) You tried to write on a read-only filehandle. If you intended it to be a read-write filehandle, you needed to open it with +< or +> or +>> instead of with < or nothing. If you only intended to write the file, use > or >>. See open.
(W) You tried to write on a read-only filehandle. If you intended it to be a read-write filehandle, you needed to open it with +< or +> or +>> instead of with < or nothing. If you only intended to write the file, use > or >>. See open.
(F) You must now decide whether the final $ in a string was meant to be a literal dollar sign, or was meant to introduce a variable name that happens to be missing. So you have to add either the backslash or the name.
(F) You must now decide whether the final @ in a string was meant to be a literal "at" sign, or was meant to introduce a variable name that happens to be missing. So you have to add either the backslash or the name.
(W) You redefined a format. To suppress this warning, say
{
local $^W = 0;
eval "format NAME =...";
}
(F) A format must be terminated by a line with a solitary dot. Perl got to the end of your file without finding such a line. If you think you have such a line, make sure there are no spaces or tabs on either side of the dot.
(W) You said
if ($foo = 123)
when you meant
if ($foo == 123)
(or something like that).
(S) A warning from the GDBM_File extension module that a store() failed.
(F) Your C library apparently doesn't implement gethostent (3), probably because if it did, it'd feel morally obligated to return every hostname on the Internet. DNS tends to give machines a sense of grandeur.
(W) You tried to get a socket or peer socket name on a closed socket. Did you forget to check the return value of your socket call?
(S) A warning peculiar to VMS. The call to sys$getuai underlying the getpwnam function returned an invalid UIC.
(F) The lexer saw a left angle bracket in a place where it was expecting a term, so it's looking for the corresponding right angle bracket, and not finding it. Chances are you left out some needed parentheses earlier in the line, and you really meant a "less than".
(F) You've said use strict vars, which indicates that all variables must either be lexically scoped (using my), or explicitly qualified to say which package the global variable is in (using ::).
(F) Unlike next or last, you're not allowed to goto an unspecified destination, the opinions of Elizabethans nothwithstanding. Go to goto.
(S) A routine asked for a symbol from a symbol table that ought to have existed already, but for some reason it didn't, and had to be created on an emergency basis to prevent a core dump. This probably indicates a typo in an extension module.
(D) Really old Perl let you omit the % on hash names in some spots. This is now heavily deprecated.
(F) You tried to divide a number by 0. Either something was wrong in your logic, or you need to put a conditional in to guard against meaningless input. Maybe both.
(F) You tried to divide a number by 0 to get the remainder. Most numbers don't take to this kindly.
(F) You used an 8 or 9 in a octal number.
(W) You may have tried to use an 8 or 9 in a octal number. Interpretation of the octal number stopped before the 8 or 9.
(F) You tried to do something that the tainting mechanism didn't like. The tainting mechanism is turned on when you're running setuid or setgid, or when you specify -T to turn it on explicitly. The tainting mechanism labels all data that's derived directly or indirectly from the user, who is considered to be unworthy of your trust. If any such data is used in a "dangerous" operation, you get this error.
(F) You can't use system, exec, or a piped open in a setuid or setgid script if $ENV{PATH} contains a directory that is writable by the world.
(F) You can't use system, exec, or a piped open in a setuid or setgid script if $ENV{PATH} is derived from data supplied (or potentially supplied) by the user. The script must set the path to a known value, using trustworthy data.
(S) A warning peculiar to VMS. Perl keeps track of the number of times you've called fork and exec, in order to determine whether the current call to exec should affect the current script or a subprocess (see exec). Somehow, this count has become scrambled, so Perl is making a guess and treating this exec as a request to terminate the Perl script and execute the specified command.
(P) Something went badly wrong in the regular expression parser.
(P) Something went badly awry in the regular expression parser.
(F) The range specified in a character class had a minimum character greater than the maximum character.
(F) Your machine apparently doesn't implement ioctl (2), which is pretty strange for a machine that supports C.
(P) The regular expression parser is confused.
(F) You named a loop to break out of, but you're not currently in a loop of that name, not even if you count where you were called from. See last.