NAME
Class::Component::Component::Plaggerize - extend your module like from Plagger component
SYNOPSIS
myapp.pl
config.yaml
plugins:
- module: Test
config: hello
MyApp.pm
package
MyApp;
use
strict;
use
warnings;
use
Class::Component;
__PACKAGE__->load_components(
qw/ Plaggerize /
);
sub
run {
my
$self
=
shift
;
$self
->
log
(
debug
=>
'running start'
);
$self
->run_hook(
'test'
);
}
1;
MyApp/Plugin/Test.pm
package
MyApp::Plugin::Test;
use
strict;
use
warnings;
sub
test : Hook(
'test'
) {
my
(
$self
,
$c
) =
@_
;
$c
->
log
(
debug
=>
'testmethod:'
. Dumper(
$self
->config) );
}
1;
METHODS
- conf
-
Returns a hash that has the application-wide configuration.
- log
-
$self
->
log
(
debug
=>
'debug log'
);
- should_log
SETUP METHODS
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.