[Catalyst] How to de-serialize json?
Bill Moseley
moseley at hank.org
Wed Jan 27 15:33:09 GMT 2010
On Tue, Jan 26, 2010 at 6:33 AM, J. Shirley <jshirley at gmail.com> wrote:
>
>
> I'm all for reusable code, but in no way should HTTP::Body start
> taking this behavior by default. I'm not really that sure how
> effective it is, anyway.
>
No, I was not suggesting that would be the default (although I'm not sure
why not handling other serializations by default is a bad idea). Not sure
what you mean by "effective".
> decode_json( $c->req->body ); Is just not that hard :)
>
Of course it's not that hard. Of course, this isn't hard, either: [1]
map { s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg; $_ } split /[&;=3D]/,
$c->req->body;
I see those as similar operations. The request is serialized in both cases.
But, one should not have to worry about adding low-level details like that
to application code when using an elegant web framework. ;)
No big deal. I was just curious why the HTTP::Body approach was not used in
the existing REST/RPC modules, as that was already the place used by
Catalyst to de-serialize the body. I thought maybe there was a reason I
might not understood, which is why I asked.
[1] Or whatever the correct approach is, and apologies to Damian for the
map.
-- =
Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20100127/3486a=
b1f/attachment.htm
More information about the Catalyst
mailing list