On 09/04/2010, at 4:57 PM, Daniel Pittman wrote:
> I think that there is a space for a framework that provided that sort of "load
> everything" model, and which allowed you to call "method X on all plugins",
> and "method X until a plugin returns a true value", since that covers the vast
> majority of needs.
> 
> It also makes it easy to hook in more abstract negotiation mechanisms: call
> the "register" method in all plugins, passing a reference to your external
> negotiator, and use that to map back to them.
> 
>        Daniel
> 
> Well, it would solve my problem, which is the same as "generic need", right?

Well, yes, but something generic like 'run method register on all plugins' is 
as simple as (untested):

    package MyApp;
    use Moose;

    has 'plugins' => (
       traits     => ['Array'],
       is         => 'ro',
       isa        => 'ArrayRef[MyApp::Plugin]',
       default    => sub { [] },
       handles    => {
           map_plugins    => 'map',
       },
    );

    sub register_all_plugins {
        shift->map_plugins( sub { $_->register(@_) } );
    }

... so perhaps we just need a generic framework for loading objects into their 
respective attribute baskets?

Tom

Reply via email to