Pod updates
[p5sagit/p5-mst-13.2.git] / pod / perldiag.pod
index 018ebb7..d530508 100644 (file)
@@ -16,8 +16,8 @@ desperation):
     (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>.
+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>.
 
@@ -96,11 +96,11 @@ 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.
+=item %s had compilation errors
 
 (F) The final summary message when a C<perl -c> fails.
 
-=item %s has too many errors.
+=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.
@@ -119,28 +119,28 @@ before it could possibly have been used.
 
 (F) The final summary message when a C<perl -c> succeeds.
 
-=item %s: Command not found.
+=item %s: Command not found
 
 (A) You've accidentally run your script through B<csh> instead
-of Perl.  Check the E<lt>#!E<gt> line, or manually feed your script
-into Perl yourself.
+of Perl.  Check the #! line, or manually feed your script into
+Perl yourself.
 
-=item %s: Expression syntax.
+=item %s: Expression syntax
 
 (A) You've accidentally run your script through B<csh> instead
-of Perl.  Check the E<lt>#!E<gt> line, or manually feed your script
-into Perl yourself.
+of Perl.  Check the #! line, or manually feed your script into
+Perl yourself.
 
-=item %s: Undefined variable.
+=item %s: Undefined variable
 
 (A) You've accidentally run your script through B<csh> instead
-of Perl.  Check the E<lt>#!E<gt> line, or manually feed your script
-into Perl yourself.
+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 E<lt>#!E<gt> line, or manually feed your script
+instead of Perl.  Check the #! line, or manually feed your script
 into Perl yourself.
 
 =item B<-P> not allowed for setuid/setgid script
@@ -180,6 +180,15 @@ the return value of your socket() call?  See L<perlfunc/accept>.
 
 (F) You can't allocate more than 2^31+"small amount" bytes.
 
+=item Applying %s to %s will act on scalar(%s)
+
+(W) The pattern match (//), substitution (s///), and translation (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).
@@ -193,9 +202,11 @@ a missing quote, operator, parenthesis pair or declaration.
 =item Args must match #! line
 
 (F) The setuid emulator requires that the arguments Perl was invoked
-with match the arguments specified on the #! line.
+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
+=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
@@ -267,10 +278,6 @@ 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 associative array
-
-(P) One of the internal hash routines was passed a null HV pointer.
-
 =item Bad filehandle: %s
 
 (F) A symbol was passed to something wanting a filehandle, but the symbol
@@ -288,6 +295,10 @@ This message can be quite often seen with DB_File on systems with
 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 name after %s::
 
 (F) You started to name a symbol by using a package prefix, and then didn't
@@ -320,14 +331,22 @@ wasn't a symbol table entry.
 =item Badly placed ()'s
 
 (A) You've accidentally run your script through B<csh> instead
-of Perl.  Check the E<lt>#!E<gt> line, or manually feed your script
-into Perl yourself.
+of Perl.  Check the #! line, or manually feed your script into
+Perl yourself.
 
 =item BEGIN failed--compilation aborted
 
 (F) An untrapped exception was raised while executing a BEGIN subroutine.
 Compilation stops immediately and the interpreter is exited.
 
+=item BEGIN not safe after errors--compilation aborted
+
+(F) Perl found a C<BEGIN {}> subroutine (or a C<use> directive, which
+implies a C<BEGIN {}>) after one or more compilation errors had
+already occurred.  Since the intended environment for the C<BEGIN {}>
+could not be guaranteed (due to the errors), and since subsequent code
+likely depends on its correct operation, Perl just gave up.
+
 =item bind() on closed fd
 
 (W) You tried to do a bind on a closed socket.  Did you forget to check
@@ -364,7 +383,7 @@ will be considered a block that loops once.  See L<perlfunc/last>.
 there isn't a current block.  Note that an "if" or "else" block doesn't
 count as a "loopish" block, as doesn't a block given to sort().  You can
 usually double the curlies to get the same effect though, because the inner
-curlies will be considered a block that loops once.  See L<perlfunc/last>.
+curlies will be considered a block that loops once.  See L<perlfunc/next>.
 
 =item Can't "redo" outside a block
 
@@ -372,7 +391,7 @@ curlies will be considered a block that loops once.  See L<perlfunc/last>.
 there isn't a current block.  Note that an "if" or "else" block doesn't
 count as a "loopish" block, as doesn't a block given to sort().  You can
 usually double the curlies to get the same effect though, because the inner
-curlies will be considered a block that loops once.  See L<perlfunc/last>.
+curlies will be considered a block that loops once.  See L<perlfunc/redo>.
 
 =item Can't bless non-reference value
 
@@ -381,7 +400,7 @@ encapsulation of objects.  See L<perlobj>.
 
 =item Can't break at that line
 
-(S) A warning intended for while running within the debugger, indicating
+(S) A warning intended to only be printed while running within the debugger, indicating
 the line number specified wasn't the location of a statement that could
 be stopped at.
 
@@ -635,7 +654,7 @@ buffer.
 
 =item Can't open %s: %s
 
-(S) An inplace edit couldn't open the original file for the indicated reason.
+(S) An in-place edit couldn't open the original file for the indicated reason.
 Usually this is because you don't have read permission for the file.
 
 =item Can't open bidirectional pipe
@@ -836,6 +855,12 @@ the return value of your socket() call?  See L<perlfunc/connect>.
 inlining.  See L<perlsub/"Constant Functions"> for commentary and
 workarounds.
 
+=item Constant subroutine %s undefined
+
+(S) You undefined a subroutine which had previously been eligible for
+inlining.  See L<perlsub/"Constant Functions"> for commentary and
+workarounds.
+
 =item Copy method did not return a reference
 
 (F) The method which overloads "=" is buggy. See L<overload/Copy Constructor>.
@@ -920,7 +945,7 @@ 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.
 
-=item Execution of %s aborted due to compilation errors.
+=item Execution of %s aborted due to compilation errors
 
 (F) The final summary message when a Perl compilation fails.
 
@@ -1049,8 +1074,8 @@ the line, and you really meant a "less than".
 
 =item Global symbol "%s" requires explicit package name
 
-(F) You've said "use strict vars", which indicates that all variables must
-either be lexically scoped (using "my"), or explicitly qualified to
+(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 "::").
 
 =item goto must have label
@@ -1078,6 +1103,25 @@ appear in %ENV.  This may be a benign occurrence, as some software packages
 might directly modify logical name tables and introduce non-standard names,
 or it may indicate that a logical name table has been corrupted.
 
+=item Illegal character %s (carriage return)
+
+(F) A carriage return character was found in the input.  This is an
+error, and not a warning, because carriage return characters can break
+here documents (e.g., C<print E<lt>E<lt>EOF;>).
+  
+Under UNIX, this error is usually caused by executing Perl code --
+either the main program, a module, or an eval'd string -- that was
+transferred over a network connection from a non-UNIX system without
+properly converting the text file format.
+
+Under systems that use something other than '\n' to delimit lines of
+text, this error can also be caused by reading Perl code from a file
+handle that is in binary mode (as set by the C<binmode> operator).
+
+In either case, the Perl code in question will probably need to be
+converted with something like C<s/\x0D\x0A?/\n/g> before it can be
+executed.
+
 =item Illegal division by zero
 
 (F) You tried to divide a number by 0.  Either something was wrong in your
@@ -1097,6 +1141,16 @@ don't take to this kindly.
 (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.
 
+=item In string, @%s now must be written as \@%s
+
+(F) It used to be that Perl would try to guess whether you wanted an
+array interpolated or a literal @.  It did this when the string was first
+used at runtime.  Now strings are parsed at compile time, and ambiguous
+instances of @ must be disambiguated, either by prepending a backslash to
+indicate a literal, or by declaring (or using) the array within the
+program before the string (lexically).  (Someday it will simply assume
+that an unbackslashed @ interpolates an array.)
+
 =item Insecure dependency in %s
 
 (F) You tried to do something that the tainting mechanism didn't like.
@@ -1187,16 +1241,6 @@ L<perlfunc/last>.
 (W) You tried to do a listen on a closed socket.  Did you forget to check
 the return value of your socket() call?  See L<perlfunc/listen>.
 
-=item Literal @%s now requires backslash
-
-(F) It used to be that Perl would try to guess whether you wanted an
-array interpolated or a literal @.  It did this when the string was
-first used at runtime.  Now strings are parsed at compile time, and
-ambiguous instances of @ must be disambiguated, either by putting a
-backslash to indicate a literal, or by declaring (or using) the array
-within the program before the string (lexically).  (Someday it will simply
-assume that an unbackslashed @ interpolates an array.)
-
 =item Method for operation %s not found in package %s during blessing
 
 (F) An attempt was made to specify an entry in an overloading table that
@@ -1277,10 +1321,10 @@ like C<$foo[1][2][3]>, as in C.
 
 =item Name "%s::%s" used only once: possible typo
 
-(W) Typographical errors often show up as unique variable names.  If you
-had a good reason for having a unique name, then just mention it
-again somehow to suppress the message (the C<use vars> pragma is
-provided for just this purpose).
+(W) Typographical errors often show up as unique variable names.
+If you had a good reason for having a unique name, then just mention
+it again somehow to suppress the message.  The C<use vars> pragma is
+provided for just this purpose.
 
 =item Negative length
 
@@ -1332,7 +1376,7 @@ this error was triggered?
 =item No command into which to pipe on command line
 
 (F) An error peculiar to VMS.  Perl handles its own command line redirection,
-and found a '|' at the end of the command line, so it doesn't know whither you
+and found a '|' at the end of the command line, so it doesn't know where you
 want to pipe the output from this command.
 
 =item No DB::DB routine defined
@@ -1372,7 +1416,7 @@ from which to read data for stdin.
 
 (F) An error peculiar to VMS.  Perl handles its own command line redirection,
 and found a lone 'E<gt>' at the end of the command line, so it doesn't know
-whither you wanted to redirect stdout.
+where you wanted to redirect stdout.
 
 =item No output file after E<gt> or E<gt>E<gt> on command line
 
@@ -1772,7 +1816,7 @@ old-fashioned way, with quotes and commas:
 =item Possible attempt to separate words with commas
 
 (W) qw() lists contain items separated by whitespace; therefore commas
-aren't needed to separate the items. (You may have used different
+aren't needed to separate the items.  (You may have used different
 delimiters than the parentheses shown here; braces are also frequently
 used.)
 
@@ -1802,9 +1846,10 @@ is now misinterpreted as
 
     open(FOO || die);
 
-because of the strict regularization of Perl 5's grammar into unary and
-list operators.  (The old open was a little of both.) You must put
-parentheses around the filehandle, or use the new "or" operator instead of "||".
+because of the strict regularization of Perl 5's grammar into unary
+and list operators.  (The old open was a little of both.)  You must
+put parentheses around the filehandle, or use the new "or" operator
+instead of "||".
 
 =item print on closed filehandle %s
 
@@ -1914,8 +1959,8 @@ L<perlref>.
 
 =item Script is not setuid/setgid in suidperl
 
-(F) Oddly, the suidperl program was invoked on a script with its setuid
-or setgid bit not set.  This doesn't make much sense.
+(F) Oddly, the suidperl program was invoked on a script without a setuid
+or setgid bit set.  This doesn't make much sense.
 
 =item Search pattern not terminated
 
@@ -1925,7 +1970,7 @@ construct.  Remember that bracketing delimiters count nesting level.
 =item seek() on unopened file
 
 (W) You tried to use the seek() function on a filehandle that was either
-never opened or has been closed since.
+never opened or has since been closed.
 
 =item select not implemented
 
@@ -1967,12 +2012,22 @@ See L<perlre>.
 
 =item Server error
 
-Also known as "500 Server error".  This is a CGI error, not a Perl
-error.  You need to make sure your script is executable, is accessible
-by the user CGI is running the script under (which is probably not
-the user account you tested it under), does not rely on any environment
-variables (like PATH) from the user it isn't running under, and isn't
-in a location where the CGI server can't find it, basically, more or less.
+Also known as "500 Server error".
+
+B<This is a CGI error, not a Perl error>.
+
+You need to make sure your script is executable, is accessible by the user
+CGI is running the script under (which is probably not the user account you
+tested it under), does not rely on any environment variables (like PATH)
+from the user it isn't running under, and isn't in a location where the CGI
+server can't find it, basically, more or less.  Please see the following
+for more information:
+
+       http://www.perl.com/perl/faq/idiots-guide.html
+       http://www.perl.com/perl/faq/perl-cgi-faq.html
+       ftp://rtfm.mit.edu/pub/usenet/news.answers/www/cgi-faq
+       http://hoohoo.ncsa.uiuc.edu/cgi/interface.html
+       http://www-genome.wi.mit.edu/WWW/faqs/www-security-faq.html
 
 =item setegid() not implemented
 
@@ -2011,7 +2066,7 @@ because the world might have written on it already.
 
 (W) You tried to do a shutdown on a closed socket.  Seems a bit superfluous.
 
-=item SIG%s handler "%s" not defined.
+=item SIG%s handler "%s" not defined
 
 (W) The signal handler named in %SIG doesn't, in fact, exist.  Perhaps you
 put it into the wrong package?
@@ -2041,7 +2096,7 @@ See L<perlfunc/split>.
 =item Stat on unopened file E<lt>%sE<gt>
 
 (W) You tried to use the stat() function (or an equivalent file test)
-on a filehandle that was either never opened or has been closed since.
+on a filehandle that was either never opened or has since been closed.
 
 =item Statement unlikely to be reached
 
@@ -2070,7 +2125,7 @@ may break this.
 
 (P) The substitution was looping infinitely.  (Obviously, a
 substitution shouldn't iterate more times than there are characters of
-input, which is what happened.) See the discussion of substitution in
+input, which is what happened.)  See the discussion of substitution in
 L<perlop/"Quote and Quote-like Operators">.
 
 =item Substitution pattern not terminated
@@ -2089,7 +2144,7 @@ construct.  Remember that bracketing delimiters count nesting level.
 That is, the absolute value of the offset was larger than the length of
 the string.  See L<perlfunc/substr>.
 
-=item suidperl is no longer needed since...
+=item suidperl is no longer needed since %s
 
 (F) Your Perl was compiled with B<-D>SETUID_SCRIPTS_ARE_SECURE_NOW, but a
 version of the setuid emulator somehow got run anyway.
@@ -2118,7 +2173,7 @@ if the error went away.  Sort of the cybernetic version of S<20 questions>.
 =item syntax error at line %d: `%s' unexpected
 
 (A) You've accidentally run your script through the Bourne shell
-instead of Perl.  Check the E<lt>#!E<gt> line, or manually feed your script
+instead of Perl.  Check the #! line, or manually feed your script
 into Perl yourself.
 
 =item System V IPC is not implemented on this machine
@@ -2134,7 +2189,7 @@ Check your logic flow.
 =item tell() on unopened file
 
 (W) You tried to use the tell() function on a filehandle that was either
-never opened or has been closed since.
+never opened or has since been closed.
 
 =item Test on unopened file E<lt>%sE<gt>
 
@@ -2161,7 +2216,7 @@ out from under another module inadvertently.  See L<perlvar/$[>.
 The function indicated isn't implemented on this architecture, according
 to the probings of Configure.
 
-=item The crypt() function is unimplemented due to excessive paranoia.
+=item The crypt() function is unimplemented due to excessive paranoia
 
 (F) Configure couldn't find the crypt() function on your machine,
 probably because your vendor didn't supply it, probably because they
@@ -2185,13 +2240,29 @@ you're not running on Unix.
 (F) There has to be at least one argument to syscall() to specify the
 system call to call, silly dilly.
 
+=item Too late for "B<-T>" option
+
+(X) The #! line (or local equivalent) in a Perl script contains the
+B<-T> option, but Perl was not invoked with B<-T> in its argument
+list.  This is an error because, by the time Perl discovers a B<-T> in
+a script, it's too late to properly taint everything from the
+environment.  So Perl gives up.
+
+If the Perl script is being executed as a command using the #!
+mechanism (or its local equivalent), this error can usually be fixed
+by editing the #! line so that the B<-T> option is a part of Perl's
+first argument: e.g. change C<perl -n -T> to C<perl -T -n>.
+
+If the Perl script is being executed as C<perl scriptname>, then the
+B<-T> option must appear on the command line: C<perl -T scriptname>.
+
 =item Too many ('s
 
 =item Too many )'s
 
 (A) You've accidentally run your script through B<csh> instead
-of Perl.  Check the E<lt>#!E<gt> line, or manually feed your script
-into Perl yourself.
+of Perl.  Check the #! line, or manually feed your script into
+Perl yourself.
 
 =item Too many args to syscall
 
@@ -2341,7 +2412,7 @@ supplying the bad switch on your behalf.)
 
 (W) A file operation was attempted on a filename, and that operation
 failed, PROBABLY because the filename contained a newline, PROBABLY
-because you forgot to chop() or chomp() it off.  See L<perlfunc/chop>.
+because you forgot to chop() or chomp() it off.  See L<perlfunc/chomp>.
 
 =item Unsupported directory function "%s" called
 
@@ -2440,15 +2511,15 @@ L<perlref> for more on this.
 (W) A copy of the object returned from C<tie> (or C<tied>) was still
 valid when C<untie> was called.
 
-=item Value of %s construct can be "0"; test with defined()
+=item Value of %s can be "0"; test with defined()
 
-(W) In a conditional expression, you used <HANDLE>, <*> (glob), or
-C<readdir> as a boolean value.  Each of these constructs can return a
-value of "0"; that would make the conditional expression false, which
-is probably not what you intended.  When using these constructs in
-conditional expressions, test their values with the C<defined> operator.
+(W) In a conditional expression, you used <HANDLE>, <*> (glob), C<each()>,
+or C<readdir()> as a boolean value.  Each of these constructs can return a
+value of "0"; that would make the conditional expression false, which is
+probably not what you intended.  When using these constructs in conditional
+expressions, test their values with the C<defined> operator.
 
-=item Variable "%s" is not exported
+=item Variable "%s" is not imported%s
 
 (F) While "use strict" in effect, you referred to a global variable
 that you apparently thought was imported from another module, because
@@ -2500,18 +2571,18 @@ reference variables in outer subroutines are called or referenced,
 they are automatically re-bound to the current values of such
 variables.
 
-=item Variable syntax.
+=item Variable syntax
 
 (A) You've accidentally run your script through B<csh> instead
-of Perl.  Check the E<lt>#!E<gt> line, or manually feed your script
-into Perl yourself.
+of Perl.  Check the #! line, or manually feed your script into
+Perl yourself.
 
 =item Warning: something's wrong
 
 (W) You passed warn() an empty string (the equivalent of C<warn "">) or
 you called it with no args and C<$_> was empty.
 
-=item Warning: unable to close filehandle %s properly.
+=item Warning: unable to close filehandle %s properly
 
 (S) The implicit close() done by an open() got an error indication on the
 close().  This usually indicates your file system ran out of disk space.