From 2174fd7705d465d46743dd4b2113cc98bb717e04 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 15 Oct 2012 17:28:17 -0500 Subject: make nesting doctypes work --- lib/MooseX/Meta/TypeConstraint/Doctype.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib') 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); } }, -- cgit v1.2.3-54-g00ecf