Apache2::JSONRPC::Session - Dispatcher class for session aware JSONRPC Objects
package MyDispatch;
use Apache2::JSONRPC::Session; use base qw(Apache2::JSONRPC::Session);
# optional custom session rebuild sub init_session { my ($class,%args) = @_; # ... regenerate session $args{session} = $session; return %args; }
The ::Session portions of CGI::JSONRPC are unmaintained and may change or disappear without notice (probably change...)
Apache2::JSONRPC::Dispatcher receives JSONRPC class method calls and translates them into perl object method calls. Here's how it works:
This package works exactly the same as the Apache2::JSONRPC package with the exception that it calls it's method init_session prior to dispatching the call. You should use this method to rebuild the users session.
init_session
Refer the the Apache2::JSONRPC for a full discussion of this API, only the extentions to that interface will be discusses here.
Will be called from the constructor just prior to creating the dispatcher object. %arguments contains the arguments passed into the dispatch or new method and should be modified and returned as the resulting hash will be blessed and returned from new. Rebuild sessions should be stored into the passed hash with the key session.
%arguments
dispatch
new
session
Note that the request object should alreday be stored into the %arguments variable for your use in rebuilding the session.
Tyler "Crackerjack" MacDonald <japh@crackerjack.net> and David Labatte <buggyd@justanotherperlhacker.com>
Copyright 2006 Tyler "Crackerjack" MacDonald <japh@crackerjack.net>
This is free software; You may distribute it under the same terms as perl itself.
The "examples/httpd.conf" file bundled with the distribution shows how to create a new JSONRPC::Dispatcher-compatible class, and also shows a rather hacky method for making an existing class accessable from JSON.
Apache2::JSONRPC
To install CGI::JSONRPC, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CGI::JSONRPC
CPAN shell
perl -MCPAN -e shell install CGI::JSONRPC
For more information on module installation, please visit the detailed CPAN module installation guide.