[Moose-commits] r7353 - Moose/trunk/lib/Moose/Util

autarch at code2.0beta.co.uk autarch at code2.0beta.co.uk
Wed Jan 21 23:18:25 GMT 2009


Author: autarch
Date: 2009-01-21 15:18:24 -0800 (Wed, 21 Jan 2009)
New Revision: 7353

Modified:
   Moose/trunk/lib/Moose/Util/TypeConstraints.pm
Log:
In maybe_type, make a proper maybe type by parameterizing the Maybe Parameterizable type


Modified: Moose/trunk/lib/Moose/Util/TypeConstraints.pm
===================================================================
--- Moose/trunk/lib/Moose/Util/TypeConstraints.pm	2009-01-21 23:12:40 UTC (rev 7352)
+++ Moose/trunk/lib/Moose/Util/TypeConstraints.pm	2009-01-21 23:18:24 UTC (rev 7353)
@@ -306,16 +306,7 @@
     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)
     );
 }
 




More information about the Moose-commits mailing list