This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
toke.c: 'No package name allowed for variable %s in "our"' cleanup.
authorBrian Fraser <fraserbn@gmail.com>
Sat, 6 Aug 2011 09:35:22 +0000 (10:35 +0100)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 23 Mar 2012 03:23:54 +0000 (20:23 -0700)
t/uni/parser.t
toke.c

index a3e3477..6530b66 100644 (file)
@@ -7,7 +7,7 @@ BEGIN {
     require './test.pl';
 }
 
-plan (tests => 41);
+plan (tests => 42);
 
 use utf8;
 use open qw( :utf8 :std );
@@ -116,4 +116,10 @@ is ${"main::\345\225\217"}, undef, "..and using the encoded form doesn't";
         eval "$_ Foo $x = 1;";
         like $@, qr/No such class Foo/u, "'No such class' warning for $_ is UTF-8 clean";
     }
-}
\ No newline at end of file
+}
+
+{
+    local $@;
+    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";
+}
diff --git a/toke.c b/toke.c
index 2fb0a56..aee009e 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -8472,9 +8472,9 @@ S_pending_ident(pTHX)
     if (PL_in_my) {
         if (PL_in_my == KEY_our) {     /* "our" is merely analogous to "my" */
             if (has_colon)
-                yyerror(Perl_form(aTHX_ "No package name allowed for "
+                yyerror_pv(Perl_form(aTHX_ "No package name allowed for "
                                   "variable %s in \"our\"",
-                                  PL_tokenbuf));
+                                  PL_tokenbuf), UTF ? SVf_UTF8 : 0);
             tmp = allocmy(PL_tokenbuf, tokenbuf_len, UTF ? SVf_UTF8 : 0);
         }
         else {