Class::Component::Component::Plaggerize - extend your module like from Plagger component
myapp.pl
#!/usr/bin/perl use strict; use warnings; use MyApp; MyApp->new({ config => 'config.yaml' })->run;
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; use base 'Class::Component::Plugin'; sub test : Hook('test') { my($self, $c) = @_; use Data::Dumper; $c->log( debug => 'testmethod:' . Dumper($self->config) ); } 1;
Returns a hash that has the application-wide configuration.
$self->log( debug => 'debug log');
Kazuhiro Osawa <ko@yappo.ne.jp>
Class::Component
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Class::Component, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Class::Component
CPAN shell
perl -MCPAN -e shell install Class::Component
For more information on module installation, please visit the detailed CPAN module installation guide.