[ID 20000710.002] fatal error or memory loss when deleting symbols in evaled code...
Karsten Sperling [Mon, 10 Jul 2000 15:12:52 +0000 (17:12 +0200)]
To: perl5-porters@perl.org
Message-Id: <200007101315.e6ADFrg21041@chthon.perl.com>

p4raw-id: //depot/cfgperl@6342

lib/Symbol.pm

index a842c1c..a95383a 100644 (file)
@@ -129,8 +129,15 @@ sub delete_package ($) {
     my $stem_symtab = *{$stem}{HASH};
     return unless defined $stem_symtab and exists $stem_symtab->{$leaf};
 
-    my $leaf_glob   = $stem_symtab->{$leaf};
-    my $leaf_symtab = *{$leaf_glob}{HASH};
+
+    # free all the symbols in the package
+
+    my $leaf_symtab = *{$stem_symtab->{$leaf}}{HASH};
+    foreach my $name (keys %$leaf_symtab) {
+        undef *{$pkg . $name};
+    }
+
+    # delete the symbol table
 
     %$leaf_symtab = ();
     delete $stem_symtab->{$leaf};