Kazuhiro Osawa > Class-Component-0.17 > Class::Component::Component::Plaggerize

Download:
Class-Component-0.17.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Source  

NAME ^

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

SYNOPSIS ^

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;

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.

syntax highlighting: