X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMouse%2FMeta%2FTypeConstraint.pm;h=30edadd01dcd2f9ed37dd9b296d7725d98d0805f;hb=b880de945fcf59e9811132613b5bcbca8a6d8696;hp=a35b4d0bb222857972d4f4fb0cac1f13c56210dd;hpb=065f79e7cd03765f26c6ea276aaf9b3c5897886a;p=gitmo%2FMouse.git diff --git a/lib/Mouse/Meta/TypeConstraint.pm b/lib/Mouse/Meta/TypeConstraint.pm index a35b4d0..30edadd 100644 --- a/lib/Mouse/Meta/TypeConstraint.pm +++ b/lib/Mouse/Meta/TypeConstraint.pm @@ -2,7 +2,17 @@ package Mouse::Meta::TypeConstraint; use Mouse::Util qw(:meta); # enables strict and warnings use overload + 'bool' => sub { 1 }, # always true + '""' => sub { $_[0]->name }, # stringify to tc name + + '|' => sub { # or-combination + require Mouse::Util::TypeConstraints; + return Mouse::Util::TypeConstraints::find_or_parse_type_constraint( + "$_[0] | $_[1]", + ); + }, + fallback => 1; use Carp ();