more tests and tweaks
[gitmo/MooseX-AttributeHelpers.git] / lib / MooseX / AttributeHelpers / Collection.pm
index f27a1ad..d821b15 100644 (file)
@@ -25,9 +25,15 @@ has 'container_type_constraint' => (
 
         my $container_type = $self->container_type;
         my $constraint     = find_type_constraint($container_type);
-        
-           $constraint = subtype('Object', where { $_->isa($container_type) })
-               unless $constraint;            
+
+        # NOTE:
+        # I am not sure DWIM-ery is a good thing
+        # here, so i am going to err on the side 
+        # of caution, and blow up if you have
+        # not made a type constraint for this yet.
+        # - SL
+        (defined $constraint)
+            || confess "You must predefine the '$container_type' constraint before you can use it as a container type";
         
         return $constraint;
     }
@@ -48,6 +54,7 @@ before 'process_options_for_provides' => sub {
 };
 
 no Moose;
+no Moose::Util::TypeConstraints;
 
 1;