Skip Menu |
 

This queue is for tickets about the Moose CPAN distribution.

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

People
Owner: Nobody in particular
Requestors:
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.0401
Fixed in: (no value)



Subject: coerce doesn't create type constraints on type names
Download (untitled) / with headers
text/plain 407b
Simple: perl -Moose -E'coerce "ArrayRef[Int]", from "Int", via { [$_] }' Cannot find type 'ArrayRef[Int]', perhaps you forgot to load it at /usr/local/lib/perl/5.10.1/Moose/Util/TypeConstraints.pm line 581 This is fixed with find_or_parse_type_constraint: perl -Moose - E'Moose::Util::TypeConstraints::find_or_parse_type_constraint("ArrayRef[I nt]");coerce "ArrayRef[Int]", from "Int", via { [$_] }'
Download (untitled) / with headers
text/plain 830b
On Thu Jan 05 10:54:03 2012, gbjk@thermeoneurope.com wrote: Show quoted text
> Simple: > > perl -Moose -E'coerce "ArrayRef[Int]", from "Int", via { [$_] }' > > Cannot find type 'ArrayRef[Int]', perhaps you forgot to load it at > /usr/local/lib/perl/5.10.1/Moose/Util/TypeConstraints.pm line 581 > > This is fixed with find_or_parse_type_constraint: > > perl -Moose - >
E'Moose::Util::TypeConstraints::find_or_parse_type_constraint("ArrayRef[ I Show quoted text
> nt]");coerce "ArrayRef[Int]", from "Int", via { [$_] }'
I'm not sure this is a bug. More importantly, the only cases where this would happen are when you try to create coercions on built-in parameterizable types, which is a really really bad idea. Instead, it's safer to create a subtype of ArrayRef[Int] and coerce to that. Regardless, this will all be fixed once we start using Type ;)
Yeah, this isn't a bug.


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.