From: jshirley Date: Wed, 9 Jul 2008 18:18:00 +0000 (+0000) Subject: Changing from JSON::Syck to JSON and JSON::XS X-Git-Tag: 1.08~255 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Action-Serialize-Data-Serializer.git;a=commitdiff_plain;h=ebba5325fd49e3ac305d8fe68de36430b6d07bb4 Changing from JSON::Syck to JSON and JSON::XS --- diff --git a/Changelog b/Changelog index 1e1efe9..8a025e9 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,7 @@ +Wed Jul 09 11:16:00 PST 2008 (jshirley) - Release 0.63 + Changing from JSON::Syck to JSON/JSON::XS + Refactored tests to be more applicable to current state of affairs + Wed Jul 02 07:53:00 PST 2008 (jshirley) - Release 0.62 Reshipping with current Module::Install included due to error reports about failed installs diff --git a/Makefile.PL b/Makefile.PL index 70297f9..f5609ce 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -15,6 +15,11 @@ requires('Class::Inspector' => '1.13'); requires('URI::Find' => undef); requires('Data::Dump' => undef); +feature 'JSON (application/json) support', + -default => 0, + 'JSON' => undef; + 'JSON::XS' => undef; + feature 'Data::Denter (text/x-data-denter) support', -default => 0, 'Data::Denter' => undef; diff --git a/lib/Catalyst/Action/Deserialize/JSON.pm b/lib/Catalyst/Action/Deserialize/JSON.pm index 82002df..f4bf2e4 100644 --- a/lib/Catalyst/Action/Deserialize/JSON.pm +++ b/lib/Catalyst/Action/Deserialize/JSON.pm @@ -11,7 +11,7 @@ use strict; use warnings; use base 'Catalyst::Action'; -use JSON::Syck; +use JSON qw( decode_json ); sub execute { my $self = shift; @@ -27,7 +27,7 @@ sub execute { } if ( $rbody ) { - my $rdata = eval { JSON::Syck::Load( $rbody ); }; + my $rdata = eval { decode_json( $rbody ) }; if ($@) { return $@; } diff --git a/lib/Catalyst/Action/REST.pm b/lib/Catalyst/Action/REST.pm index 9b20e55..72ff6c4 100644 --- a/lib/Catalyst/Action/REST.pm +++ b/lib/Catalyst/Action/REST.pm @@ -14,10 +14,12 @@ use base 'Catalyst::Action'; use Class::Inspector; use Catalyst; use Catalyst::Request::REST; +use Catalyst::Controller::REST; + use 5.8.1; our - $VERSION = '0.62'; + $VERSION = $Catalyst::Controller::REST::VERSION; # This is wrong in several ways. First, there's no guarantee that # Catalyst.pm has not been subclassed. Two, there's no guarantee that diff --git a/lib/Catalyst/Action/Serialize/JSON.pm b/lib/Catalyst/Action/Serialize/JSON.pm index 2a65e2c..9e34a26 100644 --- a/lib/Catalyst/Action/Serialize/JSON.pm +++ b/lib/Catalyst/Action/Serialize/JSON.pm @@ -11,7 +11,7 @@ use strict; use warnings; use base 'Catalyst::Action'; -use JSON::Syck; +use JSON qw(encode_json); sub execute { my $self = shift; @@ -24,7 +24,7 @@ sub execute { ) || 'rest'; my $output; eval { - $output = JSON::Syck::Dump($c->stash->{$stash_key}); + $output = encode_json( $c->stash->{$stash_key} ); }; if ($@) { return $@; diff --git a/lib/Catalyst/Controller/REST.pm b/lib/Catalyst/Controller/REST.pm index ef954a7..a44849d 100644 --- a/lib/Catalyst/Controller/REST.pm +++ b/lib/Catalyst/Controller/REST.pm @@ -1,6 +1,6 @@ package Catalyst::Controller::REST; -our $VERSION = 0.62; +our $VERSION = 0.63; =head1 NAME