From: Shawn M Moore Date: Mon, 22 Dec 2008 02:53:05 +0000 (+0000) Subject: Rename the method to verify_against_type_constraint since Moose renamed it too X-Git-Tag: 0.19~94 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=20e25eb99981654f64a6b4a9139e55ddca399981;p=gitmo%2FMouse.git Rename the method to verify_against_type_constraint since Moose renamed it too --- diff --git a/lib/Mouse/Meta/Attribute.pm b/lib/Mouse/Meta/Attribute.pm index 887afc3..f076668 100644 --- a/lib/Mouse/Meta/Attribute.pm +++ b/lib/Mouse/Meta/Attribute.pm @@ -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 Ces. diff --git a/lib/Mouse/Object.pm b/lib/Mouse/Object.pm index 804f461..375cf60 100644 --- a/lib/Mouse/Object.pm +++ b/lib/Mouse/Object.pm @@ -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; diff --git a/t/101-meta-attribute.t b/t/101-meta-attribute.t index 7bd36cd..8143274 100644 --- a/t/101-meta-attribute.t +++ b/t/101-meta-attribute.t @@ -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');