File tree Expand file tree Collapse file tree 6 files changed +16
-15
lines changed Expand file tree Collapse file tree 6 files changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -2,12 +2,12 @@ requires 'CGI';
22requires ' Class::Accessor::Lite' ;
33requires ' HTTP::Request' ;
44requires ' HTTP::Response' ;
5- requires ' JSON' ;
5+ requires ' JSON::MaybeXS ' ;
66requires ' LWP::UserAgent' ;
77requires ' Plack' ;
88requires ' Router::Simple' ;
99requires ' parent' ;
10- recommends ' JSON::XS' ;
10+ recommends ' Cpanel:: JSON::XS' ;
1111
1212on build => sub {
1313 requires ' ExtUtils::MakeMaker' , ' 6.36' ;
Original file line number Diff line number Diff line change 44# #############################################################################
55
66use strict;
7- use JSON () ;
7+ use JSON::MaybeXS ' JSON ' ;
88use Carp ();
99
1010# #############################################################################
@@ -62,7 +62,7 @@ sub AUTOLOAD {
6262
6363
6464sub create_json_coder {
65- JSON-> new-> allow_nonref-> utf8;
65+ JSON() -> new-> allow_nonref-> utf8;
6666}
6767
6868
@@ -349,9 +349,9 @@ Setter/getter to L<LWP::UserAgent> object.
349349=item json
350350
351351Setter/getter to the JSON coder object.
352- Default is L<JSON> , likes this:
352+ The default is the backend returned by L<JSON::MaybeXS > , created like this:
353353
354- $self->json( JSON->new->allow_nonref->utf8 );
354+ $self->json( JSON() ->new->allow_nonref->utf8 );
355355
356356 $json = $self->json;
357357
Original file line number Diff line number Diff line change 44# #############################################################################
55
66use strict;
7- use JSON ();
87use Carp ();
98
109use HTTP::Request ();
@@ -14,6 +13,7 @@ use HTTP::Response ();
1413# #############################################################################
1514
1615package JSON::RPC::Legacy::Server ;
16+ use JSON::MaybeXS ' JSON' ;
1717
1818my $JSONRPC_Procedure_Able ;
1919
@@ -43,7 +43,7 @@ BEGIN {
4343
4444
4545sub create_json_coder {
46- JSON-> new-> utf8; # assumes UTF8
46+ JSON() -> new-> utf8; # assumes UTF8
4747}
4848
4949
@@ -569,9 +569,9 @@ An error code number in your procedure is an integer between 501 and 899.
569569=item json
570570
571571Setter/Getter to json encoder/decoder object.
572- The default value is L<JSON> object in the below way :
572+ The default value is a JSON serializer object as returned by L<JSON::MaybeXS> in the following manner :
573573
574- JSON->new->utf8
574+ JSON() ->new->utf8
575575
576576In your procedure, changes its behaviour.
577577
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ use warnings;
33use Test::More;
44use Plack::Test;
55use HTTP::Request;
6- use JSON;
6+ use JSON::MaybeXS ;
77
88BEGIN {
99 use_ok " JSON::RPC::Dispatch" ;
@@ -28,7 +28,7 @@ subtest 'defaults' => sub {
2828};
2929
3030subtest ' normal dispatch' => sub {
31- my $coder = JSON-> new;
31+ my $coder = JSON() -> new;
3232 my $router = Router::Simple-> new;
3333 $router -> connect ( blowup => {
3434 handler => " Sum" ,
Original file line number Diff line number Diff line change 11use strict;
22use Test::More;
33use Plack::Request;
4- use JSON;
4+ use JSON::MaybeXS ' to_json ' , ' JSON ' ;
55
66use_ok " JSON::RPC::Parser" ;
77use_ok " JSON::RPC::Procedure" ;
@@ -12,7 +12,7 @@ subtest 'basic' => sub {
1212 REQUEST_METHOD => " GET" ,
1313 } );
1414 my $parser = JSON::RPC::Parser-> new(
15- coder => JSON-> new,
15+ coder => JSON() -> new,
1616 );
1717
1818 my $procedure = $parser -> construct_from_req( $req );
Original file line number Diff line number Diff line change @@ -8,7 +8,8 @@ my $server = JSON::RPC::Legacy::Server->new;
88
99isa_ok($server , ' JSON::RPC::Legacy::Server' );
1010
11- isa_ok($server -> json, ' JSON' );
11+ my $json_backend = JSON::MaybeXS::JSON();
12+ isa_ok($server -> json, $json_backend );
1213
1314my $test = JSON::RPC::Legacy::Server::Test-> new;
1415
You can’t perform that action at this time.
0 commit comments