perl 5.003_06: lib/Symbol.pm
[p5sagit/p5-mst-13.2.git] / lib / Symbol.pm
index ccc12b6..75d1dfb 100644 (file)
@@ -34,7 +34,7 @@ support anonymous globs, C<Symbol::ungensym> is also provided.
 But it doesn't do anything.
 
 C<Symbol::qualify> turns unqualified symbol names into qualified
-variable names (e.g. "myvar" -> "MyPackage::myvar").  If it is given a
+variable names (e.g. "myvar" -E<gt> "MyPackage::myvar").  If it is given a
 second parameter, C<qualify> uses it as the default package;
 otherwise, it uses the package of its caller.  Regardless, global
 variable names (e.g. "STDOUT", "ENV", "SIG") are always qualfied with
@@ -46,7 +46,7 @@ which are qualified by their nature.
 
 =cut
 
-require 5.002;
+BEGIN { require 5.002; }
 
 require Exporter;
 @ISA = qw(Exporter);
@@ -56,11 +56,7 @@ require Exporter;
 my $genpkg = "Symbol::";
 my $genseq = 0;
 
-my %global;
-while (<DATA>) {
-    chomp;
-    $global{$_} = 1;
-}
+my %global = map {$_ => 1} qw(ARGV ARGVOUT ENV INC SIG STDERR STDIN STDOUT);
 
 sub gensym () {
     my $name = "GEN" . $genseq++;
@@ -72,7 +68,7 @@ sub ungensym ($) {}
 
 sub qualify ($;$) {
     my ($name) = @_;
-    if (! ref($name) && $name !~ /::/) {
+    if (!ref($name) && index($name, '::') == -1 && index($name, "'") == -1) {
        my $pkg;
        # Global names: special character, "^x", or other. 
        if ($name =~ /^([^a-z])|(\^[a-z])$/i || $global{$name}) {
@@ -87,13 +83,3 @@ sub qualify ($;$) {
 }
 
 1;
-
-__DATA__
-ARGV
-ARGVOUT
-ENV
-INC
-SIG
-STDERR
-STDIN
-STDOUT