projects
/
platform
/
upstream
/
perl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bb92c76
)
Fixed the closure argument passing bug perl#72068
author
Tim Bunce
<Tim.Bunce@pobox.com>
Thu, 14 Jan 2010 14:50:03 +0000
(14:50 +0000)
committer
Rafael Garcia-Suarez
<rgs@consttype.org>
Thu, 14 Jan 2010 21:41:20 +0000
(22:41 +0100)
dist/Safe/Safe.pm
patch
|
blob
|
history
diff --git
a/dist/Safe/Safe.pm
b/dist/Safe/Safe.pm
index
476b9fd
..
41a7d44
100644
(file)
--- 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)
+ };
}
}