Skip to content

Commit

Permalink
call type_contraint once in Meta::Attribute Role
Browse files Browse the repository at this point in the history
  • Loading branch information
jberger committed Dec 13, 2011
1 parent 922f769 commit be69e0f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/MooseX/Types/NumUnit.pm
Expand Up @@ -184,7 +184,9 @@ Since the NumUnit types provided by this module are essentially just C<Num> type

return $current_val if defined $current_val;

return 1 if $self->type_constraint && $self->type_constraint->has_coercion && $self->type_constraint->is_a_type_of('NumUnit');
my $type = $self->type_constraint;
return 1 if $type && $type->has_coercion && $type->is_a_type_of('NumUnit');

return 0;
};

Expand Down

0 comments on commit be69e0f

Please sign in to comment.