NAME

JSONRPC::Transport::HTTP

SYNOPSIS

#--------------------------
# In your application class
package MyApp;

sub own_method { # called by clients
    my ($server, @params) = @_; # $server is JSONRPC object.
    ...
    # return a scalar value or a hashref or an arryaref.
}

#--------------------------
# In your main cgi script.
use JSONRPC::Transport::HTTP;
use MyApp;

# a la XMLRPC::Lite
JSONRPC::Transport::HTTP::CGI->dispatch_to('MyApp')->handle();

DESCRIPTION

This module is JSONRPC subclass. Most ideas were borrowed from XMLRPC::Lite. Currently JSONRPC provides only CGI server function.

CHARSET

When the module returns response, its charset is UTF-8 by default. You can change it via passing a key/value pair into handle().

my %charset = (charset => 'EUC-JP');
JSONRPC::Transport::HTTP::CGI->dispatch_to('MyApp')->handle(%charset);

QUERY OBJECT

If you want to use any other query object instead of CGI for JSONRPC::Transport::HTTP::CGI, you can pass query option and paramName.

my %opt = (
  query     => $session, # CGI::Session object
  paramName => 'json',
);

JSONRPC::Transport::HTTP::CGI->dispatch_to('MyApp')->handle(%opt);

CAUTION

JSONRPC::Transport::HTTP::CGI requires CGI.pm which version is more than 2.9.2. (the core module in Perl 5.8.1.)

SEE ALSO

JSONRPC JSON XMLRPC::Lite http://json-rpc.org/

AUTHOR

Makamaka Hannyaharamitu, <makamaka[at]cpan.org>

COPYRIGHT AND LICENSE

Copyright 2005 by Makamaka Hannyaharamitu

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.