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

2009-04-14 Thread Piotr Roszatycki
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

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 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

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

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

Re: Moose::Util function for applying missing roles

2009-04-14 Thread Todd Hepler
Hans Dieter Pearcey wrote: I added a note in the Moose::Meta::Role documentation yesterday to the effect that applying a role did not do any checks to make sure that the target had not already consumed the role you were attempting to apply. I always find myself writing apply role unless does

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' }},

Re: Moose::Util function for applying missing roles

2009-04-14 Thread Stevan Little
Or perhaps ensure_all_roles_are_applied? On Apr 14, 2009, at 10:34 AM, Todd Hepler wrote: Hans Dieter Pearcey wrote: I added a note in the Moose::Meta::Role documentation yesterday to the effect that applying a role did not do any checks to make sure that the target had not already

Roles, Classes and silent overriding

2009-04-14 Thread Stevan Little
So, Ovid has a new Moose related post on his use.perl journal (http://use.perl.org/~Ovid/journal/38809 ) which sparked a discussion on #moose IRC channel. The core of Ovid's issue is that when a role is composed into a class, the class wins in any method conflicts. This is how roles were

Re: Roles, Classes and silent overriding

2009-04-14 Thread Hans Dieter Pearcey
On Tue, Apr 14, 2009 at 02:22:52PM -0400, Stevan Little wrote: So, while I am not willing to change this behavior, I am willing to add a warning so that it is not so silent anymore. So code like this will warn you that your overriding a class method. This is a reasonable compromise, and