[perl #120657] Fix require PADTMP when @INC=(sub{},sub{})
It was passing a freed scalar to subsequent subs, breaking
Test::Without::Module:
sub fake_module {
my (undef,$module_file) = @_;
!1
}
unshift @INC, (\&fake_module)x2;
require "${\'whatever'}";
__END__
panic: attempt to copy freed scalar
7fe8d0829820 to
7fe8d082a0f0 at - line 3.
Obviously, doing:
SAVETMPS;
...
nsv = sv_newmortal();
...
FREETMPS; # free all tmps created since SAVETMPS
inside a loop that only assigns to nsv the first time through will
cause nsv to point to a freed scalar on subsequent iterations.
It was stupid of me to make that mistake in commit 9ffd39a to
begin with.
The extra file name SV here will simply have to last until the
require call finishes, something I was trying to avoid by putting it
after SAVETMPS.