http://localhost:8080/?method=/math/simple/add¶ms=[2,2]
# and get back a response
{ "jsonrpc" : "2.0", "result" : 2 }
## compile your own Javascript client
## library for use in a we
goal of this module is to provide a cleaner and more formalized
way to do AJAX programming using JSON-RPC in the flavor of Object
Request Brokers.
=head2 FUTURE PLANS
Currently this is more focused
ithInvocant;
use Moose;
our $VERSION = '0.04';
our $AUTHORITY = 'cpan:STEVAN';
use JSORB;
use JSON::RPC::Common::Marshal::HTTP;
extends 'Catalyst::Action';
sub execute {
my $self = shift;
her - $dispatcher (must inherit JSORB::Dispatcher::Catalyst::WithInvocant)";
my $marshaler = JSON::RPC::Common::Marshal::HTTP->new;
my $call = $marshaler->request_to_call($c->request);
$self, $call, @args) = @_;
(blessed $call && $call->isa('JSON::RPC::Common::Procedure::Call'))
|| confess "You must pass a JSON::RPC::Common::Procedure::Call to the handler, not $call";
use Moose;
use HTTP::Server::Simple;
use HTTP::Request;
use HTTP::Response;
use Try::Tiny;
use JSON::RPC::Common::Marshal::HTTP;
our $VERSION = '0.04';
our $AUTHORITY = 'cpan:STEVAN';
with 'Moo
has 'request_marshaler' => (
is => 'ro',
isa => 'JSON::RPC::Common::Marshal::HTTP',
default => sub {
JSON::RPC::Common::Marshal::HTTP->new
},
);
has 'handler' => (
lt_to_response($result);
} catch {
# NOTE:
# should this return a JSONRPC error?
# or is the standard HTTP Error okay?
# - SL
HTTP::
tion::JSORB;
use Moose;
our $VERSION = '0.04';
our $AUTHORITY = 'cpan:STEVAN';
use JSORB;
use JSON::RPC::Common::Marshal::HTTP;
extends 'Catalyst::Action';
sub execute {
my $self = shift;
s "Bad dispatcher - $dispatcher (must inherit JSORB::Dispatcher::Catalyst)";
my $marshaler = JSON::RPC::Common::Marshal::HTTP->new;
my $call = $marshaler->request_to_call($c->request);
package JSORB::Server::Traits::WithDebug;
use Moose::Role;
use Text::SimpleTable;
use JSON ();
our $VERSION = '0.04';
our $AUTHORITY = 'cpan:STEVAN';
around 'build_handler' => sub {
my $next
ext::SimpleTable->new(15, 55);
$t3->row(
'Response' => JSON->new->pretty(1)->encode(
JSON->new->decode(
$response->content
)
'
=> where {
# these are the types of things that cannot be
# serialized into JSON so will be neither arguments
# or return values in our RPC environment.
($_->is_a
xpRef, GlobRef and Object. This is
primarily because these types are not easily serialziable with
JSON. Below is the type tree that JSORB supports and is
recommended.
Unit
Any
Item
Bo