Re: Multiple roles exporting the same method - for something like plugins

2009-04-15 Thread Chris Prather
On Tue, Apr 14, 2009 at 1:14 PM, Stevan Little 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'    

Re: Multiple roles exporting the same method - for something like plugins

2009-04-14 Thread Stevan Little
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' }}, 'Va

Re: Multiple roles exporting the same method - for something like plugins

2009-04-14 Thread Piotr Roszatycki
2009/4/14 Zbigniew Lukasiak : >    package Role::A; >    use Moose::Role; >    after 'validate' => sub { >        print "Role::A\n"; >    } It's ok, but as far as I remember, with "after" modifier you're return value is totally ignored. Nice explanation you'll find at http://search.cpan.org/perldo

Re: Multiple roles exporting the same method - for something like plugins

2009-04-14 Thread Zbigniew Lukasiak
On Tue, Apr 14, 2009 at 2:15 PM, Chris Prather wrote: > Roles by default will drop conflicting methods on the floor. However you can > optionally remap method names and or exclude method names. > > If you were to remap thr validate methods then in you main class write a > single validate that call

Re: Multiple roles exporting the same method - for something like plugins

2009-04-14 Thread Chris Prather
Roles by default will drop conflicting methods on the floor. However you can optionally remap method names and or exclude method names. If you were to remap thr validate methods then in you main class write a single validate that called them that would be the cleanest solution. On Apr 14, 2009 8:

Re: Multiple roles exporting the same method - for something like plugins

2009-04-14 Thread Piotr Roszatycki
2009/4/14 Zbigniew Lukasiak : > 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 con

Re: Multiple roles exporting the same method - for something like plugins

2009-04-14 Thread Zbigniew Lukasiak
On Tue, Apr 14, 2009 at 1:21 PM, Piotr Roszatycki wrote: > 2009/4/14 Zbigniew Lukasiak : >> 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

Re: Multiple roles exporting the same method - for something like plugins

2009-04-14 Thread Piotr Roszatycki
2009/4/14 Zbigniew Lukasiak : > 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

Multiple roles exporting the same method - for something like plugins

2009-04-14 Thread Zbigniew Lukasiak
Hi, 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? -- Zbigniew Lukasiak http://brudnopis.bl