Add test on type constraints with complex parameters
[gitmo/Mouse.git] / lib / Mouse / Meta / TypeConstraint.pm
index 916acc1..13b4495 100644 (file)
@@ -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) = @_;\r
-    if ($self->{_compiled_type_constraint}->($value)) {\r
-        return undef;\r
-    }\r
-    else {\r
-        $self->get_message($value);\r
-    }\r
+    my ($self, $value) = @_;
+    if ($self->{_compiled_type_constraint}->($value)) {
+        return undef;
+    }
+    else {
+        $self->get_message($value);
+    }
 }
 
-sub assert_valid {\r
-    my ($self, $value) = @_;\r
-\r
-    my $error = $self->validate($value);\r
-    return 1 if ! defined $error;\r
+sub assert_valid {
+    my ($self, $value) = @_;
 
-    Carp::confess($error);\r
-}\r
+    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<Moose::Meta::TypeConstraint>
+
 =cut