diff options
author | Father Chrysostomos <sprout@cpan.org> | 2017-08-28 12:40:58 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2017-10-08 12:04:23 -0700 |
commit | 04680144c43db3714671c554db48c5c4a8096517 (patch) | |
tree | 1fab2c6f12e6c9522badc785d0f2361f913ae962 /pp_ctl.c | |
parent | e04fc1aa1cb8f08ee6e04f5c80e645cad2b3c75a (diff) | |
download | perl-04680144c43db3714671c554db48c5c4a8096517.tar.gz |
Set PL_curstname in pp_ctl.c:doeval
Otherwise we get the wrong name in sub error and warning messages:
$ ./miniperl -we 'package bar { sub bar { eval q"sub foo ([)" } } bar::bar'
Missing ']' in prototype for main::foo : [ at (eval 1) line 1.
(PL_curstname is probably used for other things too. I didn’t check.)
I can arbitrarily set the package name in the warning to what-
ever I want:
$ ./miniperl -we 'package bar { sub bar { eval q"sub foo ([)" } } package fwipm; BEGIN { bar::bar }'
Missing ']' in prototype for fwipm::foo : [ at (eval 1) line 1.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -3372,7 +3372,11 @@ S_doeval_compile(pTHX_ U8 gimme, CV* outside, U32 seq, HV *hh) SAVEGENERICSV(PL_curstash); PL_curstash = (HV *)CopSTASH(PL_curcop); if (SvTYPE(PL_curstash) != SVt_PVHV) PL_curstash = NULL; - else SvREFCNT_inc_simple_void(PL_curstash); + else { + SvREFCNT_inc_simple_void(PL_curstash); + save_item(PL_curstname); + sv_sethek(PL_curstname, HvNAME_HEK(PL_curstash)); + } } /* XXX:ajgo do we really need to alloc an AV for begin/checkunit */ SAVESPTR(PL_beginav); |