CCCP::AttributeInspector - show list methods and attributes from package
package Bar; use base qw[CCCP::AttributeInspector]; sub new {} sub bar_method1 :Chain :CustomBar('any_custom') {} sub bar_method2 :CustomBar :AbsPath('/some/abs/path') {} 1; # ------------------ package Foo; use base qw[CCCP::AttributeInspector]; sub new {} sub foo_method1 :Local :Custom('any_custom') {} sub foo_method2 :Private :Custom('some_attribute') {} 1; # ------------------ package SomeDispatcher; use Foo; use Bar; my @methods = Foo->all_methods(); # 'foo_method1' # 'foo_method2' # 'new' @methods = Foo->att_methods(); # 'foo_method1' # 'foo_method2' @methods = Bar->all_methods() # 'bar_method2' # 'bar_method1' # 'new' @methods = Bar->att_methods() # 'bar_method2' # 'bar_method1' @methods = Bar->att_methods(['Chain','CustomBar']) # 'bar_method1' @methods = Bar->att_methods(['CustomBar']) # 'bar_method2' # 'bar_method1' @methods = Bar->att_methods({'AbsPath' => '/some/abs/path'}) # 'bar_method2' my $att_list = Bar->get_attributes('bar_method2') # HASH(0xf126f0) # 'AbsPath' => '/some/abs/path' # 'CustomBar' => ''
Attributes is a perfect technology for defined context on your methods. This is be very comfortable for implementation any dispatcher or logic controller.
Return all methods from package (except any base-package methods).
Return array or array reference depend on call-context.
If $param is false (or not defined), method return all name methods who have any attributes. If $param is array reference with list attributes name, method return all name methods who have this attributes. If $param is hash reference with attributes name and attributes value, method return all name methods who have such attributes.
Return hash freference with attributes and their value.
Return list package name who have CCCP::AttributeInspector as base class.
Ivan Sivirinov
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8 or, at your option, any later version of Perl 5 you may have available.
To install CCCP::AttributeInspector, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CCCP::AttributeInspector
CPAN shell
perl -MCPAN -e shell install CCCP::AttributeInspector
For more information on module installation, please visit the detailed CPAN module installation guide.