|
NAMEClass::Component::Plugin - plugin base for pluggable component frameworkSYNOPSISYour 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
ATTRIBUTES
AUTHORKazuhiro Osawa <ko@yappo.ne.jp>SEE ALSOClass::ComponentLICENSEThis library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Visit the GSP FreeBSD Man Page Interface. |