MooseX::amine - Examine Yr Moose
version 0.4
my $mex = MooseX::amine->new( 'MooseX::amine' ); my $data = $mex->examine; my $attributes = $data->{attributes}; my $methods = $data->{methods};
# these two are the same my $mex = MooseX::amine->new( 'Module' ); my $mex = MooseX::amine->new({ module => 'Module' }); # or you can go from the path to the file my $mex = MooseX::amine->new({ path = 'path/to/Module.pm' }); # there are a number of options that all pretty much do what they say. # they all default to off my $mex = MooseX::amine->new({ module => 'Module' , include_accessors_in_method_list => 1, include_moose_in_isa => 1, include_private_attributes => 1, include_private_methods => 1, include_standard_methods => 1, });
my $mex = MooseX::amine( 'Module' ); my $data = $mex->examine();
Returns a multi-level hash-based data structure, with two top-level keys, attributes and methods. attributes points to a hash where the keys are attribute names and the values are data structures that describe the attributes. Similarly, methods points to a hash where the keys are method names and the values are data structures describing the method.
attributes
methods
A sample attribute entry:
simple_attribute => { accessor => 'simple_attribute', from => 'Module', meta => { constraint => 'Str' } }
The prescence of an accessor key indicates that this attribute was defined with is = 'rw'>. A read-only attribute will have a reader key. A writer key may also be present if a specific writer method was given when creating the attribute.
accessor
is =
reader
writer
Depending on the options given when creating the attribute there may be various other options present under the meta key.
meta
A sample method entry:
simple_method => { code => 'sub simple_method { return \'simple\' }', from => 'Module' }
The code key will contain the actual code from the method, extracted with PPI. Depending on where the method code actually lives, this key may or may not be present.
code
John SJ Anderson <genehack@genehack.org>
This software is copyright (c) 2014 by John SJ Anderson.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install MooseX::amine, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MooseX::amine
CPAN shell
perl -MCPAN -e shell install MooseX::amine
For more information on module installation, please visit the detailed CPAN module installation guide.