Subject: | Traits attribute checking breaks MooseX::Types composed types |
The update to 1.15 has broken attribute type checking on some attributes
with Native traits. I had the following attribute:
102 has template_list => (
103 traits => ['Hash'],
104 isa => TemplateHash,
105 default => sub { {} },
106 handles => {
107 _set_template => "set",
108 get_template_by_name => "get",
109 get_templates => "values",
110 get_template_names => "keys",
111 },
112 );
[See Webservice-InterMine-0.946 on CPAN,
lib/Webservice/InterMine/TemplateFactory.pm]
where TemplateHash is defined in a MooseX::Types library as
98 subtype TemplateHash, as HashRef [Template];
...
138 class_type Template, {
class => 'Webservice::InterMine::Query::Template',
};
[See InterMine-TypeLibrary-0.941 on CPAN, lib/InterMine/TypeLibrary]
Builds with this attribute got the error:
Error was: Attribute (template_list) does not pass the type constraint
because: Validation failed for 'InterMine::TypeLibrary::TemplateHash'
However, changing the attribute to:
102 has template_list => (
103 traits => ['Hash'],
104 isa => HashRef[Template],
105 default => sub { {} },
106 handles => {
107 _set_template => "set",
108 get_template_by_name => "get",
109 get_templates => "values",
110 get_template_names => "keys",
111 },
112 );
[see above, Webservice-InterMine-0.947]
solves the issue.
Thankfully this works for me; however, if I wanted to use a coercion here
I would have issues.
I hope this helps for future releases,
Alex Kalderimis