On Tue, Apr 14, 2009 at 1:21 PM, Piotr Roszatycki
<piotr.roszaty...@gmail.com> wrote:
> 2009/4/14 Zbigniew Lukasiak <zzb...@gmail.com>:
>> I guess this might be a very basic question - but I could not find
>> anything suitable in the docs - so I want a way to add multiple
>> 'validate' methods to a form Field and have them called in what ever
>> sequence.  Is there a nice way to do that in Moose?
>
> I guess you want to load and apply Moose roles automatically.
>
> My proposition:
>
> Create anonymous or concrete class and call
> Moose::Util::apply_all_roles($class, @roles). The list of roles
> probably you'll take from configuration or File::Find.
>

Ah - sorry I was not specific enough.  What I had in mind was more
something similar to

with ValidationRoleSomething;
with ValidationRoleSomethingElse;
with ValidationRoleEntirelyDifferent;

and all those Roles providing a 'validate' method without a conflict.
Then when $object->validate is called it calls all the 'validate'
methods provided by the Roles in some sequence.

-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
http://perlalchemy.blogspot.com/

Reply via email to