diff options
author | Tim Bunce <Tim.Bunce@pobox.com> | 2010-01-14 14:50:03 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgs@consttype.org> | 2010-01-14 22:41:20 +0100 |
commit | ebe5824be753acd9437b38ff9f30083d65211a9b (patch) | |
tree | f5fc841d7c1c5b1c1a4223faf8a3ec6357341ed7 /dist/Safe | |
parent | bb92c7667b2747525c85274e2ca8a9996b44c402 (diff) | |
download | perl-ebe5824be753acd9437b38ff9f30083d65211a9b.tar.gz |
Fixed the closure argument passing bug perl#72068
Diffstat (limited to 'dist/Safe')
-rw-r--r-- | dist/Safe/Safe.pm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/dist/Safe/Safe.pm b/dist/Safe/Safe.pm index 476b9fd693..41a7d441a9 100644 --- a/dist/Safe/Safe.pm +++ b/dist/Safe/Safe.pm @@ -308,7 +308,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) + }; } } |