Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed the closure argument passing bug perl#72068

  • Loading branch information...
commit 2840580b05a689f0d851c914298fb6b871e4dcb6 1 parent 9477eed
@timbunce authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 Safe.pm
View
6 Safe.pm
@@ -306,7 +306,11 @@ sub reval {
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)
+ };
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.