Rename the method to verify_against_type_constraint since Moose renamed it too
Shawn M Moore [Mon, 22 Dec 2008 02:53:05 +0000 (02:53 +0000)]
lib/Mouse/Meta/Attribute.pm
lib/Mouse/Object.pm
t/101-meta-attribute.t

index 887afc3..f076668 100644 (file)
@@ -323,7 +323,7 @@ sub validate_args {
     return 1;
 }
 
-sub verify_type_constraint {
+sub verify_against_type_constraint {
     return 1 unless $_[0]->{type_constraint};
 
     local $_ = $_[1];
@@ -470,7 +470,7 @@ Creates a new code reference for each of the attribute's handles methods.
 Returns a code reference which can be used to check that a given value passes
 this attribute's type constraint;
 
-=head2 verify_type_constraint Item -> 1 | ERROR
+=head2 verify_against_type_constraint Item -> 1 | ERROR
 
 Checks that the given value passes this attribute's type constraint. Returns 1
 on success, otherwise C<confess>es.
index 804f461..375cf60 100644 (file)
@@ -19,8 +19,7 @@ sub new {
         if (defined($from) && exists($args->{$from})) {
             $args->{$from} = $attribute->coerce_constraint($args->{$from})
                 if $attribute->should_coerce;
-            $attribute->verify_type_constraint($args->{$from})
-                if $attribute->has_type_constraint;
+            $attribute->verify_against_type_constraint($args->{$from});
 
             $instance->{$key} = $args->{$from};
 
@@ -44,8 +43,7 @@ sub new {
 
                     $value = $attribute->coerce_constraint($value)
                         if $attribute->should_coerce;
-                    $attribute->verify_type_constraint($value)
-                        if $attribute->has_type_constraint;
+                    $attribute->verify_against_type_constraint($value);
 
                     $instance->{$key} = $value;
 
index 7bd36cd..8143274 100644 (file)
@@ -30,4 +30,4 @@ is($attr->predicate, 'has_pawn', 'predicate');
 is($attr->clearer, 'clear_pawn', 'clearer');
 ok(!$attr->is_lazy_build, "not lazy_build");
 is(ref($attr->default), 'CODE', 'default is a coderef');
-ok($attr->verify_type_constraint(1), 'verify_type_constraint works even without isa');
+ok($attr->verify_against_type_constraint(1), 'verify_against_type_constraint works even without isa');