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.