diff options
author | Perl 5 Porters <perl5-porters.nicoh.com> | 1996-01-11 21:52:33 +0000 |
---|---|---|
committer | Andy Dougherty <doughera.lafayette.edu> | 1996-01-11 21:52:33 +0000 |
commit | 8bb1f2cfb8a0127ff8e096c9c76a07311bd74c13 (patch) | |
tree | 2a34bd9a7f07d30aff33de2d877bc149abb1ecae /ext | |
parent | 851efeba5e0cf9ceaa9b388d9a67fc7bce73ef79 (diff) | |
download | perl-8bb1f2cfb8a0127ff8e096c9c76a07311bd74c13.tar.gz |
Patch from Andreas.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/Safe/Safe.pm | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/ext/Safe/Safe.pm b/ext/Safe/Safe.pm index dc2f9e9f9b..5014b384fc 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 (@_) { |