JSON::RPC::Server::FastCGI - A FastCGI version of JSON::RPC::Server


JSON-RPC-Server-FastCGI documentation Contained in the JSON-RPC-Server-FastCGI distribution.

Index


Code Index:

NAME

Top

JSON::RPC::Server::FastCGI - A FastCGI version of JSON::RPC::Server

VERSION

Top

Version 0.03

SYNOPSIS

Top

	use JSON::RPC::Server::FastCGI;
    use lib 'libs/'; # you could put your handler modules here

    # If you want to use an 'External' FastCGI Server:
    # $ENV{FCGI_SOCKET_PATH} = "elsewhere:8888";

	my $server = JSON::RPC::Server::FastCGI->new;
    $server->dispatch_to('MyApp')->handle();

CONSTRUCTOR

Top

new

Creates a server. All that needs to be done is call dispatch (or dispatch_to) followed by $server->handle().

OVERRIDDEN METHODS

Top

handle

This is exactly the same as $server->handle, except that it uses an instance of CGI::Fast instead of CGI.

cgi

Returns the CGI::Fast object associated with this server.

METHODS

Top

    Pretty much the same as JSON::RPC::Server;
    (See L<http://search.cpan.org/~makamaka/JSON-RPC/lib/JSON/RPC.pm>)




AUTHOR

Top

Faiz Kazi, <faiz at cpan.org>

BUGS

Top

Please report any bugs or feature requests to bug-json-rpc-server-fastcgi at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=JSON-RPC-Server-FastCGI. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc JSON::RPC::Server::FastCGI




You can also look for information at:

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=JSON-RPC-Server-FastCGI

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/JSON-RPC-Server-FastCGI

* CPAN Ratings

http://cpanratings.perl.org/d/JSON-RPC-Server-FastCGI

* Search CPAN

http://search.cpan.org/dist/JSON-RPC-Server-FastCGI

ACKNOWLEDGEMENTS

Top

COPYRIGHT & LICENSE

Top


JSON-RPC-Server-FastCGI documentation Contained in the JSON-RPC-Server-FastCGI distribution.
package JSON::RPC::Server::FastCGI;

use warnings;
use strict;
use CGI::Fast;
use base qw(JSON::RPC::Server::CGI);

our $VERSION = '0.03';

# We cannot use the direct parent method (JSON::RPC::Server::CGI::new);
# though we are a subclass of JSON::RPC::Server::CGI, we cannot
# invoke it's constructor since it is per-request, and FastCGI is not.
# That's why we just use the more general grand-parent constructor.
sub new {
    my $self  = JSON::RPC::Server::new(@_);
    $self;
}

sub handle {
    my $self = shift;
	my $cgi;
	while ($cgi = new CGI::Fast) {
		$self->request( HTTP::Request->new($cgi->request_method, $cgi->url) );
		$self->{_cgi} = $cgi;
		$self->SUPER::handle();
	}
}

sub cgi {
    my $self = shift;
	return $self->{_cgi};
}


1; # End of JSON::RPC::Server::FastCGI