Server::JSONRPC;
use strict;
use warnings;
use base qw/Class::Accessor::Fast/;
our $VERSION = '0.05';
use POE qw/
Filter::Line
/;
use JSON;
=head1 NAME
POE::Component::Server::JSONRPC - PO
E tcp or http based JSON-RPC server
=head1 SYNOPSIS
#http version:
POE::Component::Server::JSONRPC::Http->new(
Port => 3000,
Handler => {
'echo' => 'echo',
Server::JSONRPC::Tcp->new(
Port => 3000,
Handler => {
'echo' => 'echo',
'sum' => 'sum',
},
);
sub echo {
my ($kernel, $jsonrpc, $id
ackage POE::Component::Server::JSONRPC::Http;
use strict;
use warnings;
use POE::Component::Server::JSONRPC; # for old Perl 5.005
use base qw(POE::Component::Server::JSONRPC);
our $VERSION = '0.03';
::Server::SimpleHTTP
Filter::Line
/;
use JSON::Any;
use Data::Dumper;
=head1 NAME
POE::Component::Server::JSONRPC::Http - POE http based JSON-RPC server
=head2 new
constructor
=cut
sub n
($self, $kernel, $session, $heap) = @_[OBJECT, KERNEL, SESSION, HEAP];
$kernel->alias_set( 'JSONRPCHTTP' );
if (defined($self->{Authenticate})) {
$kernel->state('http_input_handler'
:Server::JSONRPC::Tcp;
use strict;
use warnings;
use base qw(POE::Component::Server::JSONRPC);
our $VERSION = '0.01';
use POE qw/
Component::Server::TCP
Filter::Line
/;
use JSON::Any;
=
head1 NAME
POE::Component::Server::JSONRPC::Tcp - POE tcp based JSON-RPC server
=head2 new
constructor
=cut
sub new {
my $self = shift->SUPER::new( @_ > 1 ? {@_} : $_[0] );
return $self;
}