Message-Id: <Pine.LNX.4.33.
0201060023160.3715-200000@localhost.localdomain>
p4raw-id: //depot/perl@14101
the interface was a mistake. Sorry about that. For similar
functionality, see pack('U0', ...) and pack('C0', ...).
+=item *
+
+Earlier Perls treated "sub foo (@bar)" as equivalent to "sub foo (@)".
+The prototypes are now checked at compile-time for invalid characters.
+An optional warning is generated ("Illegal character in prototype...")
+but this may be upgraded to a fatal error in a future release.
+
=back
=head1 Core Enhancements
=item Illegal character in prototype for %s : %s
-(S) An illegal character was found in a prototype declaration. Legal
+(W syntax) An illegal character was found in a prototype declaration. Legal
characters in prototypes are $, @, %, *, ;, [, ], &, and \.
=item Illegal division by zero
module, nor make it harder to read. The line noise is visually
encapsulated into a small pill that's easy to swallow.
+If you try to use an alphanumeric sequence in a prototype you will
+generate an optional warning - "Illegal character in prototype...".
+Unfortunately earlier versions of Perl allowed the prototype to be
+used as long as its prefix was a valid prototype. The warning may be
+upgraded to a fatal error in a future version of Perl once the
+majority of offending code is fixed.
+
It's probably best to prototype new functions, not retrofit prototyping
into older ones. That's because you must be especially careful about
silent impositions of differing list versus scalar contexts. For example,
# check that obviously bad prototypes are getting warnings
{
+ use warnings 'syntax';
my $warn = "";
local $SIG{__WARN__} = sub { $warn .= join("",@_) };
}
}
d[tmp] = '\0';
- if (bad_proto)
- Perl_warn(aTHX_
- "Illegal character in prototype for %s : %s",
- SvPVX(PL_subname), d);
+ if (bad_proto && ckWARN(WARN_SYNTAX))
+ Perl_warner(aTHX_ WARN_SYNTAX,
+ "Illegal character in prototype for %s : %s",
+ SvPVX(PL_subname), d);
SvCUR(PL_lex_stuff) = tmp;
have_proto = TRUE;