NAME
Class::Component::Plugin - plugin base for pluggable component framework
SYNOPSIS
Your plugins should succeed to Class::Component::Plugin by your name space, and use it.
package MyClass::Plugin;
use strict;
use warnings;
use base 'Class::Component::Plugin';
1;
for instance, the init phase is rewritten.
package MyClass::Plugin;
use strict;
use warnings;
use base 'Class::Component::Plugin';
__PACKAGE__->mk_accessors(qw/ base_config /);
sub init {
my($self, $c) = @_;
$self->base_config($self->config);
$self->config($self->config->{config});
}
1;
package MyClass::Plugin::Hello;
use strict;
use warnings;
use base 'MyClass::Plugin';
sub hello :Method {
my($self, $context, $args) = @_;
'hello'
}
sub hello_hook :Hook('hello') {
my($self, $context, $args) = @_;
'hook hello'
}
can use alias method name
sub foo :Method('bar') {}
$self->call('bar'); # call foo method
default hook name is method name if undefined Hook name
sub defaulthook :Hook {}
$self->run_hook( 'defaulthook' );
HOOK POINTS
- init
-
init phase your plugins
- class_component_plugin_attribute_detect
- class_component_plugin_attribute_detect_cache_enable
-
1 = using attribute detect cache 0 = not use cache
- class_component_load_attribute_resolver
-
attribute name space detector
ATTRIBUTES
- Method
-
register_method is automatically done.
- Hook
-
register_hook is automatically done.
AUTHOR
Kazuhiro Osawa <ko@yappo.ne.jp>
SEE ALSO
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.