Type coercins needs to be able to create types;
Stevan Little [Thu, 13 Dec 2007 08:22:54 +0000 (08:22 +0000)]
lib/Moose/Meta/TypeCoercion.pm

index 4620c51..5bfd37e 100644 (file)
@@ -43,7 +43,7 @@ sub compile_type_coercion {
     my @coercions;
     while (@coercion_map) {
         my ($constraint_name, $action) = splice(@coercion_map, 0, 2);
-        my $type_constraint = Moose::Util::TypeConstraints::find_type_constraint($constraint_name);
+        my $type_constraint = Moose::Util::TypeConstraints::find_or_create_type_constraint($constraint_name);
         (defined $type_constraint)
             || confess "Could not find the type constraint ($constraint_name) to coerce from";
         push @coercions => [