summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-10-15 17:28:17 -0500
committerJesse Luehrs <doy@tozt.net>2012-10-15 17:43:51 -0500
commit2174fd7705d465d46743dd4b2113cc98bb717e04 (patch)
treea0fa292fa4657257a3c5539f1a92a1254666fd91 /lib
parentabcf38defd36cf7e25ac4b4d7e07f01d0bbd3cb1 (diff)
downloadmoosex-validation-doctypes-2174fd7705d465d46743dd4b2113cc98bb717e04.tar.gz
moosex-validation-doctypes-2174fd7705d465d46743dd4b2113cc98bb717e04.zip
make nesting doctypes work
Diffstat (limited to 'lib')
-rw-r--r--lib/MooseX/Meta/TypeConstraint/Doctype.pm9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/MooseX/Meta/TypeConstraint/Doctype.pm b/lib/MooseX/Meta/TypeConstraint/Doctype.pm
index dbc1289..cc48312 100644
--- a/lib/MooseX/Meta/TypeConstraint/Doctype.pm
+++ b/lib/MooseX/Meta/TypeConstraint/Doctype.pm
@@ -177,7 +177,14 @@ sub _validate_doctype {
'Str|Moose::Meta::TypeConstraint' => sub {
my $tc = Moose::Util::TypeConstraints::find_or_parse_type_constraint($doctype);
die "Unknown type $doctype" unless $tc;
- if (!$tc->check($data)) {
+ if ($tc->isa(__PACKAGE__)) {
+ my $sub_errors = $tc->_validate_doctype($data, undef, $prefix);
+ if ($sub_errors) {
+ $errors = $sub_errors->errors;
+ $extra_data = $sub_errors->extra_data;
+ }
+ }
+ elsif (!$tc->check($data)) {
$errors = $self->_format_error($data, $prefix);
}
},