X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMouse%2FMeta%2FTypeConstraint.pm;h=13b44954c5042e659610816dcaf21f02d0db29fd;hb=c6d8f5caf4ee3eccf6d417ddb19d51ebdc209112;hp=916acc130b921c947a2cd43898706a2d09e3d8f6;hpb=6d28c5cf89bfd4c00e675e95aff6c31b61aeb805;p=gitmo%2FMouse.git diff --git a/lib/Mouse/Meta/TypeConstraint.pm b/lib/Mouse/Meta/TypeConstraint.pm index 916acc1..13b4495 100644 --- a/lib/Mouse/Meta/TypeConstraint.pm +++ b/lib/Mouse/Meta/TypeConstraint.pm @@ -7,7 +7,7 @@ use overload '""' => sub { shift->{name} }, # stringify to tc name use Carp (); -use Mouse::Util (); +use Mouse::Util qw(:meta); sub new { my $class = shift; @@ -34,23 +34,23 @@ sub check { } sub validate { - my ($self, $value) = @_; - if ($self->{_compiled_type_constraint}->($value)) { - return undef; - } - else { - $self->get_message($value); - } + my ($self, $value) = @_; + if ($self->{_compiled_type_constraint}->($value)) { + return undef; + } + else { + $self->get_message($value); + } } -sub assert_valid { - my ($self, $value) = @_; - - my $error = $self->validate($value); - return 1 if ! defined $error; +sub assert_valid { + my ($self, $value) = @_; - Carp::confess($error); -} + my $error = $self->validate($value); + return 1 if ! defined $error; + + Carp::confess($error); +} sub message { @@ -84,7 +84,7 @@ __END__ =head1 NAME -Mouse::Meta::TypeConstraint - The Mouse Type Constraint Metaclass +Mouse::Meta::TypeConstraint - The Mouse Type Constraint metaclass =head1 DESCRIPTION @@ -106,5 +106,9 @@ Don't use this. =back +=head1 SEE ALSO + +L + =cut