projects
/
gitmo/Mouse.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
Add assert_valid() to Meta::TypeConstraint
[gitmo/Mouse.git]
/
lib
/
Mouse
/
Meta
/
TypeConstraint.pm
diff --git
a/lib/Mouse/Meta/TypeConstraint.pm
b/lib/Mouse/Meta/TypeConstraint.pm
index
f6bdac8
..
dc34532
100644
(file)
--- a/
lib/Mouse/Meta/TypeConstraint.pm
+++ b/
lib/Mouse/Meta/TypeConstraint.pm
@@
-220,6
+220,15
@@
sub parameterize{
);
}
+sub assert_valid {
+ my ($self, $value) = @_;
+
+ if(!$self->_compiled_type_constraint->($value)){
+ Carp::confess($self->get_message($value));
+ }
+ return 1;
+}
+
1;
__END__