X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FTypes%2FStructured.pm;h=94dde0d9719b3c9e5584d8f0b2805aed6bdb3d0a;hb=220f2fbb9e5b5a0bf23bd9839d8fc91ca8ac1b37;hp=3d9fb76bbc07d3d4a7e75031679b7c54ca94eb1c;hpb=a4ae4800dff610e55214ff02068618705963b15c;p=gitmo%2FMooseX-Types-Structured.git diff --git a/lib/MooseX/Types/Structured.pm b/lib/MooseX/Types/Structured.pm index 3d9fb76..94dde0d 100644 --- a/lib/MooseX/Types/Structured.pm +++ b/lib/MooseX/Types/Structured.pm @@ -758,6 +758,14 @@ Moose::Util::TypeConstraints::get_type_constraint_registry->add_type_constraint( $overflow_handler = pop @type_constraints; } + my $length = $#type_constraints; + foreach my $idx (0..$length) { + unless(blessed $type_constraints[$idx]) { + ($type_constraints[$idx] = find_type_constraint($type_constraints[$idx])) + || die "$type_constraints[$idx] is not a registered type"; + } + } + my (@checks, @optional, $o_check, $is_compiled); return sub { my ($values, $err) = @_; @@ -838,7 +846,13 @@ Moose::Util::TypeConstraints::get_type_constraint_registry->add_type_constraint( && $type_constraints[-1]->isa('MooseX::Types::Structured::OverflowHandler')) { $overflow_handler = pop @type_constraints; } - my (%type_constraints) = @type_constraints; + my %type_constraints = @type_constraints; + foreach my $key (keys %type_constraints) { + unless(blessed $type_constraints{$key}) { + ($type_constraints{$key} = find_type_constraint($type_constraints{$key})) + || die "$type_constraints{$key} is not a registered type"; + } + } my (%check, %optional, $o_check, $is_compiled); return sub {