Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: getting a list of all subclasses of base class x

by stvn (Monsignor)
on Jul 08, 2008 at 18:26 UTC ( [id://696278]=note: print w/replies, xml ) Need Help??


in reply to getting a list of all subclasses of base class x

This should work

my @subclasses = Class::MOP::Class->initialize('x')->subclasses;

-stvn

Replies are listed 'Best First'.
Re^2: getting a list of all subclasses of base class x
by Tanktalus (Canon) on Jul 08, 2008 at 20:36 UTC

      hehe - you're right, that should be:

      BEGIN { my @subclasses = Class::MOP::Class->initialize('x')->subclasses }
      ... much better now.

      -stvn
        Still not perfect: @subclasses lives inside the BEGIN block only :)
        my @subclasses; BEGIN { @subclasses = Class::MOP::Class->initialize('x')->subclasses }

        perl -ple'$_=reverse' <<<ti.xittelop@oivalf

        Io ho capito... ma tu che hai detto?
Re^2: getting a list of all subclasses of base class x
by hexcoder (Curate) on Jul 08, 2008 at 19:55 UTC
    Thanks very much!
    ++

    it did work and it is very elegant!

    If you are interested, I am working on a policy for perlcritic to detect cut-and-paste regions (thats is repitition of code fragments). The full class names of the token types of PPI are too long to store, so I map them to small numbers.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2024-04-26 09:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found