in reply to Traversing variables in a namespace
Example code:
Or you could roll your own:my $sym = Devel::Symdump->new('Foo'); my @scalars = $sym->scalars; for my $s (@scalars) { # do something }
my $class = 'Foo'; while (my($key, $val) = each %{"${class}::"}) { local(*ENTRY) = $val; # $key is the name of the symbol table entry, # and *ENTRY is the value--the glob. You can, # for example, look at *ENTRY{CODE} to see # if there's a sub called $key. }
|
|---|