Subject: | Copy & paste bug in MooseX::Params::Validate::_convert_to_param_validate_spec |
Copy & paste bug in MooseX::Params::Validate::_convert_to_param_validate_spec. Affects cases where $spec->{does} is a type constraint object (as opposed to, say, a type name):
sub _convert_to_param_validate_spec {
...
my $constraint;
if ( defined $spec->{isa} ) {
$constraint
= _is_tc( $spec->{isa} )
|| Moose::Util::TypeConstraints::find_or_parse_type_constraint(
$spec->{isa} )
|| class_type( $spec->{isa} );
}
elsif ( defined $spec->{does} ) {
$constraint
= _is_tc( $spec->{isa} )
^^^^^ HERE ^^^^^
|| find_type_constraint( $spec->{does} )
|| role_type( $spec->{does} );
}
The line marked "HERE" should be using $spec->{does} since $spec->{isa} is guaranteed to be undef at this point.