NAME
Class::Component - pluggable component framework
SYNOPSIS
base class
package MyClass;
use strict;
use warnings;
use Class::Component;
__PACKAGE__->load_component(qw/ Autocall /);
__PACKAGE__->load_plugins(qw/ Default /);
application code
use strict;
use warnings;
use MyClass;
my $obj = MyClass->new({ load_plugins => [qw/ Hello /] });
$obj->hello;
$obj->run_hook( hello => $args );
DESCRIPTION
Class::Component is pluggable component framework. The compatibilities such as dump and load such as YAML are good.
METHODS
- new
-
constructor
- load_components
-
__PACKAGE__->load_components(qw/ Sample /);
The candidate is the order of MyClass::Component::Sample and Class::Component::Sample. It is used to remove + when there is + in the head.
- load_plugins
-
__PACKAGE__->load_plugins(qw/ Default /);
The candidate is the MyClass::Plugin::Default. It is used to remove + when there is + in the head.
- register_method
-
$obj->register_method( 'method name' => 'MyClass::Plugin::PluginName' );
Method attribute is usually used and set. See Also Class::Component::Plugin.
- register_hook
-
$obj->register_hook( 'hook name' => { plugin => 'MyClass::Plugin::PluginName', method => 'hook method name' } );
Hook attribute is usually used and set. See Also Class::Component::Plugin.
- remove_method
-
$obj->remove_method( 'method name' => 'MyClass::Plugin::PluginName' );
- remove_hook
-
$obj->remove_hook( 'hook name' => { plugin => 'MyClass::Plugin::PluginName', method => 'hook method name' } );
- call
-
$obj->call('plugin method name' => $args)
- run_hook
-
$obj->run_hook('hook name' => $args)
PROPERTIES
- class_component_config
- class_component_components
- class_component_plugins
- class_component_methods
- class_component_hooks
METHODS for COMPONENT
- NEXT
-
$self->NEXT('methods name', @args);
It is behavior near maybe::next::method of Class::C3.
- class_component_reinitialize
INTERFACES
- load_component_resolver
- load_plugin_resolver
INITIALIZE OPTIONS
- reload_plugin
-
use Class::Component reload_plugin => 1;
or
MyClass->class_component_reinitialize( reload_plugin => 1 );
Plugin/Component of the object made with YAML::Load etc. is done and require is done automatically.
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.