fixing this to work correctly
[gitmo/MooseX-AttributeHelpers.git] / lib / MooseX / AttributeHelpers / Counter.pm
index 83ede3b..9339472 100644 (file)
@@ -1,6 +1,7 @@
 
 package MooseX::AttributeHelpers::Counter;
 use Moose;
+use Moose::Util::TypeConstraints;
 
 our $VERSION   = '0.01';
 our $AUTHORITY = 'cpan:STEVAN';
@@ -27,11 +28,12 @@ sub _process_options_for_provides {
     (exists $options->{isa})
         || confess "You must define a type with the Counter metaclass";  
      
-    (find_type_constraint($options->{isa})->is_subtype_of('Num'))
-        || confess "The type constraint for a Counter must be a subtype of Num";
+    (find_type_constraint($options->{isa})->is_a_type_of('Num'))
+        || confess "The type constraint for a Counter ($options->{isa}) must be a subtype of Num";
 }
     
 no Moose;
+no Moose::Util::TypeConstraints;
 
 # register the alias ...
 package Moose::Meta::Attribute::Custom::Counter;