From 58576270560ee142457377108b60beef6009e7cc Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Sat, 6 Aug 2011 10:50:34 +0100 Subject: toke.c: '"(my|state)" variable %s can't be in a package' cleanup. --- t/uni/parser.t | 11 ++++++++++- toke.c | 5 +++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/t/uni/parser.t b/t/uni/parser.t index 6530b66cc3..e67871e944 100644 --- a/t/uni/parser.t +++ b/t/uni/parser.t @@ -7,7 +7,7 @@ BEGIN { require './test.pl'; } -plan (tests => 42); +plan (tests => 44); use utf8; use open qw( :utf8 :std ); @@ -123,3 +123,12 @@ is ${"main::\345\225\217"}, undef, "..and using the encoded form doesn't"; eval "our \$main::\x{30cb};"; like $@, qr!No package name allowed for variable \$main::\x{30cb} in "our"!, "'No such package name allowed for variable' is UTF-8 clean"; } + +{ + use feature 'state'; + local $@; + for ( qw( my state ) ) { + eval "$_ \$::\x{30cb};"; + like $@, qr!"$_" variable \$::\x{30cb} can't be in a package!, qq!'"$_" variable %s can't be in a package' is UTF-8 clean!; + } +} diff --git a/toke.c b/toke.c index aee009e425..9b74b3cc7c 100644 --- a/toke.c +++ b/toke.c @@ -8479,8 +8479,9 @@ S_pending_ident(pTHX) } else { if (has_colon) - yyerror(Perl_form(aTHX_ PL_no_myglob, - PL_in_my == KEY_my ? "my" : "state", PL_tokenbuf)); + yyerror_pv(Perl_form(aTHX_ PL_no_myglob, + PL_in_my == KEY_my ? "my" : "state", PL_tokenbuf), + UTF ? SVf_UTF8 : 0); pl_yylval.opval = newOP(OP_PADANY, 0); pl_yylval.opval->op_targ = allocmy(PL_tokenbuf, tokenbuf_len, -- cgit v1.2.1