From: Tim Bunce Date: Thu, 14 Jan 2010 14:50:03 +0000 (+0000) Subject: Fixed the closure argument passing bug perl#72068 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ebe5824be753acd9437b38ff9f30083d65211a9b;p=p5sagit%2Fp5-mst-13.2.git Fixed the closure argument passing bug perl#72068 --- diff --git a/dist/Safe/Safe.pm b/dist/Safe/Safe.pm index 476b9fd..41a7d44 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) + }; } }