Skip Menu |

This queue is for tickets about the MooseX-Types-XMLSchema CPAN distribution.

Report information
The Basics
Id: 76789
Status: resolved
Priority: 0/
Queue: MooseX-Types-XMLSchema

People
Owner: Nobody in particular
Requestors: steve.bitcard [...] yewtc.demon.co.uk
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.02
Fixed in: (no value)



Subject: The example in the perldoc doesn't work for xs:decimal
perl 5.8.8, Centos 5.3 v 0.02 and perl 5.14.2 Fedora 16 v 0.02 Simplifying the example in the perldoc to : my $object = My::Class->new( decimal => 20.12, ); Gives: Attribute (decimal) does not pass the type constraint because: Validation failed for 'xs:decimal' with value 20.12 ... I tried it on two systems and got the same result. I had a walk through the code, but got lost in the thing that is Moose.
Hi, Thanks for spotting it - v0.04 was just pushed to CPAN/github. Problem & solution: xs:decimal requires Math::BigFloat objects or attribute with coercion set (so Num would be coerced to Math::BigFloat), so those will work: my $object = My::Class->new( decimal_co => 20.12, ); # or my $object = My::Class->new( decimal => Math::BigFloat->new(20.12), ); I've also added a link to MooseX::AlwaysCoerce module, which you may find useful. Thanks, Alex
Subject: Re: [rt.cpan.org #76789] The example in the perldoc doesn't work for xs:decimal
Date: Wed, 25 Apr 2012 13:27:55 +0100
To: bug-MooseX-Types-XMLSchema [...] rt.cpan.org
From: Steve <steve.bitcard [...] yewtc.demon.co.uk>
Thanks, it now works. Steve On 24/04/12 22:41, Alex J. G. Burzynski via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=76789> > > Hi, > > Thanks for spotting it - v0.04 was just pushed to CPAN/github. > > Problem& solution: > xs:decimal requires Math::BigFloat objects or attribute with coercion > set (so Num would be coerced to Math::BigFloat), so those will work: > > my $object = My::Class->new( > decimal_co => 20.12, > ); > > # or > > my $object = My::Class->new( > decimal => Math::BigFloat->new(20.12), > ); > > I've also added a link to MooseX::AlwaysCoerce module, which you may > find useful. > > Thanks, > Alex > >
I'm marking it as resolved then Thanks, Alex