From: Shawn M Moore Date: Wed, 15 Apr 2009 06:37:39 +0000 (-0400) Subject: Clean up verify_against_type_constraint X-Git-Tag: 0.22~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=commitdiff_plain;h=f55f60dd1546028de576a08ef877af282e902756 Clean up verify_against_type_constraint --- diff --git a/lib/Mouse/Meta/Attribute.pm b/lib/Mouse/Meta/Attribute.pm index 851755d..73e8f9e 100644 --- a/lib/Mouse/Meta/Attribute.pm +++ b/lib/Mouse/Meta/Attribute.pm @@ -225,13 +225,14 @@ sub validate_args { } sub verify_against_type_constraint { - return 1 unless $_[0]->{type_constraint}; + my ($self, $value) = @_; + my $tc = $self->type_constraint; + return 1 unless $tc; - local $_ = $_[1]; - return 1 if $_[0]->{type_constraint}->check($_); + local $_ = $value; + return 1 if $tc->check($value); - my $self = shift; - $self->verify_type_constraint_error($self->name, $_, $self->{type_constraint}); + $self->verify_type_constraint_error($self->name, $value, $tc); } sub verify_type_constraint_error {