goto done;
}
else {
- const line_t oldline = CopLINE(PL_curcop);
- if (PL_parser && PL_parser->copline != NOLINE)
+ /* redundant check that avoids creating the extra SV
+ most of the time: */
+ if (const_sv || ckWARN(WARN_REDEFINE)) {
+ const line_t oldline = CopLINE(PL_curcop);
+ SV *noamp = sv_2mortal(newSVpvn_utf8(
+ PadnamePV(name)+1,PadnameLEN(name)-1,
+ PadnameUTF8(name)
+ ));
+ if (PL_parser && PL_parser->copline != NOLINE)
CopLINE_set(PL_curcop, PL_parser->copline);
- report_redefined_cv(name, cv, &const_sv);
- CopLINE_set(PL_curcop, oldline);
+ report_redefined_cv(noamp, cv, &const_sv);
+ CopLINE_set(PL_curcop, oldline);
+ }
#ifdef PERL_MAD
if (!PL_minus_c) /* keep old one around for madskills */
#endif
state $w;
local $SIG{__WARN__} = sub { $w .= shift };
eval "#line 56 pygpyf\nsub redef {}";
-on;
is $w, "Subroutine redef redefined at pygpyf line 56.\n",
"sub redefinition warnings from state subs";
}