Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Finding classes which are inherited from a given classby fergal (Chaplain) |
on Aug 06, 2004 at 09:15 UTC ( [id://380479]=note: print w/replies, xml ) | Need Help?? |
The hard way is to look inside %:: (or %main:: if you prefer) for keys ending in ::. Let's say that the only package that has been loaded is A::B::C. Look inside %main:: and you will see a variety of things, including a key "A::". This tells you that something has been loaded into the package A. Next you should look at @A::ISA to see if A inherits from your class. Then you look inside %A:: and you will find a key "B::", again check @A::B::ISA, finally you look inside %A::B:: and you will find a key "C::" so check @A::B::C::ISA. When you look inside %A::B::C:: you don't find any keys ending in :: so you're done.
Code would look a little like The easy way is to use a module to help with this, I thought there was one but I can't find it! Update: as an aumsement, here's a version that doesn't use recursion
In Section
Seekers of Perl Wisdom
|
|