From: Shawn M Moore Date: Sun, 14 Dec 2008 21:30:31 +0000 (+0000) Subject: Make this trait code a little more malleable X-Git-Tag: 0.64~18 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=965743fb9c4aad6d7110db72d6c375b0ccb9951f;p=gitmo%2FMoose.git Make this trait code a little more malleable --- diff --git a/lib/Moose/Meta/Attribute.pm b/lib/Moose/Meta/Attribute.pm index 1f7e017..1a47b7b 100644 --- a/lib/Moose/Meta/Attribute.pm +++ b/lib/Moose/Meta/Attribute.pm @@ -108,11 +108,12 @@ sub interpolate_class { my @traits; if (my $traits = $options{traits}) { - if ( @traits = grep { not $class->does($_) } map { - Moose::Util::resolve_metatrait_alias( Attribute => $_ ) - or - $_ - } @$traits ) { + @traits = + grep { not $class->does($_) } + map { Moose::Util::resolve_metatrait_alias(Attribute => $_) || $_ } + @$traits; + + if (@traits) { my $anon_class = Moose::Meta::Class->create_anon_class( superclasses => [ $class ], roles => [ @traits ],