That did it. I've got it working now. Thanks. John Macdonald Software Engineer
Ontario Institute for Cancer Research MaRS Centre 661 University Avenue Suite 510 Toronto, Ontario Canada M5G 0A3 Tel: Email: john.macdon...@oicr.on.ca Toll-free: 1-866-678-6427 Twitter: @OICR_news www.oicr.on.ca This message and any attachments may contain confidential and/or privileged information for the sole use of the intended recipient. Any review or distribution by anyone other than the person for whom it was originally intended is strictly prohibited. If you have received this message in error, please contact the sender and delete all copies. Opinions, conclusions or other information contained in this message may not be that of the organization. ________________________________________ From: Karen Etheridge [p...@froods.org] Sent: August 21, 2014 7:33 PM To: moose@perl.org Subject: Re: forced coercion On Thu, Aug 21, 2014 at 09:23:00PM +0000, John Macdonald wrote: > So, how do I specify a type that starts with a base type, but then applies a > coercion? All the examples I see of coercions have a "natural" base > encoding, with the coercion providing a way to take some other type of value > and turn it into the base - but when base is a validated string, it is hard > to get it to actually use the coercion. Right, coercions are only applied if the data doesn't already validate against the type. So (saying this without puzzling through your lookahead assertion) you may need to define your new type as a totally separate type on its own, not derived from the first type, so it doesn't already validate, and therefore executes the coercion.