Message-ID: <Pine.LNX.4.33.
0112301948270.9102-200000@localhost.localdomain>
p4raw-id: //depot/perl@13971
appear if components are not found, or are too long. See
"PERLLIB_PREFIX" in L<perlos2>.
+=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.
+
=item Malformed UTF-8 character (%s)
Perl detected something that didn't comply with UTF-8 encoding rules.
use strict;
-print "1..130\n";
+print "1..133\n";
my $i = 1;
print "not " unless myref(*myglob) =~ /^GLOB\(/;
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";
+
+eval 'sub badproto3 (&$bar$@) { 1; }';
+print "not " unless $@ =~ /^Malformed prototype for main::badproto3 : &\$bar\$\@/;
+print "ok ", $i++, "\n";
+
s = scan_str(s,FALSE,FALSE);
if (!s)
Perl_croak(aTHX_ "Prototype not terminated");
- /* strip spaces */
+ /* strip spaces and check for bad characters */
d = SvPVX(PL_lex_stuff);
tmp = 0;
for (p = d; *p; ++p) {
+ if (!strchr("$@%*;[]&\\ ", *p))
+ Perl_croak(aTHX_ "Malformed prototype for %s : %s",
+ SvPVX(PL_subname), d);
if (!isSPACE(*p))
d[tmp++] = *p;
}