|Pathologically Eclectic Rubbish Lister|
getting a list of all subclasses of base class xby hexcoder (Chaplain)
|on Jul 08, 2008 at 16:20 UTC||Need Help??|
hexcoder has asked for the
wisdom of the Perl Monks concerning the following question:
I wonder how I can get a list of all loaded subclasses of a given base class x from a foreign module.
I thought this must be a FAQ, but I could find nothing in the FAQs, Conway's book 'Object oriented perl' and the cookbook.
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?
Thanks very much, hexcoder