[pm-h] JSON Dates and DateTime
Mark Allen
mrallen1 at yahoo.com
Thu Feb 13 15:57:31 PST 2014
I guess all the cool kids are using 'parent' to subclass now. Mea culpa.
Sent from my iPhone
> On Feb 13, 2014, at 5:55 PM, Mark Allen <mrallen1 at yahoo.com> wrote:
>
> You should subclass DateTime into your own package
>
> package My::DateTime;
> use base ('DateTime');
>
> sub TO_JSON { ...; }
>
> Then bless your objects into My::DateTime
>
> Probably errors since I'm typing on my phone but you get the gist.
>
> Mark
>
> Sent from my iPhone
>
>> On Feb 13, 2014, at 4:58 PM, "Michael R. Davis" <mrdvt92 at yahoo.com> wrote:
>>
>> Mark et al,
>>
>> >> I need to call a JSON web service with dates. ... '/Date(1392233750000-0600)/'
>> > As far as I am aware, JSON supports auto-serialization of a blessed object only if allow_blessed => 1 and convert_blessed => 1.
>>
>> I'll look into that... It looks like I'll need to add a TO_JSON method to the DateTime object (which I'm not exactly sure how to do...)
>>
>> Just to make things harder. Since the remote service requires sort_by and performance of JSON::PP is so SLOW. I'm using JSON::PP to encode and JSON::XS to decode. It's crazy the things we have to do to get around implementations in the first place.
>> Thanks,
>> Mike
> _______________________________________________
> Houston mailing list
> Houston at pm.org
> http://mail.pm.org/mailman/listinfo/houston
> Website: http://houston.pm.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/mailman/private/houston/attachments/20140213/d83f92b1/attachment.html>
More information about the Houston
mailing list