X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/7ea3cd407b6ec2a3e424bdfbc486b6e01d6d28bd..d496d686b582057a5ea25b09da7dd67592a7e1c0:/pod/perldiag.pod diff --git a/pod/perldiag.pod b/pod/perldiag.pod index a27dde7..56c843e 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -16,7 +16,7 @@ desperation): (A) An alien error message (not generated by Perl). The majority of messages from the first three classifications above -(W, D & S) can be controlled using the C pragma. +(W, D & S) can be controlled using the C pragma. If a message can be controlled by the C pragma, its warning category is included with the classification letter in the description @@ -72,7 +72,7 @@ Alternatively, you can import the subroutine (or pretend that it's imported with the C pragma). To silently interpret it as the Perl operator, use the C prefix -on the operator (e.g. C) or by declaring the subroutine +on the operator (e.g. C) or declare the subroutine to be an object method (see L or L). @@ -112,8 +112,8 @@ which 'splits' output into two streams, such as =item Applying %s to %s will act on scalar(%s) -(W misc) The pattern match (//), substitution (s///), and -transliteration (tr///) operators work on scalar values. If you apply +(W misc) The pattern match (C), substitution (C), and +transliteration (C) 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 @@ -184,9 +184,16 @@ know which context to supply to the right side. =item Negative offset to vec in lvalue context -(F) When vec is called in an lvalue context, the second argument must be +(F) When C is called in an lvalue context, the second argument must be greater than or equal to zero. +=item Attempt to access key '%_' in fixed hash + +(F) A hash has been marked as READONLY at the C level to turn it +into a "record" with a fixed set of keys. The failing code +has attempted to get or set the value of a key which does not +exist or to delete a key. + =item Attempt to bless into a reference (F) The CLASSNAME argument to the bless() operator is expected to be @@ -261,7 +268,7 @@ avoid this warning. used as an lvalue, which is pretty strange. Perhaps you forgot to dereference it first. See L. -=item Bad arg length for %s, is %d, should be %d +=item Bad arg length for %s, is %d, should be %s (F) You passed a buffer of the wrong size to one of msgctl(), semctl() or shmctl(). In C parlance, the correct sizes are, respectively, @@ -270,7 +277,7 @@ S. =item Bad evalled substitution pattern -(F) You've used the /e switch to evaluate the replacement for a +(F) You've used the C switch to evaluate the replacement for a substitution, but perl found a syntax error in the code to evaluate, most likely an unexpected right brace '}'. @@ -536,9 +543,9 @@ quotas or other plumbing problems. =item Can't declare class for non-scalar %s in "%s" -(S) Currently, only scalar variables can declared with a specific class -qualifier in a "my" or "our" declaration. The semantics may be extended -for other types of variables in future. +(F) Currently, only scalar variables can be declared with a specific +class qualifier in a "my" or "our" declaration. The semantics may be +extended for other types of variables in future. =item Can't declare %s in "%s" @@ -567,10 +574,10 @@ C<-i.bak>, or some such. characters and Perl was unable to create a unique filename during inplace editing with the B<-i> switch. The file was ignored. -=item Can't do {n,m} with n > m before << HERE in regex m/%s/ +=item Can't do {n,m} with n > m in regex; marked by <-- HERE in m/%s/ (F) Minima must be less than or equal to maxima. If you really want your -regexp to match something 0 times, just put {0}. The << HERE shows in the +regexp to match something 0 times, just put {0}. The <-- HERE shows in the regular expression about where the problem was discovered. See L. =item Can't do setegid! @@ -604,7 +611,7 @@ line. =item Can't exec "%s": %s -(W exec) An system(), exec(), or piped open call could not execute the +(W exec) 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 C<$ENV{PATH}>, the executable in question was compiled for another @@ -628,6 +635,13 @@ found in the PATH did not have correct permissions. (F) A string of a form C was given to prototype(), but there is no builtin with the name C. +=item Can't find %s character property "%s" + +(F) You used C<\p{}> or C<\P{}> but the character property by that name +could not be found. Maybe you misspelled the name of the property +(remember that the names of character properties consist only of +alphanumeric characters), or maybe you forgot the C or C prefix? + =item Can't find label %s (F) You said to goto a label that isn't mentioned anywhere that it's @@ -656,7 +670,7 @@ If you're getting this error from a here-document, you may have included unseen whitespace before or after your closing tag. A good programmer's editor will have a way to help you find these characters. -=item Can't find %s property definition %s +=item Can't find %s property definition %s (F) You may have tried to use C<\p> which means a Unicode property for example \p{Lu} is all uppercase letters. Escape the C<\p>, either @@ -759,7 +773,7 @@ directly -- C<< local $ar->[$ar->[0]{'key'}] >>. (F) You said something like C, which Perl can't currently handle, because when it goes to restore the old value of whatever $ref pointed to after the scope of the local() is finished, it can't be sure -that $ref will still be a reference. +that $ref will still be a reference. =item Can't locate %s @@ -868,7 +882,7 @@ the command line for writing. redirection, and couldn't open the pipe into which to send data destined for stdout. -=item Can't open perl script "%s": %s +=item Can't open perl script%s: %s (F) The script you specified can't be opened for the indicated reason. @@ -896,7 +910,7 @@ or grep(). 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. -=item Can't remove %s: %s, skipping file +=item Can't remove %s: %s, skipping file (S inplace) You requested an inplace edit without creating a backup file. Perl was unable to remove the original file to replace it with @@ -929,6 +943,14 @@ suidperl. temporary or readonly values) from a subroutine used as an lvalue. This is not allowed. +=item Can't return %s to lvalue scalar context + +(F) You tried to return a complete array or hash from an lvalue subroutine, +but you called the subroutine in a way that made Perl think you meant +to return only one value. You probably meant to write parentheses around +the call to the subroutine, which tell Perl that the call should be in +list context. + =item Can't return outside a subroutine (F) The return statement was executed in mainline code, that is, where @@ -986,12 +1008,18 @@ calling sv_upgrade. (F) A value used as either a hard reference or a symbolic reference must be a defined value. This helps to delurk some insidious errors. +=item Can't use anonymous symbol table for method lookup + +(P) The internal routine that does method lookup was handed a symbol +table that doesn't have a name. Symbol tables can become anonymous +for example by undefining stashes: C. + =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. -=item Can't use %%! because Errno.pm is not available +=item Can't use %! because Errno.pm is not available (F) The first time the %! hash is used, perl automatically loads the Errno.pm module. The Errno module is expected to tie the %! hash to @@ -1055,15 +1083,35 @@ references can be weakened. with an assignment operator, which implies modifying the value itself. Perhaps you need to copy the value to a temporary, and repeat that. -=item chmod() mode argument is missing initial 0 +=item Character in "C" format wrapped + +(W pack) You said -(W chmod) A novice will sometimes say + pack("C", $x) - chmod 777, $filename +where $x is either less than 0 or more than 255; the C<"C"> format is +only for encoding native operating system characters (ASCII, EBCDIC, +and so on) and not for Unicode characters, so Perl behaved as if you meant -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. + pack("C", $x & 255) + +If you actually want to pack Unicode codepoints, use the C<"U"> format +instead. + +=item Character in "c" format wrapped + +(W pack) You said + + pack("c", $x) + +where $x is either less than -128 or more than 127; the C<"c"> format +is only for encoding native operating system characters (ASCII, EBCDIC, +and so on) and not for Unicode characters, so Perl behaved as if you meant + + pack("c", $x & 255); + +If you actually want to pack Unicode codepoints, use the C<"U"> format +instead. =item close() on unopened filehandle %s @@ -1128,7 +1176,7 @@ workarounds. =item Copy method did not return a reference -(F) The method which overloads "=" is buggy. See +(F) The method which overloads "=" is buggy. See L. =item CORE::%s is not a keyword @@ -1171,13 +1219,13 @@ which case it indicates something else. (D deprecated) defined() is not usually useful on arrays because it checks for an undefined I value. If you want to see if the -array is empty, just use C for example. +array is empty, just use C for example. =item defined(%hash) is deprecated (D deprecated) defined() is not usually useful on hashes because it checks for an undefined I value. If you want to see if the hash -is empty, just use C for example. +is empty, just use C for example. =item Delimiter for here document is too long @@ -1241,6 +1289,11 @@ 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. +=item dump() better written as CORE::dump() + +(W misc) You used the obsolescent C built-in function, without fully +qualifying it as C. Maybe it's a typo. See L. + =item Duplicate free() ignored (S malloc) An internal routine called free() on something that had @@ -1253,6 +1306,10 @@ 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 be what you want. +=item Empty %s + +(F) Empty C<\p{}> or C<\P{}>. + =item entering effective %s failed (F) While under the C pragma, switching the real and @@ -1342,12 +1399,13 @@ Check the #! line, or manually feed your script into Perl yourself. END subroutine. Processing of the remainder of the queue of such routines has been prematurely ended. -=item false [] range "%s" in regexp +=item False [] range "%s" in regex; marked by <-- HERE in m/%s/ (W regexp) A character class range must start and end at a literal -character, not another character class like C<\d> or C<[:alpha:]>. The -"-" in your false range is interpreted as a literal "-". Consider -quoting the "-", "\-". See L. +character, not another character class like C<\d> or C<[:alpha:]>. The "-" +in your false range is interpreted as a literal "-". Consider quoting the +"-", "\-". The <-- HERE shows in the regular expression about where the +problem was discovered. See L. =item Fatal VMS error at %s, line %d @@ -1396,11 +1454,13 @@ some time before now. Check your control flow. flock() operates on filehandles. Are you attempting to call flock() on a dirhandle by the same name? -=item Quantifier follows nothing before << HERE in regex m/%s/ +=item Quantifier follows nothing in regex; + +marked by <-- HERE in m/%s/ (F) You started a regular expression with a quantifier. Backslash it if you -meant it literally. The << HERE shows in the regular expression about where the -problem was discovered. See L. +meant it literally. The <-- HERE shows in the regular expression about +where the problem was discovered. See L. =item Format not terminated @@ -1412,7 +1472,7 @@ to the end of your file without finding such a line. (W redefine) You redefined a format. To suppress this warning, say { - no warnings; + no warnings 'redefine'; eval "format NAME =..."; } @@ -1499,6 +1559,11 @@ version of Perl, and this should not happen anyway. (F) Unlike with "next" or "last", you're not allowed to goto an unspecified destination. See L. +=item %s-group starts with a count + +(F) In pack/unpack a ()-group started with a count. A count is +supposed to follow something: a template character or a ()-group. + =item %s had compilation errors (F) The final summary message when a C fails. @@ -1550,6 +1615,11 @@ when Perl was built using standard options. For some reason, your version of Perl appears to have been built without this support. Talk to your Perl administrator. +=item Illegal character in prototype for %s : %s + +(W syntax) An illegal character was found in a prototype declaration. Legal +characters in prototypes are $, @, %, *, ;, [, ], &, and \. + =item Illegal division by zero (F) You tried to divide a number by 0. Either something was wrong in @@ -1574,17 +1644,17 @@ two from 1 to 32 (or 64, if your platform supports that). =item Illegal octal digit %s -(F) You used an 8 or 9 in a octal number. +(F) You used an 8 or 9 in an octal number. =item Illegal octal digit %s ignored -(W digit) You may have tried to use an 8 or 9 in a octal number. +(W digit) You may have tried to use an 8 or 9 in an octal number. 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<-[DIMUdmw]>. +following switches: B<-[DIMUdmtw]>. =item Ill-formed CRTL environ value "%s" @@ -1646,13 +1716,12 @@ transparently promotes all numbers to a floating point representation internally--subject to loss of precision errors in subsequent operations. -=item Internal disaster before << HERE in regex m/%s/ +=item Internal disaster in regex; marked by <-- HERE in m/%s/ (P) Something went badly wrong in the regular expression parser. -The << HERE shows in the regular expression about where the problem was +The <-- HERE shows in the regular expression about where the problem was discovered. - =item Internal inconsistency in tracking vforks (S) A warning peculiar to VMS. Perl keeps track of the number of times @@ -1662,17 +1731,17 @@ L). Somehow, this count has become scrambled, so Perl is making a guess and treating this C as a request to terminate the Perl script and execute the specified command. -=item Internal urp before << HERE in regex m/%s/ - -(P) Something went badly awry in the regular expression parser. The <<. =item Invalid %s attribute: %s @@ -1690,12 +1759,15 @@ recognized by Perl or by a user-supplied handler. See L. (W printf) Perl does not understand the given format conversion. See L. -=item invalid [] range "%s" in regexp +=item Invalid [] range "%s" in regex; marked by <-- HERE in m/%s/ (F) The range specified in a character class had a minimum character -greater than the maximum character. See L. +greater than the maximum character. One possibility is that you forgot the +C<{}> from your ending C<\x{}> - C<\x> without the curly braces can go only +up to C. The <-- HERE shows in the regular expression about where the +problem was discovered. See L. -=item invalid [] range "%s" in transliteration operator +=item Invalid [] range "%s" in transliteration operator (F) The range specified in the tr/// or y/// operator had a minimum character greater than the maximum character. See L. @@ -1730,15 +1802,21 @@ strange for a machine that supports C. (W unopened) You tried ioctl() on a filehandle that was never opened. Check you control flow and number of arguments. +=item IO::Socket::atmark not implemented on this architecture + +(F) Your machine doesn't implement the sockatmark() functionality, +neither as a system call or an ioctl call (SIOCATMARK). + =item `%s' is not a code reference -(W) The second (fourth, sixth, ...) argument of overload::constant needs -to be a code reference. Either an anonymous subroutine, or a reference +(W overload) The second (fourth, sixth, ...) argument of overload::constant +needs to be a code reference. Either an anonymous subroutine, or a reference to a subroutine. =item `%s' is not an overloadable type -(W) You tried to overload a constant type the overload package is unaware of. +(W overload) You tried to overload a constant type the overload package is +unaware of. =item junk on end of regexp @@ -1775,7 +1853,7 @@ L. =item lstat() on filehandle %s -(W io) You tried to do a lstat on a filehandle. What did you mean +(W io) You tried to do an lstat on a filehandle. What did you mean by that? lstat() makes sense only on filenames. (Perl did a fstat() instead on the filehandle.) @@ -1785,11 +1863,13 @@ instead on the filehandle.) values cannot be returned in subroutines used in lvalue context. See L. -=item Lookbehind longer than %d not implemented before << HERE in reges m/%s/ +=item Lookbehind longer than %d not implemented in regex; + +marked by <-- HERE in m/%s/ (F) There is currently a limit on the length of string which lookbehind can -handle. This restriction may be eased in a future release. The << HERE shows in -the regular expression about where the problem was discovered. +handle. This restriction may be eased in a future release. The <-- HERE +shows in the regular expression about where the problem was discovered. =item Malformed PERLLIB_PREFIX @@ -1798,7 +1878,6 @@ the regular expression about where the problem was discovered. prefix1;prefix2 or - prefix1 prefix2 with nonempty prefix1 and prefix2. If C is indeed a prefix of @@ -1806,6 +1885,13 @@ a builtin library search path, prefix2 is substituted. The error may appear if components are not found, or are too long. See "PERLLIB_PREFIX" in L. +=item Malformed prototype for %s: %s + +(F) You tried to use a function with a malformed prototype. The +syntax of function prototypes is given a brief compile-time check for +obvious errors like invalid characters. A more rigorous check is run +when the function is called. + =item Malformed UTF-8 character (%s) Perl detected something that didn't comply with UTF-8 encoding rules. @@ -1815,11 +1901,20 @@ Perl detected something that didn't comply with UTF-8 encoding rules. Perl thought it was reading UTF-16 encoded character data but while doing it Perl met a malformed Unicode surrogate. -=item %s matches null string many times +=item %s matches null string many times in regex; + +marked by <-- HERE in m/%s/ (W regexp) The pattern you've specified would be an infinite loop if the -regular expression engine didn't specifically check for that. See -L. +regular expression engine didn't specifically check for that. The <-- HERE +shows in the regular expression about where the problem was discovered. +See L. + +=item "%s" may clash with future reserved word + +(W) This warning may be due to running a perl5 script through a perl4 +interpreter, especially if the word that is being warned about is +"use" or "my". =item % may only be used in unpack @@ -1844,7 +1939,8 @@ ended earlier on the current line. =item Misplaced _ in number -(W syntax) An underline in a decimal constant wasn't on a 3-digit boundary. +(W syntax) An underscore (underbar) in a numeric constant did not +separate two digits. =item Missing %sbrace%s on \N{} @@ -1878,6 +1974,10 @@ can vary from one line to the next. (S) This is an educated guess made in conjunction with the message "%s found where operator expected". Often the missing operator is a comma. +=item Missing right brace on %s + +(F) Missing right brace in C<\p{...}> or C<\P{...}>. + =item Missing right curly or square bracket (F) The lexer counted more opening curly or square brackets than closing @@ -1907,7 +2007,7 @@ is aliased to a constant in the look I: $x = 1; foreach my $n ($x, 2) { $n *= 2; # modifies the $x, but fails on attempt to modify the 2 - } + } =item Modification of non-creatable array value attempted, %s @@ -1979,16 +2079,15 @@ provided for this purpose. (F) You tried to do a read/write/send/recv operation with a buffer length that is less than 0. This is difficult to imagine. -=item Nested quantifiers before << HERE in regex m/%s/ +=item Nested quantifiers in regex; marked by <-- HERE in m/%s/ (F) You can't quantify a quantifier without intervening parentheses. So -things like ** or +* or ?* are illegal. The << HERE shows in the regular +things like ** or +* or ?* are illegal. The <-- HERE shows in the regular expression about where the problem was discovered. -Note, however, that the minimal matching quantifiers, C<*?>, C<+?>, and +Note that the minimal matching quantifiers, C<*?>, C<+?>, and C appear to be nested quantifiers, but aren't. See L. - =item %s never introduced (S internal) The symbol in question was declared but somehow went out of @@ -2114,6 +2213,11 @@ immediately after the switch, without intervening spaces. (F) The indicated command line switch needs a mandatory argument, but you haven't specified one. +=item No such class %s + +(F) You provided a class qualifier in a "my" or "our" declaration, but +this class doesn't exist at this point in your program. + =item No such pipe open (P) An error peculiar to VMS. The internal routine my_pclose() tried to @@ -2209,6 +2313,12 @@ supplied. See L. of Perl. Check the #! line, or manually feed your script into Perl yourself. +=item %s not allowed in length fields + +(F) The count in the (un)pack template may be replaced by C<[TEMPLATE]> only if +C