Tom Lanyon <[email protected]> writes:
> 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.
>>
>> 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):
[...]
> sub register_all_plugins {
> shift->map_plugins( sub { $_->register(@_) } );
> }
...and the counterpart, run until success, is similarly trivial. Having a
little sugar to allow you to specify multiple methods to dispatch those, by
style, wouldn't even be hard.
> ... so perhaps we just need a generic framework for loading objects into
> their respective attribute baskets?
That, plus a little bit of the M::M::Attribute::Native support for it would be
about perfect. Add a little code generation and it can even be pleasantly
efficient.
Daniel
Now, just write some tests and my wishing that someone else would do this
before I got around to it will be met. Next, a pony.
--
✣ Daniel Pittman ✉ [email protected] ☎ +61 401 155 707
♽ made with 100 percent post-consumer electrons