From: Dave Rolsky Date: Wed, 21 Jan 2009 23:18:24 +0000 (+0000) Subject: In maybe_type, make a proper maybe type by parameterizing the Maybe Parameterizable... X-Git-Tag: 0.65~10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ed7060d9b4cbfade7bcf6ed13b7758b1661dcc39;p=gitmo%2FMoose.git In maybe_type, make a proper maybe type by parameterizing the Maybe Parameterizable type --- diff --git a/lib/Moose/Util/TypeConstraints.pm b/lib/Moose/Util/TypeConstraints.pm index e71541c..55cbc7b 100644 --- a/lib/Moose/Util/TypeConstraints.pm +++ b/lib/Moose/Util/TypeConstraints.pm @@ -306,16 +306,7 @@ 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')->parameterize($type_parameter) ); }