On Fri, Jun 18, 2010 at 08:14:28PM +0100, Pedro Melo wrote: > Hi, > > > On Fri, Jun 18, 2010 at 7:44 PM, Evan Carroll <e...@dealermade.com> wrote: > > Actually you can do this with MX::Types too: > > > > use MooseX::Types -declare => [qw( MyDate DateTime )]; > > use MooseX::Types::Moose qw( Str Int HashRef Object ); > > use DateTime; > > > > class_type DateTime, { class => 'DateTime' }; > > > > subtype MyDate, as DateTime, where { ! $_->hour }; > > hmms... I had code like that in a previous version but could not get > it to work. The difference is that you added ", where { ! $_->hour }" > and I had only "subtype MyDate, as DateTime;". > > In fact if I remove the "where..." from you working example, the tests > start failing like mine did. I would like to understand why it needs > the where to work. Back to the docs for me.
Coercions aren't run if the input value is already of the correct type. -doy