From: Ricardo SIGNES Date: Fri, 7 Aug 2009 18:31:07 +0000 (-0400) Subject: docs, changelog for assert_valid X-Git-Tag: 0.89~16 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=952320e05d682eceb005fbc2e11342d86b3db76a;p=gitmo%2FMoose.git docs, changelog for assert_valid --- diff --git a/Changes b/Changes index a94a295..07144a9 100644 --- a/Changes +++ b/Changes @@ -11,6 +11,9 @@ next version unresolved method conflicts, not just the first method. Fixes #47210 reported by Ovid. (Sartak) + * Moose::Meta::TypeConstraint + - Add assert_valid method to use a TypeConstraint for assertion (rjbs) + 0.88 Fri Jul 24, 2009 * Moose::Manual::Contributing - Re-write the Moose::Manual::Contributing document to reflect diff --git a/lib/Moose/Meta/TypeConstraint.pm b/lib/Moose/Meta/TypeConstraint.pm index 298656f..ac5bca3 100644 --- a/lib/Moose/Meta/TypeConstraint.pm +++ b/lib/Moose/Meta/TypeConstraint.pm @@ -395,6 +395,13 @@ method returns an explicit C. If the type is not valid, we call C<< $self->get_message($value) >> internally to generate an error message. +=item B<< $constraint->assert_valid($value) >> + +Like C and C, this method checks whether C<$value> is +valid under the constraint. If it is, it will return true. If it is not, +an exception will be thrown with the results of +C<< $self->get_message($value) >>. + =item B<< $constraint->name >> Returns the type's name, as provided to the constructor.