Group
Extension

Matches 4

JSON-RPC2-AnyEvent ( Y/YA/YANOTHER/JSON-RPC2-AnyEvent-0.03.tar.gz, YANOTHER, 2020; MetaCPAN )
JSON-RPC2-AnyEvent/lib/JSON/RPC2/AnyEvent.pm ( view source; MetaCPAN )
package JSON::RPC2::AnyEvent;

our $VERSION = "0.03";

use JSON::RPC2::AnyEvent::Server;

1;
__END__

=encoding utf-8

=head1 NAME

JSON::RPC2::AnyEvent - Yet-another, transport-independent and asynch
ronous JSON-RPC 2.0 implementation

=head1 SYNOPSIS

    use JSON::RPC2::AnyEvent::Server;

    my $srv = JSON::RPC2::AnyEvent::Server->new(
        hello => "[family_name, first_name]" => sub{
      
= $srv->dispatch({
        jsonrpc => "2.0",
        id      => 1,
        method  => 'hello',
        params  => [qw(Sogoru Kyo)],
    });
    my $res = $cv->recv;  # { jsonrpc => "2.0", id => 1, res
JSON-RPC2-AnyEvent ( Y/YA/YANOTHER/JSON-RPC2-AnyEvent-0.03.tar.gz, YANOTHER, 2020; MetaCPAN )
JSON-RPC2-AnyEvent/lib/JSON/RPC2/AnyEvent/Server/Handle.pm ( view source; MetaCPAN )
package JSON::RPC2::AnyEvent::Server::Handle;
use 5.010;
use strict;
use warnings;

our $VERSION = "0.03";

use AnyEvent::Handle;
use Carp qw(croak);
use Errno ();
use JSON;
use Scalar::Util qw(blesse
e openhandle);

use JSON::RPC2::AnyEvent::Server;
use JSON::RPC2::AnyEvent::Constants qw(ERR_PARSE_ERROR);


sub new {
    my ($class, $srv, $hdl) = @_;
    
    croak "Not an JSON::RPC2::AnyEvent::Se
rver object: $srv"  unless blessed $srv && $srv->isa('JSON::RPC2::AnyEvent::Server');
    
    unless ( blessed $hdl && $hdl->isa('AnyEvent::Handle') ) {
        $hdl = openhandle $hdl  or croak "Neit
JSON-RPC2-AnyEvent ( Y/YA/YANOTHER/JSON-RPC2-AnyEvent-0.03.tar.gz, YANOTHER, 2020; MetaCPAN )
JSON-RPC2-AnyEvent/lib/JSON/RPC2/AnyEvent/Server.pm ( view source; MetaCPAN )
package JSON::RPC2::AnyEvent::Server;
use 5.010;
use strict;
use warnings;

our $VERSION = "0.03";

use AnyEvent;
use Carp 'croak';
use Scalar::Util 'reftype';
use Try::Tiny;

use JSON::RPC2::AnyEvent
lf = shift;
    my $json = shift;
    my $ret_cv = AE::cv;
    try{
        my $type = _check_format($json);  # die when $json's format is invalid
        my $method = $self->{$json->{method}};
      
  unless ( $method ) {  # Method not found
            $ret_cv->send(_make_error_response($json->{id}, ERR_METHOD_NOT_FOUND, 'Method not found'));
            return $ret_cv;
        }
        if ( $t
JSON-RPC2-AnyEvent ( Y/YA/YANOTHER/JSON-RPC2-AnyEvent-0.03.tar.gz, YANOTHER, 2020; MetaCPAN )
JSON-RPC2-AnyEvent/lib/JSON/RPC2/AnyEvent/Constants.pm ( view source; MetaCPAN )
package JSON::RPC2::AnyEvent::Constants;
use 5.010;
use strict;
use warnings;


my %constants;
BEGIN{
    # Based upon JSON-RPC spec 2.0 - http://www.jsonrpc.org/specification
    %constants = (
     
valid JSON was received by the server.
                                         # An error occurred on the server while parsing the JSON text.
        ERR_INVALID_REQUEST  => -32600,  # The JSON sent 
   => -32602,  # Invalid method parameter(s).
        ERR_INTERNAL_ERROR   => -32603,  # Internal JSON-RPC error.
        ERR_SERVER_ERROR     => -32000,  # -32000 to -32099: Reserved for implementati

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.