From: Jarkko Hietaniemi Date: Tue, 29 Aug 2000 14:49:59 +0000 (+0000) Subject: Retract #6882, broke the safe tests. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d077c3e501f62036977516febf72a5aa2a07cd91;p=p5sagit%2Fp5-mst-13.2.git Retract #6882, broke the safe tests. p4raw-id: //depot/perl@6888 --- diff --git a/ext/Opcode/Safe.pm b/ext/Opcode/Safe.pm index 21121f5..7e1d6a3 100644 --- a/ext/Opcode/Safe.pm +++ b/ext/Opcode/Safe.pm @@ -167,14 +167,13 @@ sub share_from { my ($var, $type); $type = $1 if ($var = $arg) =~ s/^(\W)//; # warn "share_from $pkg $type $var"; - my $obj_to_share = (!$type) ? \&{$pkg."::$var"} + *{$root."::$var"} = (!$type) ? \&{$pkg."::$var"} : ($type eq '&') ? \&{$pkg."::$var"} : ($type eq '$') ? \${$pkg."::$var"} : ($type eq '@') ? \@{$pkg."::$var"} : ($type eq '%') ? \%{$pkg."::$var"} : ($type eq '*') ? *{$pkg."::$var"} : croak(qq(Can't share "$type$var" of unknown type)); - Opcode::_safe_call_sv($root, $obj->{Mask}, sub { *{$var} = $obj_to_share }); } $obj->share_record($pkg, $vars) unless $no_record or !$vars; } @@ -214,11 +213,11 @@ sub reval { # Create anon sub ref in root of compartment. # Uses a closure (on $expr) to pass in the code to be executed. # (eval on one line to keep line numbers as expected by caller) - my $evalcode = sprintf('package %s; sub { eval $expr; }', $root); + my $evalcode = sprintf('package %s; sub { eval $expr; }', $root); my $evalsub; - if ($strict) { use strict; $evalsub = eval $evalcode; } - else { no strict; $evalsub = eval $evalcode; } + if ($strict) { use strict; $evalsub = eval $evalcode; } + else { no strict; $evalsub = eval $evalcode; } return Opcode::_safe_call_sv($root, $obj->{Mask}, $evalsub); }