X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FTypes%2FTypeDecorator.pm;h=12c7f4803b3bacd785f2913b07d38b3d41203974;hb=442e42ba3e90b69452a0c8c2a78cd55d2304262a;hp=99dc92692e11aee9cbec2c9032daccc1a2dccdd2;hpb=5a9b6d38459e9fde284735a9ddc28cec3b30d366;p=gitmo%2FMooseX-Types.git diff --git a/lib/MooseX/Types/TypeDecorator.pm b/lib/MooseX/Types/TypeDecorator.pm index 99dc926..12c7f48 100644 --- a/lib/MooseX/Types/TypeDecorator.pm +++ b/lib/MooseX/Types/TypeDecorator.pm @@ -23,8 +23,12 @@ use overload( ## It's kind of ugly that we need to know about Union Types, but this ## is needed for syntax compatibility. Maybe someday we'll all just do ## Or[Str,Str,Int] - - my @tc = grep {blessed $_} @_; + + my @tc = map { + blessed $_ ? $_ : + Moose::Util::TypeConstraints::find_or_parse_type_constraint($_) + } @_; + my $union = Moose::Meta::TypeConstraint::Union->new(type_constraints=>\@tc); return Moose::Util::TypeConstraints::register_type_constraint($union); },