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

rjbs at code2.0beta.co.uk rjbs at code2.0beta.co.uk
Wed Jan 21 23:04:09 GMT 2009


Author: rjbs
Date: 2009-01-21 15:04:09 -0800 (Wed, 21 Jan 2009)
New Revision: 7349

Modified:
   Moose/trunk/lib/Moose/Util/TypeConstraints.pm
Log:
regsiter maybe_type

Modified: Moose/trunk/lib/Moose/Util/TypeConstraints.pm
===================================================================
--- Moose/trunk/lib/Moose/Util/TypeConstraints.pm	2009-01-21 22:23:09 UTC (rev 7348)
+++ Moose/trunk/lib/Moose/Util/TypeConstraints.pm	2009-01-21 23:04:09 UTC (rev 7349)
@@ -305,14 +305,16 @@
 sub maybe_type {
     my ($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;
-        }
-    )
+    register_type_constraint(
+      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;
+          }
+      )
+    );
 }
 
 sub coerce {




More information about the Moose-commits mailing list