perldiag.pod
来自「ARM上的如果你对底层感兴趣」· POD 代码 · 共 1,753 行 · 第 1/5 页
POD
1,753 行
=head1 NAME
perldiag - various Perl diagnostics
=head1 DESCRIPTION
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 (nontrappable).
(A) An alien error message (not generated by Perl).
Optional warnings are enabled by using the B<-w> switch. Warnings may
be captured by setting C<$SIG{__WARN__}> to a reference to a routine that
will be called on each warning instead of printing it. See L<perlvar>.
Trappable errors may be trapped using the eval operator. See
L<perlfunc/eval>.
Some of these messages are generic. Spots that vary are denoted with a %s,
just as in a printf format. Note that some messages start with a %s!
The symbols C<"%(-?@> sort before the letters, while C<[> and C<\> sort after.
=over 4
=item "my" variable %s can't be in a package
(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.
=item "my" variable %s masks earlier declaration in same scope
(W) 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 "no" not allowed in expression
(F) The "no" keyword is recognized and executed at compile time, and returns
no useful value. See L<perlmod>.
=item "use" not allowed in expression
(F) The "use" keyword is recognized and executed at compile time, and returns
no useful value. See L<perlmod>.
=item % may only be used in unpack
(F) You can't pack a string by supplying a checksum, because the
checksumming process loses information, and you can't go the other
way. See L<perlfunc/unpack>.
=item %s (...) interpreted as function
(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 operators arguments
found inside the parentheses. See L<perlop/Terms and List Operators (Leftward)>.
=item %s argument is not a HASH element
(F) The argument to exists() must be a hash element, such as
$foo{$bar}
$ref->[12]->{"susie"}
=item %s argument is not a HASH element or slice
(F) The argument to delete() must be either a hash element, such as
$foo{$bar}
$ref->[12]->{"susie"}
or a hash slice, such as
@foo{$bar, $baz, $xyzzy}
@{$ref->[12]}{"susie", "queue"}
=item %s did not return a true value
(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 L<perlfunc/require>.
=item %s found where operator expected
(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.
=item %s had compilation errors
(F) The final summary message when a C<perl -c> fails.
=item %s has too many errors
(F) The parser has given up trying to parse the program after 10 errors.
Further error messages would likely be uninformative.
=item %s matches null string many times
(W) The pattern you've specified would be an infinite loop if the
regular expression engine didn't specifically check for that. See L<perlre>.
=item %s never introduced
(S) The symbol in question was declared but somehow went out of scope
before it could possibly have been used.
=item %s syntax OK
(F) The final summary message when a C<perl -c> succeeds.
=item %s: Command not found
(A) You've accidentally run your script through B<csh> instead
of Perl. Check the #! line, or manually feed your script into
Perl yourself.
=item %s: Expression syntax
(A) You've accidentally run your script through B<csh> instead
of Perl. Check the #! line, or manually feed your script into
Perl yourself.
=item %s: Undefined variable
(A) You've accidentally run your script through B<csh> instead
of Perl. Check the #! line, or manually feed your script into
Perl yourself.
=item %s: not found
(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.
=item (Missing semicolon on previous line?)
(S) This is an educated guess made in conjunction with the message "%s
found where operator expected". Don't automatically put a semicolon on
the previous line just because you saw this message.
=item B<-P> not allowed for setuid/setgid script
(F) The script would have to be opened by the C preprocessor by name,
which provides a race condition that breaks security.
=item C<-T> and C<-B> not implemented on filehandles
(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.
=item C<-p> destination: %s
(F) An error occurred during the implicit output invoked by the C<-p>
command-line switch. (This output goes to STDOUT unless you've
redirected it with select().)
=item 500 Server error
See Server error.
=item ?+* follows nothing in regexp
(F) You started a regular expression with a quantifier. Backslash it
if you meant it literally. See L<perlre>.
=item @ outside of string
(F) You had a pack template that specified an absolute position outside
the string being unpacked. See L<perlfunc/pack>.
=item accept() on closed fd
(W) You tried to do an accept on a closed socket. Did you forget to check
the return value of your socket() call? See L<perlfunc/accept>.
=item Allocation too large: %lx
(X) You can't allocate more than 64K on an MS-DOS machine.
=item Applying %s to %s will act on scalar(%s)
(W) The pattern match (//), substitution (s///), and transliteration (tr///)
operators work on scalar values. If you apply one of them to an array
or a hash, it will convert the array or hash to a scalar value -- the
length of an array, or the population info of a hash -- and then work on
that scalar value. This is probably not what you meant to do. See
L<perlfunc/grep> and L<perlfunc/map> for alternatives.
=item Arg too short for msgsnd
(F) msgsnd() requires a string at least as long as sizeof(long).
=item Ambiguous use of %s resolved as %s
(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, parenthesis pair or declaration.
=item Ambiguous call resolved as CORE::%s(), qualify as such or use &
(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.
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<use subs> pragma).
To silently interpret it as the Perl operator, use the C<CORE::> prefix
on the operator (e.g. C<CORE::log($x)>) or by declaring the subroutine
to be an object method (see L<attrs>).
=item Args must match #! line
(F) The setuid emulator requires that the arguments Perl was invoked
with match the arguments specified on the #! line. Since some systems
impose a one-argument limit on the #! line, try combining switches;
for example, turn C<-w -U> into C<-wU>.
=item Argument "%s" isn't numeric%s
(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.
=item Array @%s missing the @ in argument %d of %s()
(D) Really old Perl let you omit the @ on array names in some spots. This
is now heavily deprecated.
=item assertion botched: %s
(P) The malloc package that comes with Perl had an internal failure.
=item Assertion failed: file "%s"
(P) A general assertion failed. The file in question must be examined.
=item Assignment to both a list and a scalar
(F) If you assign to a conditional operator, the 2nd and 3rd arguments
must either both be scalars or both be lists. Otherwise Perl won't
know which context to supply to the right side.
=item Attempt to free non-arena SV: 0x%lx
(P) All SV objects are supposed to be allocated from arenas that will
be garbage collected on exit. An SV was discovered to be outside any
of those arenas.
=item Attempt to free nonexistent shared string
(P) Perl maintains a reference counted internal table of strings to
optimize the storage and access of hash keys and other strings. This
indicates someone tried to decrement the reference count of a string
that can no longer be found in the table.
=item Attempt to free temp prematurely
(W) Mortalized values are supposed to be freed by the 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.
=item Attempt to free unreferenced glob pointers
(P) The reference counts got screwed up on symbol aliases.
=item Attempt to free unreferenced scalar
(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.
=item Attempt to pack pointer to temporary value
(W) You tried to pass a temporary value (like the result of a
function, or a computed expression) to the "p" pack() template. This
means the result contains a pointer to a location that could become
invalid anytime, even before the end of the current statement. Use
literals or global values as arguments to the "p" pack() template to
avoid this warning.
=item Attempt to use reference as lvalue in substr
(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<perlfunc/substr>.
=item Bad arg length for %s, is %d, should be %d
(F) You passed a buffer of the wrong size to one of msgctl(), semctl() or
shmctl(). In C parlance, the correct sizes are, respectively,
S<sizeof(struct msqid_ds *)>, S<sizeof(struct semid_ds *)>, and
S<sizeof(struct shmid_ds *)>.
=item Bad filehandle: %s
(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.
=item Bad free() ignored
(S) An internal routine called free() on something that had never been
malloc()ed in the first place. Mandatory, but can be disabled by
setting environment variable C<PERL_BADFREE> to 1.
This message can be quite often seen with DB_File on systems with
"hard" dynamic linking, like C<AIX> and C<OS/2>. It is a bug of
C<Berkeley DB> which is left unnoticed if C<DB> uses I<forgiving>
system malloc().
=item Bad hash
(P) One of the internal hash routines was passed a null HV pointer.
=item Bad index while coercing array into hash
(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<perlref>.
=item Bad name after %s::
(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
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?