for my $ret (@ret) { # edit (via alias) any CODE refs
next unless (reftype($ret)||'') eq 'CODE';
my $sub = $ret; # avoid closure problems
- $ret = sub { Opcode::_safe_call_sv($root, $obj->{Mask}, $sub) };
+ $ret = sub {
+ my @args = @_; # lexical to close over
+ my $sub_with_args = sub { $sub->(@args) };
+ return Opcode::_safe_call_sv($root, $obj->{Mask}, $sub_with_args)
+ };
}
}