I have some auto-generated code which effectively writes out the following in a bunch of different places in some code:
no warnings 'uninitialized';
local %ENV = %ENV;
local $/ = $/;
local @INC = @INC;
local %INC = %INC;
local $_ = $_;
local $| = $|;
local %SIG = %SIG;
use warnings 'uninitialized';
When auto-generating code, some argue that it's not strictly necessary that the code be "beautiful", but I'd like to pull that out into a subroutine. However, that would localize those variables in that subroutine. Is there a way to localize those variables in the calling stack frame?
Update: In a similar vein, it would be nice to be able to run eval in a higher stack frame. I think Python already has this. It would be nice if Perl did, too.