Skip Menu |
 

This queue is for tickets about the Type-Tiny CPAN distribution.

Report information
The Basics
Id: 132392
Status: stalled
Priority: 0/
Queue: Type-Tiny

People
Owner: Nobody in particular
Requestors: VEESH [...] cpan.org
Cc:
AdminCc:

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



Subject: Inherited coercions have too high priority
Download (untitled) / with headers
text/plain 496b
I'm having an issue with my Type::Tiny type library. I have a type defined as a hashref with certain keys, defined with the Dict type. Some of those keys have their own types, with coercions, so i added coercion => 1 to the declaration of my type. Now, I want to add a coercion to my type of hashref from a hashref with different keys. My coercion fails, b/c the inherited coercions are happening before the one that I defined myself. Is this intended? If so, how can I work around the issue?
Download (untitled) / with headers
text/plain 181b
I'm currently working around the issue by defining my actual type as a base type, and then declaring the real type with ->plus_coercions, which has the priority rules that I expect.
Download (untitled) / with headers
text/plain 113b
Using ->plus_coercions would be what I'd generally suggest. Have you got some example code I can look at though?


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.