summaryrefslogtreecommitdiffstats
path: root/lib/MooseX/Meta/TypeConstraint/Doctype.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/MooseX/Meta/TypeConstraint/Doctype.pm')
-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);
}
},