RE: forced coercion

2015-07-17 Thread Roland Szocki
Could you provide an example? Thanks in advance. -- Roland Szocki Programista *Biuro serwisu Bankier.pl* www.bankier.pl ul. Kijowska 1, 03-738 Warszawa e-mail: r.szo...@firma.bankier.pl Grupa Bankier.pl Sp. z o.o. z siedzibą w Poznaniu, 60-166 Poznań, przy ul. Grunwaldzkiej 182, wpisana do

RE: forced coercion

2014-08-22 Thread John Macdonald
Subject: Re: forced coercion On Thu, Aug 21, 2014 at 09:23:00PM +, 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

forced coercion

2014-08-21 Thread John Macdonald
How do you code a subtype definition that forces a coercion to be used? I have: package My::Types; use MooseX::Types -declare = [ qw( A chA nochA ) ]; sub _valid_A { my $val = shift; $val =~ /^(?:chr)A/ } subtype A, as Str, where { _valid_A($_) }; subtype chrA; coerce chrA,

Re: forced coercion

2014-08-21 Thread Karen Etheridge
On Thu, Aug 21, 2014 at 09:23:00PM +, 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