kage JSON::RPC2;
use 5.010001;
use warnings;
use strict;
use utf8;
use Carp;
our $VERSION = 'v2.1.3';
1; # Magic true value required at end of module
__END__
=encoding utf8
=head1 NAME
JSON::RPC
t-independent implementation of JSON-RPC 2.0
=head1 VERSION
This document describes JSON::RPC2 version v2.1.3
=head1 SYNOPSIS
See L<JSON::RPC2::Server> and L<JSON::RPC2::Client> for usage exampl
es.
=head1 DESCRIPTION
This module implement JSON-RPC 2.0 protocol in transport-independent way.
It was very surprising for me to find on CPAN a lot of transport-dependent
implementations of (by na
package JSON::RPC2::Server;
use 5.010001;
use warnings;
use strict;
use utf8;
use Carp;
our $VERSION = 'v2.1.3';
use JSON::MaybeXS;
use constant ERR_PARSE => -32700;
use constant ERR_REQ => -32
elf, $json, $cb) = @_;
croak 'require 2 params' if 1+2 != @_;
croak 'second param must be callback' if ref $cb ne 'CODE';
undef $@;
my $request = ref $json ? $json : eval { JSON::Mayb
eXS->new(allow_nonref=>0)->decode($json) };
if ($@) {
return _error($cb, undef, ERR_PARSE, 'Parse error.');
}
if (ref $request eq 'HASH') {
return $self->_execute($request,
package JSON::RPC2::Client;
use 5.010001;
use warnings;
use strict;
use utf8;
use Carp;
our $VERSION = 'v2.1.3';
use JSON::MaybeXS;
use Scalar::Util qw( weaken refaddr );
sub new {
my ($class)
$method, @params) = @_;
croak 'method required' if !defined $method;
return encode_json({
jsonrpc => '2.0',
method => $method,
(!@params ? () : (
param
number of elements in %params' if @params % 2;
my %params = @params;
return encode_json({
jsonrpc => '2.0',
method => $method,
(!@params ? () : (
param