On Thu, Mar 04, 2010 at 02:17:09PM -0500, Sir Robert Burbridge wrote:
> Hi all,
> 
> I've been searching around for a few hours, but can't find an answer to
> this.  Perhaps someone here can help a lowly Moose calf =)
> 
> If I have a class defined this way:
> 
> package My::Object;
> use Moose;
> 
> sub method_a {
>    ...
> }
> 
> sub method_b :attribute_a :attribute_b {
>    ...
> }
> 
> 1;
> 
> 
> How can I get a list of methods available, and a list of the attributes of
> each method?
> 
> I've been searching for things like "perl moose method introspection" and
> such, but can't find what I'm looking for.  I did find get_attribute_map and
> get_attribute_list from Class::MOP, but also found that
> 
> 1)  It's deprecated =)
> 2)  It doesn't do what I wanted.

Yes, those are for Moose attributes (has foo => (...)). To introspect
methods, you want get_all_methods, and if you want to be able to see sub
attributes with this, you want MooseX::MethodAttributes.

-doy

Reply via email to