[Pdx-pm] Getting a list of methods that a package responds to

Kyle Dawkins kyle at cepaso.com
Mon Aug 22 14:18:17 PDT 2005


Hi all

Sorry for asking this dopey question, but I am having some weird  
problems surfing the symbol tables of some of my classes, and I can't  
figure out what's going on.

The basic idea is to just get a list of methods that a package  
responds to (including inherited methods).  Basically, when an  
instance of a class is initialised,  I do something like this:


my $package = ref($self);
my %symbolTable = eval("%${package}::");

foreach my $symbol (keys %symbolTable) {
     ...
}

because I am looking for certain methods to "register" for use  
elsewhere.  However, this doesn't work; it kinda works, but it never  
returns a complete list of methods; in fact, it returns *different*  
lists of methods for successive calls.

So... anyone?  I am not too familiar with this part of the guts of perl.

Kyle
Central Park Software
kyle at cepaso.com



More information about the Pdx-pm-list mailing list