summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2009-08-17 00:31:45 +0100
committerDavid Mitchell <davem@iabyn.com>2009-08-17 00:31:45 +0100
commita930c511fcc6cf6f5ef849a9a4a028ff1cd6e27a (patch)
tree35800756dd0a00941864188edf78e9de71c40273
parent5115136b5ada1a3245a69b04d93664e445e85eb1 (diff)
downloadperl-a930c511fcc6cf6f5ef849a9a4a028ff1cd6e27a.tar.gz
[perl #68530] "version::CLASS" warning in Safe.pm
If any of the std variables being aliased into the Safe::rootN package don't actually exist, and if they are not one of the special "don't warn" variables, then you can get an 'only used once' warning. So lets not. (Also bumps version number).
-rw-r--r--ext/Safe/Safe.pm6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/Safe/Safe.pm b/ext/Safe/Safe.pm
index 9d3d589a2d..b27c047853 100644
--- a/ext/Safe/Safe.pm
+++ b/ext/Safe/Safe.pm
@@ -3,7 +3,7 @@ package Safe;
use 5.003_11;
use strict;
-$Safe::VERSION = "2.17";
+$Safe::VERSION = "2.17_01";
# *** Don't declare any lexicals above this point ***
#
@@ -243,13 +243,15 @@ sub share_from {
my ($var, $type);
$type = $1 if ($var = $arg) =~ s/^(\W)//;
# warn "share_from $pkg $type $var";
- *{$root."::$var"} = (!$type) ? \&{$pkg."::$var"}
+ for (1..2) { # assign twice to avoid any 'used once' warnings
+ *{$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));
+ }
}
$obj->share_record($pkg, $vars) unless $no_record or !$vars;
}