version of Perl appears to have been built without this support. Talk
to your Perl administrator.
+=item Illegal character in prototype for %s : %s
+
+(S) 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
=item Malformed prototype for %s: %s
-(F) You declared or 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.
+(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)
use strict;
-print "1..134\n";
+print "1..135\n";
my $i = 1;
print "ok ", $i++, "\n";
}
-# check that obviously bad prototypes are getting rejected
-eval 'sub badproto (@bar) { 1; }';
-print "not " unless $@ =~ /^Malformed prototype for main::badproto : \@bar/;
-print "ok ", $i++, "\n";
-
-eval 'sub badproto2 (bar) { 1; }';
-print "not " unless $@ =~ /^Malformed prototype for main::badproto2 : bar/;
-print "ok ", $i++, "\n";
+# check that obviously bad prototypes are getting warnings
+{
+ my $warn = "";
+ local $SIG{__WARN__} = sub { $warn .= join("",@_) };
+
+ eval 'sub badproto (@bar) { 1; }';
+ print "not " unless $warn =~ /Illegal character in prototype for main::badproto : \@bar/;
+ print "ok ", $i++, "\n";
-eval 'sub badproto3 (&$bar$@) { 1; }';
-print "not " unless $@ =~ /^Malformed prototype for main::badproto3 : &\$bar\$\@/;
-print "ok ", $i++, "\n";
+ eval 'sub badproto2 (bar) { 1; }';
+ print "not " unless $warn =~ /Illegal character in prototype for main::badproto2 : bar/;
+ print "ok ", $i++, "\n";
+
+ eval 'sub badproto3 (&$bar$@) { 1; }';
+ print "not " unless $warn =~ /Illegal character in prototype for main::badproto3 : &\$bar\$\@/;
+ print "ok ", $i++, "\n";
+
+ eval 'sub badproto4 (@ $b ar) { 1; }';
+ print "not " unless $warn =~ /Illegal character in prototype for main::badproto4 : \@\$bar/;
+ print "ok ", $i++, "\n";
+}
-eval 'sub badproto4 (@ $b ar) { 1; }';
-print "not " unless $@ =~ /^Malformed prototype for main::badproto4 : \@\$bar/;
+# make sure whitespace in prototypes works
+eval "sub good (\$\t\$\n\$) { 1; }";
+print "not " if $@;
print "ok ", $i++, "\n";
-
tmp = 0;
bad_proto = FALSE;
for (p = d; *p; ++p) {
- if (!strchr("$@%*;[]&\\ ", *p))
- bad_proto = TRUE;
- if (!isSPACE(*p))
+ if (!isSPACE(*p)) {
d[tmp++] = *p;
+ if (!strchr("$@%*;[]&\\", *p))
+ bad_proto = TRUE;
+ }
}
d[tmp] = '\0';
if (bad_proto)
- Perl_croak(aTHX_ "Malformed prototype for %s : %s",
- SvPVX(PL_subname), d);
+ Perl_warn(aTHX_
+ "Illegal character in prototype for %s : %s",
+ SvPVX(PL_subname), d);
SvCUR(PL_lex_stuff) = tmp;
have_proto = TRUE;