The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

NAME

Class::Component::Component::Plaggerize - extend your module like from Plagger component

SYNOPSIS

myapp.pl

#!/usr/bin/perl
use strict;
use MyApp;
MyApp->new({ config => 'config.yaml' })->run;

config.yaml

plugins:
- module: Test
config: hello

MyApp.pm

package MyApp;
use strict;
__PACKAGE__->load_components(qw/ Plaggerize /);
sub run {
my $self = shift;
$self->log( debug => 'running start' );
$self->run_hook('test');
}
1;

MyApp/Plugin/Test.pm

use strict;
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

setup_config
setup_plugins

AUTHOR

Kazuhiro Osawa <ko@yappo.ne.jp>

SEE ALSO

Class::Component

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.