On 14 Mar 2012, at 17:21, Caleb Cushing wrote:
> I'm not saying new_with_traits is bad, or with_traits is bad, just
> that I'd like to be able optionally turn on a way to do it with just
> ->new . regardless of whether it changes peoples expectations of what
> new does (because otherwise I have to change a different expectation,
> which construction method to use )

package MyApp::Role::TraitsInBuild;
use Moose::Role;

sub BUILD {}
after BUILD => sub {
    my ($self, $args) = @_;
    foreach (@{$args->{traits}}) {
        $_->meta->apply($self);
   }
};

Or you can around new => sub {… and have the logic there…

Or whatever you like really.

I don't think that what you want is at all hard, I just think it's a bad idea 
to do it as a standard in any way.. :)

Cheers
t0m


Reply via email to