X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FMeta%2FTypeConstraint.pm;h=298656fa10a64bf764da10a0d05647a4cc00bc0b;hb=c24269b37a781e0358c3682e8717cfd539269550;hp=bd5f2a9758ff3035736c172e12108a7f4c389f27;hpb=e6ab9ca5a4c8fad570cf70bc6722d06e18542331;p=gitmo%2FMoose.git diff --git a/lib/Moose/Meta/TypeConstraint.pm b/lib/Moose/Meta/TypeConstraint.pm index bd5f2a9..298656f 100644 --- a/lib/Moose/Meta/TypeConstraint.pm +++ b/lib/Moose/Meta/TypeConstraint.pm @@ -13,7 +13,7 @@ use Sub::Name qw(subname); use base qw(Class::MOP::Object); -our $VERSION = '0.83'; +our $VERSION = '0.88'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; @@ -104,6 +104,16 @@ sub validate { } } +sub assert_valid { + my ($self, $value) = @_; + + my $error = $self->validate($value); + return 1 if ! defined $error; + + require Moose; + Moose->throw_error($error); +} + sub get_message { my ($self, $value) = @_; if (my $msg = $self->message) {