NAME
CCCP::AttributeInspector - show list methods and attributes from package
SYNOPSIS
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' => ''
DESCRIPTION
Attributes is a perfect technology for defined context on your methods. This is be very comfortable for implementation any dispatcher or logic controller.
METHODS
all_methods
Return all methods from package (except any base-package methods).
Return array or array reference depend on call-context.
att_methods($param)
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 array or array reference depend on call-context.
get_attributes($name_method)
Return hash freference with attributes and their value.
packages
Return list package name who have CCCP::AttributeInspector as base class.
AUTHOR
Ivan Sivirinov
COPYRIGHT AND LICENSE
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.