From 04680144c43db3714671c554db48c5c4a8096517 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Mon, 28 Aug 2017 12:40:58 -0700 Subject: Set PL_curstname in pp_ctl.c:doeval MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- pp_ctl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'pp_ctl.c') diff --git a/pp_ctl.c b/pp_ctl.c index 1ef7fb463d..611dee49a7 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -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); -- cgit v1.2.1