package Mouse::Meta::TypeConstraint;
use strict;
use warnings;
-use Carp ();
use overload '""' => sub { shift->{name} }, # stringify to tc name
fallback => 1;
+use Carp ();
+
+use Mouse::Util qw(:meta);
+
sub new {
my $class = shift;
my %args = @_;
}
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) = @_;
+
+ my $error = $self->validate($value);
+ return 1 if ! defined $error;
- Carp::confess($error);\r
-}\r
+ Carp::confess($error);
+}
sub message {
=head1 NAME
-Mouse::Meta::TypeConstraint - The Mouse Type Constraint Metaclass
+Mouse::Meta::TypeConstraint - The Mouse Type Constraint metaclass
=head1 DESCRIPTION
=back
+=head1 SEE ALSO
+
+L<Moose::Meta::TypeConstraint>
+
=cut