Trying to ged rid of Sub::Filter from in-house OOP. The code I am fixing is itself evaluated and my newly created wrapper should report proper sub name, but I have just _ _ ANON _ _
$code_after = _stringify(qq{
BEGIN {
my \$orig = \\&$subname;
my \$orig_attr = attributes::get(\\&$subname);
no warnings 'redefine';
my \$s = sub {\&Sub::Uplevel::uplevel(2, \$orig, \@_);};
*$subname = sub {
\@_ = \&\$s;
return unless defined wantarray;
...
CodePudding user response:
Use Sub::Name
to redefine your anonymous sub name.
use Sub::Name;
*$subname = subname Whatever::Module::your_sub_name => sub {