Subject: | Problem with type-unions and attribute traits in v2 |
It appears as if traits that are attached to type-unions now throw an
error in Moose v2. Perhaps the mechanism that determines if the native
trait is applicable should do more with the meta than look at the
stringification of the type? Or, perhaps it should split on a /,|/ and
see if any component part matches?
By any means, this use to work with 1.x
package Class;
use Test::More tests => 1;
use Moose;
use MooseX::Types::Moose qw/Undef Str/;
eval {
has 'trait_boom' => (
is => 'rw'
, isa => Str | Undef
, default => ''
, traits => ['String']
);
};
ok ( !$@, "Created attr trait_boom, a type union of Str and Undef\n$@"
);
--
Evan Carroll
System Lord of the Internets
http://www.evancarroll.com