johnnywang has asked for the wisdom of the Perl Monks concerning the following question:
On cywin, the result is (removed some entries to make it shorter):# test.pl use strict; package Foo; sub new{ return bless {}, shift; } sub foo{ my $self = shift; print "Foo called\n"; } package main; # print the full symbol table, notice the Foo:: entry print "$_ => $::{$_}\n" foreach keys %::; print "\n\n"; delete $::{'Foo::'}; # shouldn't this delete the symbol table for Foo? # print again the full symbol table, notice Foo:: is gone. print "$_ => $::{$_}\n" foreach keys %::; print "\n\n"; # seems still there. print "$_ => $Foo::{$_}\n" foreach keys %Foo::; print "\n\n"; # but can't call the following, as expected my $f = new Foo(); $f->foo();
" => *main::" CORE:: => *main::CORE:: strict:: => *main::strict:: $ => *main::$ Foo:: => *main::Foo:: main:: => *main::main:: => *main:: @ => *main::@ <none>:: => *main::<none>:: " => *main::" CORE:: => *main::CORE:: strict:: => *main::strict:: $ => *main::$ main:: => *main::main:: => *main:: @ => *main::@ <none>:: => *main::<none>:: foo => *Foo::foo new => *Foo::new Can't locate object method "new" via package "Foo" (perhaps you forgot + to load " Foo"?) at test.pl line 30.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Directly remove an entry from the symbol table
by tlm (Prior) on May 03, 2005 at 11:41 UTC | |
|
Re: Directly remove an entry from the symbol table
by PodMaster (Abbot) on May 03, 2005 at 06:13 UTC | |
|
Re: Directly remove an entry from the symbol table
by osunderdog (Deacon) on May 03, 2005 at 14:44 UTC |