summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Fraser <fraserbn@gmail.com>2012-03-23 17:42:55 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-03-25 13:43:59 -0700
commit97eb901d2f2a70940d8b0cfa133eb3cdfee12f30 (patch)
treea5a5613f812e7d70575733c064ec7f989446ea15
parent71aa9713eee83e4bb0c1dfcbeb7172791c56d4c0 (diff)
downloadperl-97eb901d2f2a70940d8b0cfa133eb3cdfee12f30.tar.gz
toke.c: "Illegal character in prototype" for Latin-1 protos
-rw-r--r--t/lib/warnings/op20
-rw-r--r--toke.c10
2 files changed, 24 insertions, 6 deletions
diff --git a/t/lib/warnings/op b/t/lib/warnings/op
index f2270dc01a..de74d2e360 100644
--- a/t/lib/warnings/op
+++ b/t/lib/warnings/op
@@ -857,7 +857,7 @@ use open qw( :utf8 :std );
use warnings;
eval "sub fòò (\$\0) {}";
EXPECT
-Illegal character in prototype for main::fòò : $\x{0} at (eval 1) line 1.
+Illegal character in prototype for main::fòò : $\0 at (eval 1) line 1.
########
# op.c
use utf8;
@@ -865,7 +865,7 @@ use open qw( :utf8 :std );
use warnings;
eval "sub foo (\0) {}";
EXPECT
-Illegal character in prototype for main::foo : \x{0} at (eval 1) line 1.
+Illegal character in prototype for main::foo : \0 at (eval 1) line 1.
########
# op.c
use utf8;
@@ -882,7 +882,21 @@ use open qw( :utf8 :std );
use warnings;
BEGIN { eval "sub foo (\0) {}"; }
EXPECT
-Illegal character in prototype for main::foo : \x{0} at (eval 1) line 1.
+Illegal character in prototype for main::foo : \0 at (eval 1) line 1.
+########
+# op.c
+use warnings;
+eval "sub foo (\xAB) {}";
+EXPECT
+Illegal character in prototype for main::foo : \x{ab} at (eval 1) line 1.
+########
+# op.c
+use utf8;
+use open qw( :utf8 :std );
+use warnings;
+BEGIN { eval "sub foo (\x{30cb}) {}"; }
+EXPECT
+Illegal character in prototype for main::foo : \x{30cb} at (eval 1) line 1.
########
# op.c
use utf8;
diff --git a/toke.c b/toke.c
index 5cfcc6788d..1d7a44fcf0 100644
--- a/toke.c
+++ b/toke.c
@@ -8231,9 +8231,13 @@ Perl_yylex(pTHX)
"Illegal character %sin prototype for %"SVf" : %s",
seen_underscore ? "after '_' " : "",
SVfARG(PL_subname),
- sv_uni_display(dsv,
- newSVpvn_flags(d, tmp, SVs_TEMP | SvUTF8(PL_lex_stuff)),
- tmp, UNI_DISPLAY_ISPRINT));
+ SvUTF8(PL_lex_stuff)
+ ? sv_uni_display(dsv,
+ newSVpvn_flags(d, tmp, SVs_TEMP | SVf_UTF8),
+ tmp,
+ UNI_DISPLAY_ISPRINT)
+ : pv_pretty(dsv, d, tmp, 60, NULL, NULL,
+ PERL_PV_ESCAPE_NONASCII));
}
SvCUR_set(PL_lex_stuff, tmp);
have_proto = TRUE;