Skip Menu |

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

Report information
The Basics
Id: 77879
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: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: xs:datetime not DateTime
The following may not be a bug. It may be my understanding of what is going on is wrong. I was expecting the an xs:dateTime ( it seems to have to be xs:dateTime and not xs:datetime as per the documentation) to convert to a DateTime object, but it doesn't, even if I use coerce, so I get: 'Event' => bless( { 'DateTime' => '2012-03-27T07:55:10', 'Type' => 'ACK' }, 'MyApp::Op:Message::Request' ), This is in contrast to xs:decimal which coerces to a BigFloat. Apologies if I'm going "off piste".
Hi Steve, Thanks for spotting that typo - just fixed it - v0.06 was released yestarday (among other fixes/improvements). Regarding the coercion: types are stored as objects if they can cleanly stringify to valid XML type. So xs:decimal can be stored as Math::BigFloat, because the module itself stringifies nicely, but DateTime stringifies to ISO8601, which isn't valid for most of xs:* types. I think that I've tried to keep the values using as simple types as possible - flattening from any objects, with the exception for larger numbers. But if you want to store DateTime object and produce xs: type on output, please take a look at https://github.com/ajgb/moosex-types-xmlschema/pull/1#issuecomment-6559183 where I've suggested using storage attribute. Cheers, Alex On Mon Jun 18 11:57:44 2012, SJR wrote: Show quoted text
> The following may not be a bug. It may be my understanding of what is > going on is wrong. > > I was expecting the an xs:dateTime ( it seems to have to be xs:dateTime > and not xs:datetime as per the documentation) to convert to a DateTime > object, but it doesn't, even if I use coerce, so I get: > > 'Event' => bless( { > 'DateTime' => '2012-03-27T07:55:10', > 'Type' => 'ACK' > }, 'MyApp::Op:Message::Request' ), > > This is in contrast to xs:decimal which coerces to a BigFloat. > > Apologies if I'm going "off piste".