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:38:48 +0100
commit9de9eeb1452212b331264652386099df5794d4a5 (patch)
tree9ef0b87a932f9cc8981ad5bac69de7c43f497197
parentbac1ae50f815c189d267d9fccb2cb35791975bf7 (diff)
downloadperl-9de9eeb1452212b331264652386099df5794d4a5.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). (cherry picked from commit a930c511fcc6cf6f5ef849a9a4a028ff1cd6e27a)
-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;
}