This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldiag: more sorting
[perl5.git] / pod / perldiag.pod
index f6aff22..4a3a3d0 100644 (file)
@@ -1527,6 +1527,15 @@ array is empty, just use C<if (@array) { # not empty }> for example.
 checks for an undefined I<scalar> value.  If you want to see if the hash
 is empty, just use C<if (%hash) { # not empty }> for example.
 
+=item (?(DEFINE)....) does not allow branches in regex; marked by <-- HERE in m/%s/
+
+(F) You used something like C<(?(DEFINE)...|..)> which is illegal. The
+most likely cause of this error is that you left out a parenthesis inside
+of the C<....> part.
+
+The <-- HERE shows in the regular expression about where the problem was
+discovered.
+
 =item %s defines neither package nor VERSION--version check failed
 
 (F) You said something like "use Module 42" but in the Module file
@@ -3081,14 +3090,15 @@ need to be added to UTC to get local time.
 
 =item Non-octal character '%c'.  Resolved as "%s"
 
-(W digit)  In parsing an octal numeric constant, a character was unexpectedly
-encountered that isn't octal.  The resulting value is as indicated.
+(W digit)  In parsing an octal numeric constant, a character was
+unexpectedly encountered that isn't octal.  The resulting value is as
+indicated.
 
 =item Non-string passed as bitmask
 
 (W misc) A number has been passed as a bitmask argument to select().
 Use the vec() function to construct the file descriptor bitmasks for
-select. See L<perlfunc/select>
+select. See L<perlfunc/select>.
 
 =item Null filename used
 
@@ -3128,8 +3138,9 @@ the meantime, try using scientific notation (e.g. "1e6" instead of
 
 =item Number with no digits
 
-(F) Perl was looking for a number but found nothing that looked like a number.
-This happens, for example with C<\o{}>, with no number between the braces.
+(F) Perl was looking for a number but found nothing that looked like
+a number. This happens, for example with C<\o{}>, with no number between
+the braces.
 
 =item Octal number in vector unsupported
 
@@ -3143,8 +3154,6 @@ future version.
 (4294967295) and therefore non-portable between systems.  See
 L<perlport> for more on portability concerns.
 
-See also L<perlport> for writing portable code.
-
 =item Odd number of arguments for overload::constant
 
 (W overload) The call to overload::constant contained an odd number of
@@ -3208,15 +3217,13 @@ and is deprecated.
 (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>.
+the C<fallback> overloading key is specified to be true.  See L<overload>.
 
-=item Operation "%s" returns its argument for UTF-16 surrogate U+%X
+=item Operation "%s" returns its argument for non-Unicode code point 0x%X
 
-(W) You performed an operation requiring Unicode semantics on a Unicode
-surrogate.  Unicode frowns upon the use of surrogates for anything but
-storing strings in UTF-16, but semantics are (reluctantly) defined for
-the surrogates, and they are to do nothing for this operation.  Because
-the use of surrogates can be dangerous, Perl warns.
+(W) You performed an operation requiring Unicode semantics on a code
+point that is not in Unicode, so what it should do is not defined.  Perl
+has chosen to have it do nothing, and warn you.
 
 If the operation shown is "ToFold", it means that case-insensitive
 matching in a regular expression was done on the code point.
@@ -3224,11 +3231,13 @@ matching in a regular expression was done on the code point.
 If you know what you are doing you can turn off this warning by
 C<no warnings 'utf8';>.
 
-=item Operation "%s" returns its argument for non-Unicode code point 0x%X
+=item Operation "%s" returns its argument for UTF-16 surrogate U+%X
 
-(W) You performed an operation requiring Unicode semantics on a code
-point that is not in Unicode, so what it should do is not defined.  Perl
-has chosen to have it do nothing, and warn you.
+(W) You performed an operation requiring Unicode semantics on a Unicode
+surrogate.  Unicode frowns upon the use of surrogates for anything but
+storing strings in UTF-16, but semantics are (reluctantly) defined for
+the surrogates, and they are to do nothing for this operation.  Because
+the use of surrogates can be dangerous, Perl warns.
 
 If the operation shown is "ToFold", it means that case-insensitive
 matching in a regular expression was done on the code point.
@@ -3332,30 +3341,6 @@ package-specific handler.  That name might have a meaning to Perl itself
 some day, even though it doesn't yet.  Perhaps you should use a
 mixed-case attribute name, instead.  See L<attributes>.
 
-=item \p{} uses Unicode rules, not locale rules
-
-(W) You compiled a regular expression that contained a Unicode property
-match (C<\p> or C<\P>), but the regular expression is also being told to
-use the run-time locale, not Unicode.  Instead, use a POSIX character
-class, which should know about the locale's rules.
-(See L<perlrecharclass/POSIX Character Classes>.)
-
-Even if the run-time locale is ISO 8859-1 (Latin1), which is a subset of
-Unicode, some properties will give results that are not valid for that
-subset.
-
-Here are a couple of examples to help you see what's going on.  If the
-locale is ISO 8859-7, the character at code point 0xD7 is the "GREEK
-CAPITAL LETTER CHI".  But in Unicode that code point means the
-"MULTIPLICATION SIGN" instead, and C<\p> always uses the Unicode
-meaning.  That means that C<\p{Alpha}> won't match, but C<[[:alpha:]]>
-should.  Only in the Latin1 locale are all the characters in the same
-positions as they are in Unicode.  But, even here, some properties give
-incorrect results.  An example is C<\p{Changes_When_Uppercased}> which
-is true for "LATIN SMALL LETTER Y WITH DIAERESIS", but since the upper
-case of that character is not in Latin1, in that locale it doesn't
-change when upper cased.
-
 =item pack/unpack repeat count overflow
 
 (F) You can't specify a repeat count so large that it overflows your
@@ -3564,8 +3549,8 @@ was string.
 
 =item panic: unimplemented op %s (#%d) called
 
-(P) The compiler is screwed up and attempted to use an op that isn't permitted
-at run time.
+(P) The compiler is screwed up and attempted to use an op that isn't
+permitted at run time.
 
 =item panic: utf16_to_utf8: odd bytelen
 
@@ -3658,9 +3643,9 @@ This error means that Perl detected that you and/or your operating
 system supplier and/or system administrator have set up the so-called
 locale system but Perl could not use those settings.  This was not
 dead serious, fortunately: there is a "default locale" called "C" that
-Perl can and will use, the script will be run.  Before you really fix
-the problem, however, you will get the same error message each time
-you run Perl.  How to really fix the problem can be found in
+Perl can and will use, and the script will be run.  Before you really
+fix the problem, however, you will get the same error message each
+time you run Perl.  How to really fix the problem can be found in
 L<perllocale> section B<LOCALE PROBLEMS>.
 
 =item pid %x not a child
@@ -3777,13 +3762,6 @@ higher precedence of C<==>. This is probably not what you want. (If you
 really meant to write this, disable the warning, or, better, put the
 parentheses explicitly and write C<$x & ($y == 0)>).
 
-=item Possible unintended interpolation of %s in string
-
-(W ambiguous) You said something like `@foo' in a double-quoted string
-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.
@@ -3798,6 +3776,13 @@ 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 Possible unintended interpolation of %s in string
+
+(W ambiguous) You said something like `@foo' in a double-quoted string
+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 Precedence problem: open %s should be open(%s)
 
 (S precedence) The old irregular construct
@@ -3850,6 +3835,30 @@ declared or defined with a different function prototype.
 (F) You've omitted the closing parenthesis in a function prototype
 definition.
 
+=item \p{} uses Unicode rules, not locale rules
+
+(W) You compiled a regular expression that contained a Unicode property
+match (C<\p> or C<\P>), but the regular expression is also being told to
+use the run-time locale, not Unicode.  Instead, use a POSIX character
+class, which should know about the locale's rules.
+(See L<perlrecharclass/POSIX Character Classes>.)
+
+Even if the run-time locale is ISO 8859-1 (Latin1), which is a subset of
+Unicode, some properties will give results that are not valid for that
+subset.
+
+Here are a couple of examples to help you see what's going on.  If the
+locale is ISO 8859-7, the character at code point 0xD7 is the "GREEK
+CAPITAL LETTER CHI".  But in Unicode that code point means the
+"MULTIPLICATION SIGN" instead, and C<\p> always uses the Unicode
+meaning.  That means that C<\p{Alpha}> won't match, but C<[[:alpha:]]>
+should.  Only in the Latin1 locale are all the characters in the same
+positions as they are in Unicode.  But, even here, some properties give
+incorrect results.  An example is C<\p{Changes_When_Uppercased}> which
+is true for "LATIN SMALL LETTER Y WITH DIAERESIS", but since the upper
+case of that character is not in Latin1, in that locale it doesn't
+change when upper cased.
+
 =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
@@ -3919,12 +3928,6 @@ which is why it's currently left out of your copy.
 believes it found an infinite loop in the C<@ISA> hierarchy.  This is a
 crude check that bails out after 100 levels of C<@ISA> depth.
 
-=item Recursive inheritance detected while looking for method %s
-
-(F) More than 100 levels of inheritance were encountered while invoking
-a method.  Probably indicates an unintended loop in your inheritance
-hierarchy.
-
 =item Reference found where even-sized list expected
 
 (W misc) You gave a single reference where Perl was expecting a list
@@ -3945,30 +3948,21 @@ Doing so has no effect.
 =item Reference miscount in sv_replace()
 
 (W internal) The internal sv_replace() function was handed a new SV with
-a reference count of other than 1.
+a reference count other than 1.
 
 =item Reference to invalid group 0
 
 (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 strictly negative integers (relative
-backreferences), but using 0 does not make sense.
+backreferences). Using 0 does not make sense.
 
 =item Reference to nonexistent group in regex; marked by <-- HERE in m/%s/
 
 (F) You used something like C<\7> in your regular expression, but there are
-not at least seven sets of capturing parentheses in the expression. If you
-wanted to have the character with ordinal 7 inserted into the regular expression,
-prepend zeroes to make it three digits long: C<\007>
-
-The <-- HERE shows in the regular expression about where the problem was
-discovered.
-
-=item Reference to nonexistent or unclosed group in regex; marked by <-- HERE in m/%s/
-
-(F) You used something like C<\g{-7}> in your regular expression, but there are
-not at least seven sets of closed capturing parentheses in the expression before
-where the C<\g{-7}> was located.
+not at least seven sets of capturing parentheses in the expression. If
+you wanted to have the character with ordinal 7 inserted into the regular
+expression, prepend zeroes to make it three digits long: C<\007>
 
 The <-- HERE shows in the regular expression about where the problem was
 discovered.
@@ -3976,18 +3970,18 @@ discovered.
 =item Reference to nonexistent named group in regex; marked by <-- HERE in m/%s/
 
 (F) You used something like C<\k'NAME'> or C<< \k<NAME> >> in your regular
-expression, but there is no corresponding named capturing parentheses such
-as C<(?'NAME'...)> or C<(?<NAME>...). Check if the name has been spelled
-correctly both in the backreference and the declaration.
+expression, but there is no corresponding named capturing parentheses
+such as C<(?'NAME'...)> or C<< (?<NAME>...) >>. Check if the name has been
+spelled correctly both in the backreference and the declaration.
 
 The <-- HERE shows in the regular expression about where the problem was
 discovered.
 
-=item (?(DEFINE)....) does not allow branches in regex; marked by <-- HERE in m/%s/
+=item Reference to nonexistent or unclosed group in regex; marked by <-- HERE in m/%s/
 
-(F) You used something like C<(?(DEFINE)...|..)> which is illegal. The
-most likely cause of this error is that you left out a parenthesis inside
-of the C<....> part.
+(F) You used something like C<\g{-7}> in your regular expression, but there
+are not at least seven sets of closed capturing parentheses in the
+expression before where the C<\g{-7}> was located.
 
 The <-- HERE shows in the regular expression about where the problem was
 discovered.
@@ -4017,7 +4011,7 @@ are meaningless.
 =item Reversed %s= operator
 
 (W syntax) You wrote your assignment operator backwards.  The = must
-always comes last, to avoid ambiguity with subsequent unary operators.
+always come last, to avoid ambiguity with subsequent unary operators.
 
 =item rewinddir() attempted on invalid dirhandle %s
 
@@ -4082,16 +4076,16 @@ C<foo ? 0 : 1>) leading to some ambiguous constructions being wrongly
 parsed. One way to disambiguate the parsing is to put parentheses around
 the conditional expression, i.e. C<(foo) ? 0 : 1>.
 
-=item %sseek() on unopened filehandle
-
-(W unopened) You tried to use the seek() or sysseek() function on a
-filehandle that was either never opened or has since been closed.
-
 =item seekdir() attempted on invalid dirhandle %s
 
 (W io) The dirhandle you are doing a seekdir() on is either closed or not
 really a dirhandle.  Check your control flow.
 
+=item %sseek() on unopened filehandle
+
+(W unopened) You tried to use the seek() or sysseek() function on a
+filehandle that was either never opened or has since been closed.
+
 =item select not implemented
 
 (F) This machine doesn't implement the select() system call.
@@ -4157,12 +4151,12 @@ L<perlre>.
 
 =item Sequence (?{...}) not terminated or not {}-balanced in regex; marked by <-- HERE in m/%s/
 
-(F) If the contents of a (?{...}) clause contains braces, they must balance
-for Perl to properly detect the end of the clause. The <-- HERE shows in
+(F) If the contents of a (?{...}) clause contain braces, they must balance
+for Perl to detect the end of the clause properly. The <-- HERE shows in
 the regular expression about where the problem was discovered. See
 L<perlre>.
 
-=item "500 Server error"
+=item Z<>500 Server error
 
 See Server error.
 
@@ -4361,7 +4355,7 @@ assignment or as a subroutine argument for example).
 
 =item sv_upgrade from type %d down to type %d
 
-(P) Perl tried to force the upgrade an SV to a type which was actually
+(P) Perl tried to force the upgrade of an SV to a type which was actually
 inferior to its current type.
 
 =item Switch (?(condition)... contains too many branches in regex; marked by <-- HERE in m/%s/
@@ -4378,16 +4372,16 @@ discovered. See L<perlre>.
 
 =item Switch condition not recognized in regex; marked by <-- HERE in m/%s/
 
-(F) If the argument to the (?(...)if-clause|else-clause) construct is a
-number, it can be only a number. The <-- HERE shows in the regular expression
-about where the problem was discovered. See L<perlre>.
+(F) If the argument to the (?(...)if-clause|else-clause) construct is
+a number, it can be only a number. The <-- HERE shows in the regular
+expression about where the problem was discovered. See L<perlre>.
 
 =item switching effective %s is not implemented
 
 (F) While under the C<use filetest> pragma, we cannot switch the real
 and effective uids or gids.
 
-=item %s syntax
+=item %s syntax OK
 
 (F) The final summary message when a C<perl -c> succeeds.
 
@@ -4455,16 +4449,16 @@ know about your kind of stdio.  You'll have to use a filename instead.
 (F) You tried to use C<goto> to reach a label that was too deeply nested
 for Perl to reach.  Perl is doing you a favor by refusing.
 
-=item tell() on unopened filehandle
-
-(W unopened) You tried to use the tell() function on a filehandle that
-was either never opened or has since been closed.
-
 =item telldir() attempted on invalid dirhandle %s
 
 (W io) The dirhandle you tried to telldir() is either closed or not really
 a dirhandle.  Check your control flow.
 
+=item tell() on unopened filehandle
+
+(W unopened) You tried to use the tell() function on a filehandle that
+was either never opened or has since been closed.
+
 =item That use of $[ is unsupported
 
 (F) Assignment to C<$[> is now strictly circumscribed, and interpreted
@@ -4751,11 +4745,17 @@ subvert Perl's population of %ENV for nefarious purposes.
 =item Unknown switch condition (?(%s in regex; marked by <-- HERE in m/%s/
 
 (F) The condition part of a (?(condition)if-clause|else-clause) construct
-is not known. The condition may be lookahead or lookbehind (the condition
-is true if the lookahead or lookbehind is true), a (?{...})  construct (the
-condition is true if the code evaluates to a true value), or a number (the
-condition is true if the set of capturing parentheses named by the number
-matched).
+is not known. The condition must be one of the following:
+
+  (1) (2) ...        true if 1st, 2nd, etc., capture matched
+  (<NAME>) ('NAME')  true if named capture matched
+  (?=...) (?<=...)   true if subpattern matches
+  (?!...) (?<!...)   true if subpattern fails to match
+  (?{ CODE })        true if code returns a true value
+  (R)                true if evaluating inside recursion
+  (R1) (R2) ...      true if directly inside capture group 1, 2, etc.
+  (R&NAME)           true if directly inside named capture
+  (DEFINE)           always false; for defining named subpatterns
 
 The <-- HERE shows in the regular expression about where the problem was
 discovered.  See L<perlre>.
@@ -4770,21 +4770,20 @@ of the C<-C> switch for the list of known options.
 (F) You specified an unknown Unicode option.  See L<perlrun> documentation
 of the C<-C> switch for the list of known options.
 
-=item Unknown warnings category '%s'
-
-(F) An error issued by the C<warnings> pragma. You specified a warnings
-category that is unknown to perl at this point.
-
-Note that if you want to enable a warnings category registered by a module
-(e.g. C<use warnings 'File::Find'>), you must have imported this module
-
 =item Unknown verb pattern '%s' in regex; marked by <-- HERE in m/%s/
 
 (F) You either made a typo or have incorrectly put a C<*> quantifier
 after an open brace in your pattern.  Check the pattern and review
 L<perlre> for details on legal verb patterns.
 
-first.
+=item Unknown warnings category '%s'
+
+(F) An error issued by the C<warnings> pragma. You specified a warnings
+category that is unknown to perl at this point.
+
+Note that if you want to enable a warnings category registered by a
+module (e.g. C<use warnings 'File::Find'>), you must have loaded this
+module first.
 
 =item unmatched [ in regex; marked by <-- HERE in m/%s/
 
@@ -4907,16 +4906,6 @@ character to get your parentheses to balance.  See L<attributes>.
 compressed integer format and could not be converted to an integer.
 See L<perlfunc/pack>.
 
-=item Unterminated verb pattern in regex; marked by <-- HERE in m/%s/
-
-(F) You used a pattern of the form C<(*VERB)> but did not terminate
-the pattern with a C<)>. Fix the pattern and retry.
-
-=item Unterminated verb pattern argument in regex; marked by <-- HERE in m/%s/
-
-(F) You used a pattern of the form C<(*VERB:ARG)> but did not terminate
-the pattern with a C<)>. Fix the pattern and retry.
-
 =item Unterminated \g{...} pattern in regex; marked by <-- HERE in m/%s/
 
 (F) You missed a close brace on a \g{..} pattern (group reference) in
@@ -4929,6 +4918,16 @@ a term, so it's looking for the corresponding right angle bracket, and
 not finding it.  Chances are you left some needed parentheses out
 earlier in the line, and you really meant a "less than".
 
+=item Unterminated verb pattern argument in regex; marked by <-- HERE in m/%s/
+
+(F) You used a pattern of the form C<(*VERB:ARG)> but did not terminate
+the pattern with a C<)>. Fix the pattern and retry.
+
+=item Unterminated verb pattern in regex; marked by <-- HERE in m/%s/
+
+(F) You used a pattern of the form C<(*VERB)> but did not terminate
+the pattern with a C<)>. Fix the pattern and retry.
+
 =item untie attempted while %d inner references still exist
 
 (W untie) A copy of the object returned from C<tie> (or C<tied>) was
@@ -5096,15 +5095,6 @@ error, so C<:=> can be reclaimed as a new operator in the future.
 If you need an empty attribute list, for example in a code generator, add
 a space before the C<=>.
 
-=item Use of ?PATTERN? without explicit operator is deprecated
-
-(D deprecated) You have written something like C<?\w?>, for a regular
-expression that matches only once.  Starting this term directly with
-the question mark delimiter is now deprecated, so that the question mark
-will be available for use in new operators in the future.  Write C<m?\w?>
-instead, explicitly using the C<m> operator: the question mark delimiter
-still invokes match-once behaviour.
-
 =item Use of freed value in iteration
 
 (F) Perhaps you modified the iterated array within the loop?
@@ -5194,6 +5184,15 @@ name. So no namespace is current at all. Using this can cause many
 otherwise reasonable constructs to fail in baffling ways. C<use strict;>
 instead.
 
+=item Use of ?PATTERN? without explicit operator is deprecated
+
+(D deprecated) You have written something like C<?\w?>, for a regular
+expression that matches only once.  Starting this term directly with
+the question mark delimiter is now deprecated, so that the question mark
+will be available for use in new operators in the future.  Write C<m?\w?>
+instead, explicitly using the C<m> operator: the question mark delimiter
+still invokes match-once behaviour.
+
 =item Use of qw(...) as parentheses is deprecated
 
 (D deprecated) You have something like C<foreach $x qw(a b c) {...}>,