I don't think perl5 does. But Moose adds it. :)
$ cat j.plNeato. :)
package X;
use Moose;
sub dosomething1 {}
sub dosomething2 {}
sub dosomething3 {}
package main;
my $x = X->new();
print join ", ", sort $x->meta->get_all_method_names;
print "\n";
$ perl j.pl
BUILDALL, BUILDARGS, DEMOLISHALL, DESTROY, DOES, does,
dosomething1, dosomething2, dosomething3, dump, meta, new
More info on Moose: http://moose.perl.org
1 comment:
Moose can't do much without the help from perl5:
$ perl -le'sub foo{};sub bar{};print for grep { *{${main::}{$_}}{CODE} } keys %{main::}'
...and you would have to traverse @ISA recursively to get all_methods. But by any means: use Moose; #!:)
Post a Comment