hexcoder has asked for the wisdom of the Perl Monks concerning the following question:
I want this because I want to register all of them at initialization time. Currently I use an ugly hardcoded list. Since my module should be independent of the foreign module, I want to replace the hardcoded list with a dynamically retrieved one. Then all additions/deletions of subclasses would be tracked automatically.
The debugger has a hash %DB::sub containing all subroutines in scope, so in the debugger I could probably use something like
How can I get this list without the debugger module?require 'perl5db.pl'; my $base_class = 'x'; my @subclass_list = grep { $_->isa($base_class) } keys %DB::sub;
Thanks very much, hexcoder
|
|---|