From: Perl 5 Porters Date: Thu, 11 Jan 1996 21:52:33 +0000 (+0000) Subject: Patch from Andreas. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8bb1f2cfb8a0127ff8e096c9c76a07311bd74c13;p=p5sagit%2Fp5-mst-13.2.git Patch from Andreas. --- diff --git a/ext/Safe/Safe.pm b/ext/Safe/Safe.pm index dc2f9e9..5014b38 100644 --- a/ext/Safe/Safe.pm +++ b/ext/Safe/Safe.pm @@ -257,13 +257,15 @@ my $safes = "1111111111111111111111101111111111111111111111111111111111111111" . "0000000000000111110000001111111110100000000000001111111111111111" . "11111111111111111110"; -my $default_root = 'Safe::Root000000000'; +my $default_root = 'Root000000000'; + +my $default_mask; sub new { my($class, $root, $mask) = @_; my $obj = {}; bless $obj, $class; - $obj->root(defined($root) ? $root : $default_root++); + $obj->root(defined($root) ? $root : ("Safe::".$default_root++)); $obj->mask(defined($mask) ? $mask : $default_mask); # We must share $_ and @_ with the compartment or else ops such # as split, length and so on won't default to $_ properly, nor @@ -275,6 +277,15 @@ sub new { return $obj; } +sub DESTROY { + my($obj) = @_; + my $root = $obj->root(); + if ($root =~ /^Safe::(Root\d+)$/){ + $root = $1; + delete $ {"Safe::"}{"$root\::"}; + } +} + sub root { my $obj = shift; if (@_) {