ite::Serializer::JSON;
use strict;
use base qw( RPC::Lite::Serializer );
use RPC::Lite::Request;
use RPC::Lite::Response;
use RPC::Lite::Notification;
use RPC::Lite::Error;
use JSON;
use Data::Dum
we support this serializer version
return 1;
}
sub GetVersion
{
my $self = shift;
return $JSON::VERSION;
}
sub Serialize
{
my $self = shift;
my $object = shift;
my $type = ref($objec
id => $object->{id},
};
}
else # try our best
{
# JSON should unbless this for us...
}
my $data = to_json( $object, { convert_blessed => 1 } );
$self->_Debug('Serializing',
necessary to communicate with clients.
=head1 SUPPORTED SERIALIZERS
=over 4
=item JSON (client default)
"JSON (JavaScript Object Notation) is a lightweight data-interchange format.
It is easy for
JavaScript Programming Language,
Standard ECMA-262 3rd Edition - December 1999."
-- http://www.json.org/
=item XML
"Extensible Markup Language (XML) is a simple, very flexible text format
derived
RPC::Lite::Error;
use RPC::Lite::Notification;
use Data::Dumper;
our $DEFAULTSERIALIZER = 'JSON';
=pod
=head1 NAME
RPC::Lite::Client - Lightweight RPC client framework.
=head1 SYNOP
t->new(
{
Transport => 'TCP:Host=blah.foo.com,Port=10000',
Serializer => 'JSON', # JSON is actually the default,
# this argument is unnecessary
}
e = shift @{ $self->MessageQueue() };
# handshake string examples:
#
# RPC-Lite 1.0 / JSON 1.1
# RPC-Lite 2.2 / XML 3.2
if ( $message !~ /^RPC-Lite (.*?) \/ (.*?) (.*?)$/ )
{
.3:10000 via TCP and use the JSON serializer.
my $client = RPC::Lite::Client->new(
{
Transport => 'TCP:Host=192.168.0.3,Port=10000',
Serializer => 'JSON',
}
);
# print