Skip Menu |
 

This queue is for tickets about the Moose CPAN distribution.

Report information
The Basics
Id: 61989
Status: rejected
Priority: 0/
Queue: Moose

People
Owner: Nobody in particular
Requestors: perl [...] intermine.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.15
Fixed in: (no value)



Subject: Traits attribute checking breaks MooseX::Types composed types
Download (untitled) / with headers
text/plain 1.8k
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
Download (untitled) / with headers
text/plain 1.8k
On Fri Oct 08 07:41:00 2010, INTERMINE wrote: Show quoted text
> 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,
Can you provide a small code example that demonstrates the problem (aka a test we can run)? That would be very helpful. Thanks, -dave
This has been stalled for over a year, if it is still an issue please re-open. -Chris


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.