2009/4/14 Zbigniew Lukasiak <zzb...@gmail.com>:
> 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.

You just described how roles work :)

You should place into your role something like:

around 'validate' => sub {
    my ($next, $self) = @_;
    # here your code
    return $self->$next();
};

"around" guarantees that you're roles won't conflict.

-- 
 .''`.    Piotr Roszatycki
: :' :    mailto:piotr.roszaty...@gmail.com
`. `'     mailto:dex...@cpan.org
  `-

Reply via email to