Permalink
Browse files

Fixed the closure argument passing bug perl#72068

  • Loading branch information...
1 parent 9477eed commit 2840580b05a689f0d851c914298fb6b871e4dcb6 @timbunce committed Jan 14, 2010
Showing with 5 additions and 1 deletion.
  1. +5 −1 Safe.pm
View
@@ -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)
+ };
}
}

0 comments on commit 2840580

Please sign in to comment.