Add test for grep() and wantarray
[p5sagit/p5-mst-13.2.git] / pod / perldiag.pod
index fb0a2d7..ec300c8 100644 (file)
@@ -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,19 +119,19 @@ 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.
 
-=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.
 
-=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
@@ -195,7 +195,7 @@ a missing quote, operator, parenthesis pair or declaration.
 (F) The setuid emulator requires that the arguments Perl was invoked
 with match the arguments specified on the #! line.
 
-=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
@@ -342,30 +342,37 @@ the return value of your socket() call?  See L<perlfunc/bind>.
 (F) A subroutine invoked from an external package via perl_call_sv()
 exited by calling exit.
 
+=item Can't "goto" outside a block
+
+(F) A "goto" statement was executed to jump out of what might look
+like a block, except that it isn't a proper block.  This usually
+occurs if you tried to jump out of a sort() block or subroutine, which
+is a no-no.  See L<perlfunc/goto>.
+
 =item Can't "last" outside a block
 
 (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.  Note that an "if" or "else" block doesn't count as a
-"loopish" block.  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>.
+"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>.
 
 =item Can't "next" outside a block
 
 (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 curlies to get
-the same effect though, because the inner curlies will be considered a block
-that loops once.  See L<perlfunc/last>.
+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>.
 
 =item Can't "redo" outside a block
 
 (F) A "redo" statement was executed to restart 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 curlies to get
-the same effect though, because the inner curlies will be considered a block
-that loops once.  See L<perlfunc/last>.
+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>.
 
 =item Can't bless non-reference value
 
@@ -754,6 +761,11 @@ to a matched substring is valid only 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.
 
+=item Can't use bareword ("%s") as %s ref while \"strict refs\" in use
+
+(F) Only hard references are allowed by "strict refs".  Symbolic references
+are disallowed.  See L<perlref>.
+
 =item Can't use string ("%s") as %s ref while "strict refs" in use
 
 (F) Only hard references are allowed by "strict refs".  Symbolic references
@@ -794,6 +806,12 @@ Perhaps you need to copy the value to a temporary, and repeat that.
 (F) The create routine failed for some reason while trying to process
 a B<-e> switch.  Maybe your /tmp partition is full, or clobbered.
 
+=item Cannot resolve method `%s' overloading `%s' in package `%s'
+
+(F|P) Error resolving overloading specified by a method name (as
+opposed to a subroutine reference): no such method callable via the
+package. If method name is C<???>, this is an internal error.
+
 =item chmod: mode argument is missing initial 0
 
 (W) A novice will sometimes say
@@ -818,6 +836,10 @@ the return value of your socket() call?  See L<perlfunc/connect>.
 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>.
+
 =item Corrupt malloc ptr 0x%lx at 0x%lx
 
 (P) The malloc package that comes with Perl had an internal failure.
@@ -898,7 +920,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.
 
@@ -907,6 +929,12 @@ case the conversion routines don't handle.  Drat.
 (W) You are exiting an eval by unconventional means, such as
 a goto, or a loop control statement.
 
+=item Exiting pseudo-block via %s
+
+(W) You are exiting a rather special block construct (like a sort block or
+subroutine) by unconventional means, such as a goto, or a loop control
+statement.  See L<perlfunc/sort>.
+
 =item Exiting subroutine via %s
 
 (W) You are exiting a subroutine by unconventional means, such as
@@ -1050,6 +1078,13 @@ 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;>).  Note that Perl always
+opens scripts in text mode, so this error should only occur in C<eval>.
+
 =item Illegal division by zero
 
 (F) You tried to divide a number by 0.  Either something was wrong in your
@@ -1172,7 +1207,7 @@ 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
-doesn't somehow point to a valid method.  See L<overload>.
+doesn't resolve to a valid subroutine.  See L<overload>.
 
 =item Might be a runaway multi-line %s string starting on line %d
 
@@ -1289,6 +1324,18 @@ See L<perlsec>.
 allowed to have a comma between that and the following arguments.
 Otherwise it'd be just another one of the arguments.
 
+One possible cause for this is that you expected to have imported a
+constant to your name space with B<use> or B<import> while no such
+importing took place, it may for example be that your operating system
+does not support that particular constant. Hopefully you did use an
+explicit import list for the constants you expect to see, please see
+L<perlfunc/use> and L<perlfunc/import>. While an explicit import list
+would probably have caught this error earlier it naturally does not
+remedy the fact that your operating system still does not support that
+constant. Maybe you have a typo in the constants of the symbol import
+list of B<use> or B<import> or in the constant name at the line where
+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,
@@ -1415,7 +1462,7 @@ subroutine), but found a reference to something else instead.  You can
 use the ref() function to find out what kind of ref it really was.
 See also L<perlref>.
 
-=item Not a subroutine reference in %OVERLOAD
+=item Not a subroutine reference in overload table
 
 (F) An attempt was made to specify an entry in an overloading table that
 doesn't somehow point to a valid subroutine.  See L<overload>.
@@ -1482,10 +1529,13 @@ will extend the buffer and zero pad the new area.
 
 (S) An internal warning that the grammar is screwed up.
 
-=item Operation `%s' %s: no method found,
+=item Operation `%s': no method found,%s
 
-(F) An attempt was made to use an entry in an overloading table that
-somehow no longer points to a valid method.  See L<overload>.
+(F) An attempt was made to perform an overloaded operation for which
+no handler was defined.  While some handlers can be autogenerated in
+terms of other handlers, there is no default handler for any
+operation, unless C<fallback> overloading key is specified to be
+true.  See L<overload>.
 
 =item Operator or semicolon missing before %s
 
@@ -1698,27 +1748,49 @@ the BSD version, which takes a pid.
 
 =item Possible attempt to put comments in qw() list
 
-(W) You probably wrote something like this:
+(W) qw() lists contain items separated by whitespace; as with literal
+strings, comment characters are not ignored, but are instead treated
+as literal data.  (You may have used different delimiters than the
+exclamation marks parentheses shown here; braces are also frequently
+used.)
+
+You probably wrote something like this:
 
-    qw( a # a comment
+    @list = qw( 
+       a # a comment
         b # another comment
-      ) ;
+    );
 
 when you should have written this:
 
-    qw( a 
+    @list = qw(
+       a 
         b 
-      ) ;
+    );
+
+If you really want comments, build your list the
+old-fashioned way, with quotes and commas:
+
+    @list = (
+        'a',    # a comment
+        'b',    # another comment
+    );
 
 =item Possible attempt to separate words with commas
 
-(W) You probably wrote something like this:
+(W) qw() lists contain items separated by whitespace; therefore commas
+aren't needed to separate the items. (You may have used different
+delimiters than the parentheses shown here; braces are also frequently
+used.)
 
-    qw( a, b, c );
+You probably wrote something like this: 
 
-when you should have written this:
+    qw! a, b, c !;
+
+which puts literal commas into some of the list items.  Write it without
+commas if you don't want them to appear in your data:
 
-    qw( a b c );
+    qw! a b c !;
 
 =item Possible memory corruption: %s overflowed 3rd argument
 
@@ -1946,7 +2018,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?
@@ -1986,6 +2058,12 @@ there was a failure.  You probably wanted to use system() instead,
 which does return.  To suppress this warning, put the exec() in a block
 by itself.
 
+=item Stub found while resolving method `%s' overloading `%s' in package `%s'
+
+(P) Overloading resolution over @ISA tree may be broken by importation stubs.
+Stubs should never be implicitely created, but explicit calls to C<can>
+may break this.
+
 =item Subroutine %s redefined
 
 (W) You redefined a subroutine.  To suppress this warning, say
@@ -2018,7 +2096,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.
@@ -2090,7 +2168,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
@@ -2114,6 +2192,19 @@ 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 (try putting it first)
+
+(X) The #! line in a Perl script contains the B<-T> option, but Perl
+was not invoked with B<-T> in its argument list.  Due to the way Perl
+handles tainting, 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.
+
+This error can usually be fixed by editing the "#!" line so that the
+B<-T> option is in the Perl program's first argument.  (Many operating
+systems that implement the "#!" feature only pick up one argument from
+it, so Perl has to get the rest on its own.)
+
 =item Too many ('s
 
 =item Too many )'s
@@ -2385,7 +2476,51 @@ something else of the same name (usually a subroutine) is exported
 by that module.  It usually means you put the wrong funny character
 on the front of your variable.
 
-=item Variable syntax.
+=item Variable "%s" may be unavailable
+
+(W) An inner (nested) I<anonymous> subroutine is inside a I<named>
+subroutine, and outside that is another subroutine; and the anonymous
+(innermost) subroutine is referencing a lexical variable defined in
+the outermost subroutine.  For example:
+
+   sub outermost { my $a; sub middle { sub { $a } } }
+
+If the anonymous subroutine is called or referenced (directly or
+indirectly) from the outermost subroutine, it will share the variable
+as you would expect.  But if the anonymous subroutine is called or
+referenced when the outermost subroutine is not active, it will see
+the value of the shared variable as it was before and during the
+*first* call to the outermost subroutine, which is probably not what
+you want.
+
+In these circumstances, it is usually best to make the middle
+subroutine anonymous, using the C<sub {}> syntax.  Perl has specific
+support for shared variables in nested anonymous subroutines; a named
+subroutine in between interferes with this feature.
+
+=item Variable "%s" will not stay shared
+
+(W) An inner (nested) I<named> subroutine is referencing a lexical
+variable defined in an outer subroutine.
+
+When the inner subroutine is called, it will probably see the value of
+the outer subroutine's variable as it was before and during the
+*first* call to the outer subroutine; in this case, after the first
+call to the outer subroutine is complete, the inner and outer
+subroutines will no longer share a common value for the variable.  In
+other words, the variable will no longer be shared.
+
+Furthermore, if the outer subroutine is anonymous and references a
+lexical variable outside itself, then the outer and inner subroutines
+will I<never> share the given variable.
+
+This problem can usually be solved by making the inner subroutine
+anonymous, using the C<sub {}> syntax.  When inner anonymous subs that
+reference variables in outer subroutines are called or referenced,
+they are automatically re-bound to the current values of such
+variables.
+
+=item 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
@@ -2396,7 +2531,7 @@ into Perl yourself.
 (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.
@@ -2498,10 +2633,10 @@ streams, such as
     }
     close OUT;
 
-=item Got an error from DosAllocMem:
+=item Got an error from DosAllocMem
 
-(P) An error peculiar to OS/2. Most probably you use an obsolete version
-of perl, and this should not happen anyway.
+(P) An error peculiar to OS/2.  Most probably you're using an obsolete
+version of Perl, and this should not happen anyway.
 
 =item Malformed PERLLIB_PREFIX