Change 31823 by [EMAIL PROTECTED] on 2007/09/08 21:47:24

        Make 'state $$' etc report 'Can't use global $$ in "state"' (not "my")

Affected files ...

... //depot/perl/op.c#952 edit
... //depot/perl/pod/perldiag.pod#481 edit

Differences ...

==== //depot/perl/op.c#952 (text) ====
Index: perl/op.c
--- perl/op.c#951~31805~        2007-09-06 07:57:03.000000000 -0700
+++ perl/op.c   2007-09-08 14:47:24.000000000 -0700
@@ -363,10 +363,12 @@
     {
        /* name[2] is true if strlen(name) > 2  */
        if (!isPRINT(name[1]) || strchr("\t\n\r\f", name[1])) {
-           yyerror(Perl_form(aTHX_ "Can't use global %c^%c%s in \"my\"",
-                             name[0], toCTRL(name[1]), name + 2));
+           yyerror(Perl_form(aTHX_ "Can't use global %c^%c%s in \"%s\"",
+                             name[0], toCTRL(name[1]), name + 2,
+                             PL_parser->in_my == KEY_state ? "state" : "my"));
        } else {
-           yyerror(Perl_form(aTHX_ "Can't use global %s in \"my\"",name));
+           yyerror(Perl_form(aTHX_ "Can't use global %s in \"%s\"",name,
+                             PL_parser->in_my == KEY_state ? "state" : "my"));
        }
     }
 

==== //depot/perl/pod/perldiag.pod#481 (text) ====
Index: perl/pod/perldiag.pod
--- perl/pod/perldiag.pod#480~31822~    2007-09-08 14:21:37.000000000 -0700
+++ perl/pod/perldiag.pod       2007-09-08 14:47:24.000000000 -0700
@@ -1133,7 +1133,7 @@
 (F) Only a simple scalar variable may be used as a loop variable on a
 foreach.
 
-=item Can't use global %s in "my"
+=item Can't use global %s in "%s"
 
 (F) You tried to declare a magical variable as a lexical variable.  This
 is not allowed, because the magic can be tied to only one location
End of Patch.

Reply via email to