Update some docs to explain that Perl no longer has a 2038 bug.
[p5sagit/p5-mst-13.2.git] / pod / perldiag.pod
index c91f905..775e274 100644 (file)
@@ -9,7 +9,7 @@ desperation):
 
     (W) A warning (optional).
     (D) A deprecation (optional).
-    (S) A severe warning (default).
+    (S) A severe warning (enabled by default).
     (F) A fatal error (trappable).
     (P) An internal error you should never see (trappable).
     (X) A very fatal error (nontrappable).
@@ -27,7 +27,7 @@ and B<-W> switches. 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>.
 
-Default warnings are always enabled unless they are explicitly disabled
+Severe warnings are always enabled, unless they are explicitly disabled
 with the C<warnings> pragma or the B<-X> switch.
 
 Trappable errors may be trapped using the eval operator.  See
@@ -131,12 +131,14 @@ for example, turn C<-w -U> into C<-wU>.
 
 (F) msgsnd() requires a string at least as long as sizeof(long).
 
-=item %s argument is not a HASH or ARRAY element
+=item %s argument is not a HASH or ARRAY element or a subroutine
 
-(F) The argument to exists() must be a hash or array element, such as:
+(F) The argument to exists() must be a hash or array element or a
+subroutine with an ampersand, such as:
 
     $foo{$bar}
     $ref->{"susie"}[12]
+    &do_something
 
 =item %s argument is not a HASH or ARRAY element or slice
 
@@ -282,6 +284,13 @@ 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 reload %s aborted.
+
+(F) You tried to load a file with C<use> or C<require> that failed to
+compile once already.  Perl will not try to compile this file again
+unless you delete its entry from %INC.  See L<perlfunc/require> and
+L<perlvar/%INC>.
+
 =item Attempt to set length of freed array
 
 (W) You tried to set the length of an array which has been freed.  You
@@ -606,13 +615,13 @@ quotas or other plumbing problems.
 =item Can't declare class for non-scalar %s in "%s"
 
 (F) Currently, only scalar variables can be declared with a specific
-class qualifier in a "my" or "our" declaration.  The semantics may be
+class qualifier in a "my", "our" or "state" declaration.  The semantics may be
 extended for other types of variables in future.
 
 =item Can't declare %s in "%s"
 
-(F) Only scalar, array, and hash variables may be declared as "my" or
-"our" variables.  They must have ordinary identifiers as names.
+(F) Only scalar, array, and hash variables may be declared as "my", "our" or
+"state" variables.  They must have ordinary identifiers as names.
 
 =item Can't do inplace edit: %s is not a regular file
 
@@ -848,7 +857,7 @@ extensions.
 =item Can't localize lexical variable %s
 
 (F) You used local on a variable name that was previously declared as a
-lexical variable using "my".  This is not allowed.  If you want to
+lexical variable using "my" or "state".  This is not allowed.  If you want to
 localize a package variable of the same name, qualify it with the
 package name.
 
@@ -1133,7 +1142,7 @@ allowed.  See L<perlfunc/pack>.
 (F) Only a simple scalar variable may be used as a loop variable on a
 foreach.
 
-=item Can't use global %s in "my"
+=item Can't use global %s in "%s"
 
 (F) You tried to declare a magical variable as a lexical variable.  This
 is not allowed, because the magic can be tied to only one location
@@ -1804,10 +1813,10 @@ L<perlfunc/getsockopt>.
 
 =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"), declared beforehand using
-"our", or explicitly qualified to say which package the global variable
-is in (using "::").
+(F) You've said "use strict" or "use strict vars", which indicates 
+that all variables must either be lexically scoped (using "my" or "state"), 
+declared beforehand using "our", or explicitly qualified to say 
+which package the global variable is in (using "::").
 
 =item glob failed (%s)
 
@@ -1952,7 +1961,7 @@ Interpretation of the octal number stopped before the 8 or 9.
 =item Illegal switch in PERL5OPT: %s
 
 (X) The PERL5OPT environment variable may only be used to set the
-following switches: B<-[CDIMUdmtwA]>.
+following switches: B<-[CDIMUdmtw]>.
 
 =item Ill-formed CRTL environ value "%s"
 
@@ -1999,6 +2008,13 @@ either consume text or fail.
 The <-- HERE shows in the regular expression about where the problem was
 discovered.
 
+=item Initialization of state variables in list context currently forbidden
+
+(F) Currently the implementation of "state" only permits the initialization
+of scalar variables in scalar context. Re-write C<state ($a) = 42> as
+C<state $a = 42> to change from list to scalar context. Constructions such
+as C<state (@a) = foo()> will be supported in a future perl release.
+
 =item Insecure dependency in %s
 
 (F) You tried to do something that the tainting mechanism didn't like.
@@ -2242,6 +2258,15 @@ L<perlfunc/listen>.
 (F) There is currently a limit on the length of string which lookbehind can
 handle. This restriction may be eased in a future release. 
 
+=item Lost precision when %s %f by 1
+
+(W) The value you attempted to increment or decrement by one is too large
+for the underlying floating point representation to store accurately,
+hence the target of C<++> or C<--> is unchanged. Perl issues this warning
+because it has already switched from integers to floating point when values
+are too large for integers, and now even floating point is insufficient.
+You may wish to switch to using L<Math::BigInt> explicitly.
+
 =item lstat() on filehandle %s
 
 (W io) You tried to do an lstat on a filehandle.  What did you mean
@@ -2493,7 +2518,7 @@ See L<perlfunc/pack>.
 (F) Lexically scoped subroutines are not yet implemented.  Don't try
 that yet.
 
-=item "my" variable %s can't be in a package
+=item "%s" 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
@@ -2680,7 +2705,7 @@ package has restricted the set of allowed keys using the L<fields> pragma.
 
 =item No such class %s
 
-(F) You provided a class qualifier in a "my" or "our" declaration, but
+(F) You provided a class qualifier in a "my", "our" or "state" declaration, but
 this class doesn't exist at this point in your program.
 
 =item No such pipe open
@@ -3164,6 +3189,11 @@ then discovered it wasn't a subroutine or eval context.
 
 (P) scan_num() got called on something that wasn't a number.
 
+=item panic: sv_chop %s
+
+(P) The sv_chop() routine was passed a position that is not within the
+scalar's string buffer.
+
 =item panic: sv_insert
 
 (P) The sv_insert() routine was told to remove more string than there
@@ -3206,7 +3236,7 @@ when you meant
 
     my ($foo, $bar) = @_;
 
-Remember that "my", "our", and "local" bind tighter than comma.
+Remember that "my", "our", "local" and "state" bind tighter than comma.
 
 =item C<-p> destination: %s
 
@@ -3278,11 +3308,6 @@ fine from VMS' perspective, it's probably not what you intended.
 
 (F) The unpack format P must have an explicit size, not "*".
 
-=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 POSIX class [:%s:] unknown in regex; marked by <-- HERE in m/%s/
 
 (F) The class in the character class [: :] syntax is unknown.  The <-- HERE
@@ -3394,6 +3419,20 @@ but there was no array C<@foo> in scope at the time. If you wanted a
 literal @foo, then write it as \@foo; otherwise find out what happened
 to the array you apparently lost track of.
 
+=item Possible unintended interpolation of $\ in regex
+
+(W ambiguous) You said something like C<m/$\/> in a regex.
+The regex C<m/foo$\s+bar/m> translates to: match the word 'foo', the output
+record separartor (see L<perlvar/$\>) and the letter 's' (one time or more)
+followed by the word 'bar'.
+
+If this is what you intended then you can silence the warning by using 
+C<m/${\}/> (for example: C<m/foo${\}s+bar/>).
+
+If instead you intended to match the word 'foo' at the end of the line
+followed by whitespace and the word 'bar' on the next line then you can use
+C<m/$(?)\/> (for example: C<m/foo$(?)\s+bar/>).
+
 =item pragma "attrs" is deprecated, use "sub NAME : ATTRS" instead
 
 (D deprecated) You have written something like this:
@@ -3449,6 +3488,11 @@ port.  One can easily disable this by appropriate sighandlers, see
 L<perlipc/"Signals">.  See also "Process terminated by SIGTERM/SIGINT"
 in L<perlos2>.
 
+=item Prototype after '%c' for %s : %s
+
+(W syntax) A character follows % or @ in a prototype. This is useless,
+since % and @ gobble the rest of the subroutine arguments.
+
 =item Prototype mismatch: %s vs %s
 
 (S prototype) The subroutine being declared or defined had previously been
@@ -3560,7 +3604,7 @@ a reference count of other than 1.
 
 (F) You used C<\g0> or similar in a regular expression. You may refer to
 capturing parentheses only with strictly positive integers (normal
-backreferences) or with stricly negative integers (relative
+backreferences) or with strictly negative integers (relative
 backreferences), but using 0 does not make sense.
 
 =item Reference to nonexistent group in regex; marked by <-- HERE in m/%s/
@@ -4410,11 +4454,11 @@ reserved word.  It's best to put such a word in quotes, or capitalize it
 somehow, or insert an underbar into it.  You might also declare it as a
 subroutine.
 
-=item Unrecognized character %s
+=item Unrecognized character %s in column %d
 
 (F) The Perl parser has no idea what to do with the specified character
-in your Perl script (or eval).  Perhaps you tried to run a compressed
-script, a binary program, or a directory as a Perl program.
+in your Perl script (or eval) at the specified column.  Perhaps you tried 
+to run a compressed script, a binary program, or a directory as a Perl program.
 
 =item Unrecognized escape \\%c in character class passed through in regex; marked by <-- HERE in m/%s/
 
@@ -4751,7 +4795,7 @@ to be huge numbers, and so usually indicates programmer error.
 If you really do mean it, explicitly numify your reference, like so:
 C<$array[0+$ref]>.  This warning is not given for overloaded objects,
 either, because you can overload the numification and stringification
-operators and then you assumedly know what you are doing.
+operators and then you assumably know what you are doing.
 
 =item Use of reserved word "%s" is deprecated
 
@@ -4869,7 +4913,7 @@ known at compile time.  See L<perlre>.
 
 =item "%s" variable %s masks earlier declaration in same %s
 
-(W misc) A "my" or "our" variable has been redeclared in the current
+(W misc) A "my", "our" or "state" variable has been redeclared in the current
 scope or statement, 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
@@ -4919,16 +4963,6 @@ the version number.
 (W misc) The version string contains invalid characters at the end, which
 are being ignored.
 
-=item v-string in use/require is non-portable
-
-(W portable) The use of v-strings is non-portable to older, pre-5.6, Perls.
-If you want your scripts to be backward portable, use the floating
-point version number: for example, instead of C<use 5.6.1> say
-C<use 5.006_001>.  This of course won't help: the older Perls
-won't suddenly start understanding newer features, but at least
-they will show a sensible error message indicating the required
-minimum version.
-
 =item Warning: something's wrong
 
 (W) You passed warn() an empty string (the equivalent of C<warn "">) or
@@ -5024,4 +5058,8 @@ Something Very Wrong.
 
 =back
 
+=head1 SEE ALSO
+
+L<warnings>, L<perllexwarn>.
+
 =cut