X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FUtil%2FTypeConstraints.pm;h=e71541c4a1d715ec09aee08d0cfc614b6c841505;hb=3781cdab130d6712b3ee2b26bb8b0abe7a225eab;hp=8aa7f3fc0e9a42b9ed72c10f3b82c1124bdc6a31;hpb=161a9c89bd79b7b56e7198d64d891fb17e174fff;p=gitmo%2FMoose.git diff --git a/lib/Moose/Util/TypeConstraints.pm b/lib/Moose/Util/TypeConstraints.pm index 8aa7f3f..e71541c 100644 --- a/lib/Moose/Util/TypeConstraints.pm +++ b/lib/Moose/Util/TypeConstraints.pm @@ -306,16 +306,16 @@ sub maybe_type { my ($type_parameter) = @_; register_type_constraint( - $REGISTRY->get_type_constraint('Maybe') - ->generate_constraint_for($type_parameter) - # Moose::Meta::TypeConstraint->new( - # parent => find_type_constraint('Item'), - # constraint => sub { - # my $check = $type_parameter->_compiled_type_constraint; - # return 1 if not(defined($_)) || $check->($_); - # return; - # } - # ) + # $REGISTRY->get_type_constraint('Maybe') + # ->generate_constraint_for($type_parameter) + Moose::Meta::TypeConstraint->new( + parent => find_type_constraint('Item'), + constraint => sub { + my $check = $type_parameter->_compiled_type_constraint; + return 1 if not(defined($_)) || $check->($_); + return; + } + ) ); }