summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-09-08 21:47:24 +0000
committerNicholas Clark <nick@ccl4.org>2007-09-08 21:47:24 +0000
commitaab6a793686b4f073e16b436e1705cd0e9106ced (patch)
tree8061e6895affc03639247f7b47fefdb10fc1acb3 /op.c
parent30c282f60070382cf04eda8175abc90062779e80 (diff)
downloadperl-aab6a793686b4f073e16b436e1705cd0e9106ced.tar.gz
Make 'state $$' etc report 'Can't use global $$ in "state"' (not "my")
p4raw-id: //depot/perl@31823
Diffstat (limited to 'op.c')
-rw-r--r--op.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/op.c b/op.c
index 4cbb5e6a3d..6975d83824 100644
--- a/op.c
+++ b/op.c
@@ -363,10 +363,12 @@ Perl_allocmy(pTHX_ const char *const name)
{
/* 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"));
}
}