This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldiag: ‘Unicode surrogate is illegal’ is a default warning
[perl5.git] / pod / perldiag.pod
index ddcb2e1..d18279f 100644 (file)
@@ -85,13 +85,13 @@ C<tr/a-y//>, which was probably not what you would have expected.)
 
 =item Ambiguous use of %s resolved as %s
 
-(W ambiguous)(S) You said something that may not be interpreted the way
+(S ambiguous) You said something that may not be interpreted the way
 you thought.  Normally it's pretty easy to disambiguate it by supplying
 a missing quote, operator, parenthesis pair or declaration.
 
 =item Ambiguous use of %c resolved as operator %c
 
-(W ambiguous) C<%>, C<&>, and C<*> are both infix operators (modulus,
+(S ambiguous) C<%>, C<&>, and C<*> are both infix operators (modulus,
 bitwise and, and multiplication) I<and> initial special characters
 (denoting hashes, subroutines and typeglobs), and you said something
 like C<*foo * foo> that might be interpreted as either of them.  We
@@ -130,7 +130,7 @@ off warnings with C<no warnings 'ambiguous';>.
 
 =item Ambiguous use of -%s resolved as -&%s()
 
-(W ambiguous) You wrote something like C<-foo>, which might be the
+(S ambiguous) You wrote something like C<-foo>, which might be the
 string C<"-foo">, or a call to the function C<foo>, negated.  If you meant
 the string, just write C<"-foo">.  If you meant the function call,
 write C<-foo()>.
@@ -345,9 +345,10 @@ 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
-can do this by storing a reference to the scalar representing the last index
-of an array and later assigning through that reference.  For example
+(W misc) You tried to set the length of an array which has
+been freed.  You can do this by storing a reference to the
+scalar representing the last index of an array and later
+assigning through that reference.  For example
 
     $r = do {my @a; \$#a};
     $$r = 503
@@ -1425,7 +1426,7 @@ another template code following the slash.  See L<perlfunc/pack>.
 
 =item Code point 0x%X is not Unicode, all \p{} matches fail; all \P{} matches succeed
 
-(W utf8, non_unicode) You had a code point above the Unicode maximum
+(S utf8, non_unicode) You had a code point above the Unicode maximum
 of U+10FFFF.
 
 Perl allows strings to contain a superset of Unicode code points, up
@@ -1759,8 +1760,8 @@ already been freed.
 
 =item Duplicate modifier '%c' after '%c' in %s
 
-(W) You have applied the same modifier more than once after a type
-in a pack template.  See L<perlfunc/pack>.
+(W unpack) You have applied the same modifier more than once after a
+type in a pack template.  See L<perlfunc/pack>.
 
 =item elseif should be elsif
 
@@ -1794,13 +1795,13 @@ 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 %s: Eval-group in insecure regular expression
+=item Eval-group in insecure regular expression
 
 (F) Perl detected tainted data when trying to compile a regular
 expression that contains the C<(?{ ... })> zero-width assertion, which
 is unsafe.  See L<perlre/(?{ code })>, and L<perlsec>.
 
-=item %s: Eval-group not allowed at runtime, use re 'eval'
+=item Eval-group not allowed at runtime, use re 'eval' in regex m/%s/
 
 (F) Perl tried to compile a regular expression containing the
 C<(?{ ... })> zero-width assertion at run time, as it would when the
@@ -1810,7 +1811,7 @@ C<re 'eval'> pragma or by explicitly building the pattern from an
 interpolated string at run time and using that in an eval().  See
 L<perlre/(?{ code })>.
 
-=item %s: Eval-group not allowed, use re 'eval'
+=item Eval-group not allowed, use re 'eval' in regex m/%s/
 
 (F) A regular expression contained the C<(?{ ... })> zero-width
 assertion, but that construct is only allowed when the C<use re 'eval'>
@@ -2109,6 +2110,16 @@ Further error messages would likely be uninformative.
 (4294967295) and therefore non-portable between systems.  See
 L<perlport> for more on portability concerns.
 
+=item -i used with no filenames on the command line, reading from STDIN
+
+(S inplace) The C<-i> option was passed on the command line, indicating
+that the script is intended to edit files inplace, but no files were
+given.  This is usually a mistake, since editing STDIN inplace doesn't
+make sense, and can be confusing because it can make perl look like
+it is hanging when it is really just trying to read from STDIN.  You
+should either pass a filename to edit, or remove C<-i> from the command
+line.  See L<perlrun> for more details.
+
 =item Identifier too long
 
 (F) Perl limits identifiers (names for variables, functions, etc.) to
@@ -2299,6 +2310,15 @@ transparently promotes all numbers to a floating point representation
 internally--subject to loss of precision errors in subsequent
 operations.
 
+=item Integer overflow in srand
+
+(S overflow) The number you have passed to srand is too big to fit
+in your architecture's integer representation.  The number has been
+replaced with the largest integer supported (0xFFFFFFFF on 32-bit
+architectures).  This means you may be getting less randomness than
+you expect, because different random seeds above the maximum will
+return the same sequence of random numbers.
+
 =item Integer overflow in version
 
 =item Integer overflow in version %d
@@ -2363,6 +2383,8 @@ escape was discovered.
 
 =item Invalid hexadecimal number in \N{U+...}
 
+=item Invalid hexadecimal number in \N{U+...} in regex; marked by <-- HERE in m/%s/
+
 (F) The character constant represented by C<...> is not a valid hexadecimal
 number.  Either it is empty, or you tried to use a character other than
 0 - 9 or A - F, a - f in a hexadecimal number.
@@ -2389,9 +2411,9 @@ character (U+FFFD).
 
 =item invalid option -D%c, use -D'' to see choices
 
-(F) Perl was called with invalid debugger flags.  Call perl with
-the B<-D> option with no flags to see the list of acceptable values.
-See also L<< perlrun/B<-D>I<letters> >>.
+(S debugging) Perl was called with invalid debugger flags.  Call perl
+with the B<-D> option with no flags to see the list of acceptable values.
+See also L<perlrun/B<-D>I<letters>>.
 
 =item Invalid [] range "%s" in regex; marked by <-- HERE in m/%s/
 
@@ -2506,7 +2528,7 @@ an anonymous subroutine, or a reference to a subroutine.
 (W overload) You tried to overload a constant type the overload package is
 unaware of.
 
-=item junk on end of regexp
+=item Junk on end of regexp in regex m/%s/
 
 (P) The regular expression parser is confused.
 
@@ -2597,12 +2619,12 @@ 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.
+(W imprecision) 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
 
@@ -2759,6 +2781,8 @@ immediately after the switch, without intervening spaces.
 
 =item Missing braces on \N{}
 
+=item Missing braces on \N{} in regex; marked by <-- HERE in m/%s/
+
 (F) Wrong syntax of character name literal C<\N{charname}> within
 double-quotish context.  This can also happen when there is a space
 (or comment) between the C<\N> and the C<{> in a regex with the C</x> modifier.
@@ -2801,7 +2825,7 @@ can vary from one line to the next.
 (S syntax) 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
+=item Missing right brace on \%c{} in regex; marked by <-- HERE in m/%s/
 
 (F) Missing right brace in C<\x{...}>, C<\p{...}>, C<\P{...}>, or C<\N{...}>.
 
@@ -2928,14 +2952,14 @@ NOTE: This warning detects symbols that have been used only once so $c, @c,
 the same; if a program uses $c only once but also uses any of the others it
 will not trigger this warning.
 
-=item \N in a character class must be a named character: \N{...}
+=item \N in a character class must be a named character: \N{...} in regex; marked by <-- HERE in m/%s/
 
 (F) The new (5.12) meaning of C<\N> as C<[^\n]> is not valid in a bracketed
 character class, for the same reason that C<.> in a character class loses
 its specialness: it matches almost everything, which is probably not
 what you want.
 
-=item \N{NAME} must be resolved by the lexer
+=item \N{NAME} must be resolved by the lexer in regex; marked by <-- HERE in m/%s/
 
 (F) When compiling a regex pattern, an unresolved named character or
 sequence was encountered.  This can happen in any of several ways that
@@ -3336,14 +3360,14 @@ that isn't open.  Check your control flow.  See also L<perlfunc/-X>.
 
 =item Opening dirhandle %s also as a file
 
-(W io, deprecated) You used open() to associate a filehandle to
+(D io, deprecated) You used open() to associate a filehandle to
 a symbol (glob or scalar) that already holds a dirhandle.
 Although legal, this idiom might render your code confusing
 and is deprecated.
 
 =item Opening filehandle %s also as a directory
 
-(W io, deprecated) You used opendir() to associate a dirhandle to
+(D io, deprecated) You used opendir() to associate a dirhandle to
 a symbol (glob or scalar) that already holds a filehandle.
 Although legal, this idiom might render your code confusing
 and is deprecated.
@@ -3357,7 +3381,7 @@ the C<fallback> overloading key is specified to be true.  See L<overload>.
 
 =item Operation "%s" returns its argument for non-Unicode code point 0x%X
 
-(W utf8, non_unicode) You performed an operation requiring Unicode
+(S utf8, non_unicode) 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.
 
@@ -3369,7 +3393,7 @@ C<no warnings 'non_unicode';>.
 
 =item Operation "%s" returns its argument for UTF-16 surrogate U+%X
 
-(W utf8, surrogate) You performed an operation requiring Unicode
+(S utf8, surrogate) 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
@@ -3787,7 +3811,7 @@ C<sh>-shell in.  See "PERL_SH_DIR" in L<perlos2>.
 
 =item PERL_SIGNALS illegal: "%s"
 
-See L<perlrun/PERL_SIGNALS> for legal values.
+(X) See L<perlrun/PERL_SIGNALS> for legal values.
 
 =item Perls since %s too modern--this is %s, stopped
 
@@ -4131,7 +4155,7 @@ to use parens.  In any case, a hash requires key/value B<pairs>.
 (W misc) You have attempted to weaken a reference that is already weak.
 Doing so has no effect.
 
-=item Reference to invalid group 0
+=item Reference to invalid group 0 in regex; marked by <-- HERE in m/%s/
 
 (F) You used C<\g0> or similar in a regular expression.  You may refer
 to capturing parentheses only with strictly positive integers
@@ -4179,10 +4203,10 @@ expression compiler gave it.
 (F syntax, regexp) The regular expression pattern had too many occurrences
 of the specified modifier.  Remove the extraneous ones.
 
-=item Regexp modifier "%c" may not appear after the "-"
+=item Regexp modifier "%c" may not appear after the "-" in regex; marked by <-- HERE in m/%s/
 
-(F regexp) Turning off the given modifier has the side effect of turning
-on another one.  Perl currently doesn't allow this.  Reword the regular
+(F) Turning off the given modifier has the side effect of turning on
+another one.  Perl currently doesn't allow this.  Reword the regular
 expression to use the modifier you want to turn on (and place it before
 the minus), instead of the one you want to turn off.
 
@@ -4192,7 +4216,7 @@ the minus), instead of the one you want to turn off.
 mutually exclusive modifiers.  Retain only the modifier that is
 supposed to be there.
 
-=item Regexp out of space
+=item Regexp out of space in regex m/%s/
 
 (P) A "can't happen" error, because safemalloc() should have caught it
 earlier.
@@ -4221,10 +4245,11 @@ really a dirhandle.  Check your control flow.
 
 =item Scalars leaked: %d
 
-(P) Something went wrong in Perl's internal bookkeeping of scalars:
-not all scalar variables were deallocated by the time Perl exited.
-What this usually indicates is a memory leak, which is of course bad,
-especially if the Perl program is intended to be long-running.
+(W internal) Something went wrong in Perl's internal bookkeeping
+of scalars: not all scalar variables were deallocated by the time
+Perl exited.  What this usually indicates is a memory leak, which
+is of course bad, especially if the Perl program is intended to be
+long-running.
 
 =item Scalar value @%s[%s] better written as $%s[%s]
 
@@ -4341,11 +4366,10 @@ causes, see L<perlre>.
 (F) The regular expression expects a mandatory argument following the escape
 sequence and this has been omitted or incorrectly written.
 
-=item Sequence (?#... not terminated in regex; marked by <-- HERE in m/%s/
+=item Sequence (?#... not terminated in regex m/%s/
 
 (F) A regular expression comment must be terminated by a closing
-parenthesis.  Embedded parentheses aren't allowed.  The <-- HERE shows in
-the regular expression about where the problem was discovered.  See
+parenthesis.  Embedded parentheses aren't allowed.  See
 L<perlre>.
 
 =item Sequence (?{...}) not terminated with ')'
@@ -4836,17 +4860,17 @@ use it to restrict permissions for yourself (EXPR & 0700).
 
 =item Unbalanced context: %d more PUSHes than POPs
 
-(W internal) The exit code detected an internal inconsistency in how
+(S internal) The exit code detected an internal inconsistency in how
 many execution contexts were entered and left.
 
 =item Unbalanced saves: %d more saves than restores
 
-(W internal) The exit code detected an internal inconsistency in how
+(S internal) The exit code detected an internal inconsistency in how
 many values were temporarily localized.
 
 =item Unbalanced scopes: %d more ENTERs than LEAVEs
 
-(W internal) The exit code detected an internal inconsistency in how
+(S internal) The exit code detected an internal inconsistency in how
 many blocks were entered and left.
 
 =item Unbalanced string table refcount: (%d) for "%s"
@@ -4857,7 +4881,7 @@ should have been freed, so this indicates a bug somewhere.
 
 =item Unbalanced tmps: %d more allocs than frees
 
-(W internal) The exit code detected an internal inconsistency in how
+(S internal) The exit code detected an internal inconsistency in how
 many mortal scalars were allocated and freed.
 
 =item Undefined format "%s" called
@@ -4924,7 +4948,7 @@ internal consistency check.  It encountered a malformed op tree.
 
 =item Unicode non-character U+%X is illegal for open interchange
 
-(W utf8, nonchar) Certain codepoints, such as U+FFFE and U+FFFF, are
+(S utf8, nonchar) Certain codepoints, such as U+FFFE and U+FFFF, are
 defined by the Unicode standard to be non-characters.  Those are
 legal codepoints, but are reserved for internal use; so, applications
 shouldn't attempt to exchange them.  If you know what you are doing
@@ -4932,7 +4956,7 @@ you can turn off this warning by C<no warnings 'nonchar';>.
 
 =item Unicode surrogate U+%X is illegal in UTF-8
 
-(W utf8, surrogate) You had a UTF-16 surrogate in a context where they are
+(S utf8, surrogate) You had a UTF-16 surrogate in a context where they are
 not considered acceptable.  These code points, between U+D800 and
 U+DFFF (inclusive), are used by Unicode only for UTF-16.  However, Perl
 internally allows all unsigned integer code points (up to the size limit
@@ -5035,14 +5059,16 @@ 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/
+=item Unmatched [ in regex; marked by <-- HERE in m/%s/
 
 (F) The brackets around a character class must match.  If you wish to
 include a closing bracket in a character class, backslash it or put it
 first.  The <-- HERE shows in the regular expression about where the
 problem was discovered.  See L<perlre>.
 
-=item unmatched ( in regex; marked by <-- HERE in m/%s/
+=item Unmatched ( in regex; marked by <-- HERE in m/%s/
+
+=item Unmatched ) in regex; marked by <-- HERE in m/%s/
 
 (F) Unbackslashed parentheses must always be balanced in regular
 expressions.  If you're a vi user, the % key is valuable for finding
@@ -5528,7 +5554,7 @@ modified string is usually not particularly useful.)
 
 =item UTF-16 surrogate U+%X
 
-(W utf8, surrogate) You had a UTF-16 surrogate in a context where they are
+(S utf8, surrogate) You had a UTF-16 surrogate in a context where they are
 not considered acceptable.  These code points, between U+D800 and
 U+DFFF (inclusive), are used by Unicode only for UTF-16.  However, Perl
 internally allows all unsigned integer code points (up to the size limit
@@ -5585,13 +5611,13 @@ executed, so its $a is not available for capture.
 
 =item Variable "%s" is not imported%s
 
-(W misc) With "use strict" in effect, you referred to a global variable
+(S misc) With "use strict" in effect, you referred to a global variable
 that you apparently thought was imported from another module, because
 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 length lookbehind not implemented in m/%s/
+=item Variable length lookbehind not implemented in regex m/%s/
 
 (F) Lookbehind is allowed only for subexpressions whose length is fixed and
 known at compile time.  See L<perlre>.