From aebd3a90d2fba77955970e254499277e095736c6 Mon Sep 17 00:00:00 2001 From: franck cuny Date: Sun, 18 Jul 2010 09:00:23 +0200 Subject: allow nonref for json; clean POD --- lib/Net/HTTP/API/Parser/JSON.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'lib/Net/HTTP/API/Parser') diff --git a/lib/Net/HTTP/API/Parser/JSON.pm b/lib/Net/HTTP/API/Parser/JSON.pm index be8b30e..2edc71c 100644 --- a/lib/Net/HTTP/API/Parser/JSON.pm +++ b/lib/Net/HTTP/API/Parser/JSON.pm @@ -6,14 +6,21 @@ use JSON; use Moose; extends 'Net::HTTP::API::Parser'; +has _json_parser => ( + is => 'rw', + isa => 'JSON', + lazy => 1, + default => sub { JSON->new->allow_nonref }, +); + sub encode { my ($self, $content) = @_; - return JSON::encode_json($content); + $self->_json_parser->encode($content); } sub decode { my ($self, $content) = @_; - return JSON::decode_json($content); + $self->_json_parser->decode($content); } 1; -- cgit v1.2.3