On Tue, Apr 14, 2009 at 1:14 PM, Stevan Little
<stevan.lit...@iinteractive.com> wrote:
> You will need to manually disambiguate the validate conflicts, which can be
> done with aliasing like so:
>
> package Foo;
> use Moose;
>
> with 'ValidateThis'          => { alias => { validate => 'validate_this' }},
>     'ValidateThat'          => { alias => { validate => 'validate_that' }},
>     'ValidateSomethingElse' => { alias => { validate =>
> 'validate_something_else' }};
>
> sub validate {
>    my $self = shift;
>    $self->validate_this;
>    $self->validate_that;
>    $self->validate_something_else;
> }
>
> You can read more about this feature at
> http://search.cpan.org/~drolsky/Moose-0.74/lib/Moose/Cookbook/Roles/Recipe2.pod

I was just typing this up but stevan said it better (my first reply
was from my phone, not easy to type Perl on the G1).

This is exactly the solution I was recommending because it eliminates
the action-at-a-distance issues that Piotr's solution will bring up.
Using method modifiers will get you there, but can (will probably)
lead to a maintenance nightmare down the road. This way your validate
method expressly says what is going on so anybody coming in can read
the code and understand what is happening.

-Chris

Reply via email to