summaryrefslogtreecommitdiff
path: root/lib/Symbol.pm
diff options
context:
space:
mode:
authorJohn Hughes <john@AtlanTech.COM>1997-01-30 10:16:21 +1200
committerChip Salzenberg <chip@atlantic.net>1997-02-04 17:47:00 +1200
commit6adf1df6c95069d09f9538d7c0eab6948cc799c9 (patch)
tree2f19c03d7f2c478b6e06a6c5c70bc78a6105105f /lib/Symbol.pm
parent08a4aec0f8cf03ed75a2a45bbd19128b4b70440a (diff)
downloadperl-6adf1df6c95069d09f9538d7c0eab6948cc799c9.tar.gz
In Symbol::gensym, don't make glob fake by copying it
Diffstat (limited to 'lib/Symbol.pm')
-rw-r--r--lib/Symbol.pm10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Symbol.pm b/lib/Symbol.pm
index 75d1dfb1fa..e40ae7b357 100644
--- a/lib/Symbol.pm
+++ b/lib/Symbol.pm
@@ -58,10 +58,16 @@ my $genseq = 0;
my %global = map {$_ => 1} qw(ARGV ARGVOUT ENV INC SIG STDERR STDIN STDOUT);
+#
+# Note that we never _copy_ the glob; we just make a ref to it.
+# If we did copy it, then SVf_FAKE would be set on the copy, and
+# glob-specific behaviors (e.g. C<*$ref = \&func>) wouldn't work.
+#
sub gensym () {
my $name = "GEN" . $genseq++;
- local *{$genpkg . $name};
- \delete ${$genpkg}{$name};
+ my $ref = \*{$genpkg . $name};
+ delete $$genpkg{$name};
+ $ref;
}
sub ungensym ($) {}