Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Finding classes which are inherited from a given class

by gmax (Abbot)
on Aug 06, 2004 at 10:32 UTC ( #380487=note: print w/replies, xml ) Need Help??

in reply to Finding classes which are inherited from a given class

There is a tiny module that gives a straight answer. Look for Class::CanBeA

Here is an example of how it works:

#!/usr/bin/perl -w use strict; use Class::CanBeA; package Dummy; sub dummy {}; # not inherited package Foo; sub bar {}; # The ultimate parent package Bar; use base qw(Foo); package DeepBar; use base qw(Bar); package DeeperBar; use base qw(DeepBar); package Pub; use base qw(Foo); package DeepPub; use base qw(Pub); package DeeperPub; use base qw(DeepPub); my @subclasses = @{Class::CanBeA::subclasses('Foo')}; print "@subclasses\n";
DeepBar Bar DeeperPub Pub DeeperBar DeepPub
 _  _ _  _  
(_|| | |(_|><

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://380487]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2020-09-26 20:57 GMT
Find Nodes?
    Voting Booth?
    If at first I donít succeed, I Ö

    Results (142 votes). Check out past polls.