MooseX::Plaggerize

tokuhirom on 2008-05-30T02:32:58

### DESCRIPTION

I want to use Plagger style plugins architecture with Moose.Therefore, I created MooseX::Plaggerize!

svn repos is here: http://svn.coderepos.org/share/lang/perl/MooseX-Plaggerize/trunk/

### SYNOPSIS

# in main

my $c = Your::Context->new; $c->load_config('config.yaml'); # feature of MooseX::Plaggerize::ConfigLoader $c->load_plugin('HTMLFilter::StickyTime'); $c->load_plugin({module => 'HTMLFilter::DocRoot', config => { root => '/mobirc/' }}); $c->run();

package Your::Context; use Moose; with 'MooseX::Plaggerize', 'MooseX::Plaggerize::ConfigLoader';

sub run { my $self = shift;

$self->run_hook('response_filter' => $args); }

package Your::Plugin::HTMLFilter::StickyTime; use strict; use MooseX::Plaggerize::Plugin;

hook 'response_filter' => sub { my ($self, $context, $args) = @_; };

### CONCEPT

* Plugin architecture like Plagger * Each plugin has own instance * Each plugin can have own configuration

### What's difference with MooseX::Object::Pluggable?

yeah, I know MooseX::Object::Pluggable, ofcource.

MooseX::Object::Pluggable stands on Moose::Role and method modifiers.This is cool architecture.

But, this approach cannot use configuration like Plagger :(

therefore, I wrote MooseX::Plaggerize :)

### ...

We would like to hear from you


Already exists?

Aristotle on 2008-05-30T07:25:24

There is a MooseX::Object::Pluggable on CPAN which the synopsis suggests does almost exactly the same thing as your module – and as a bonus, it has a much better name. For config loading there are already MooseX::ConfigFromFile and MooseX::SimpleConfig. Do none of these do what you need/want?

Re:Already exists?

tokuhirom on 2008-05-30T08:28:01

"MooseX::Plaggerize instanciates each plugins, and each plugin has own configuration" is core concept of MooseX::Plaggerize.MooseX::Object::Pluggable is not matched to this use case.

and, configuration file loader is not a key feature, that is trivial :)

Re:Already exists?

tokuhirom on 2008-05-30T10:13:45

hmm... please read source.

Re:Already exists?

Aristotle on 2008-05-30T10:40:01

Ah, I see, OK.

You still need a better name though – even someone who knows what Plagger is would have no idea what “Plaggerize” means until you tell them. It’s pretty much as if you had called the module MooseX::FooBaz.

How about MooseX::Hookable? That seems to describe the functionality you want to offer.

Re:Already exists?

Aristotle on 2008-06-01T12:17:06

F.ex. here is a distro that does in fact do the same thing, except without Moose: Hook::Modular.

mvp

rjbs on 2008-05-31T12:20:33

Sometimes, when I realize I can reuse something I liked in more places, I get too excited and act like everyone should like what I've done. So maybe you should ignore this.

I recently uploaded Config::INI::MVP::Reader, which I use in a few things to initialize plugins based on configuration. You might find it useful for doing some similar, simple things with Plaggerize.

Every time I see Plaggerize in the RSS feed, I think "plagarize." :-)