NAME
PApp::CGI - use PApp in a CGI environment
SYNOPSIS
use PApp::CGI;
# initialize request and do initialization
init PApp::CGI and PApp::config_eval {
configure PApp ...;
$handler = mount_app "admin";
configured PApp;
};
# then for each request do
&$handler;
DESCRIPTION
This module can be used to run PApp applications in CGI environments e.g. using CGI::SpeedyCGI or plain CGI. The startup-penalty for PApp is immense (a second or so) and is dominated by compilation time, so while PApp is usable with "pure" CGI in some applications a CGI-Accelerator that keeps application in memory is certainly recommended.
The $PApp::request
-object (as returned by new <PApp::CGI::Request>) is mostly compatible to Apache, except for missing methods (which could be added quite easily on request).
Functions
The PApp::CGI Class
This class only contains one user-visible-method: init
.
- $first = init PApp::CGI [@args]
-
This method should be called once for each request, to initialize the request structure. It also checks wether this is the first request served by this process and returns true. For all subsequent requests it returns false. This can be used to configure PApp once.
The PApp::CGI::Request Class
This class implements the $request
object required by a PApp handler. The methods in this class are mostly identical to the methods supported by the Apache module.
- internal_redirect "relative-url"
-
This expands the relative url into an absolute one and generates an external redirect.
- send_fd $filehandle
-
Reads file/pipe/whatever specified with
$filehandle
(not a fd!) and outputs it until it is exhausted.
The PApp::CGI::Connection Class
This class implements the connection object returned by $request-
conenction). The methods in this class are mostly identical to the methods supported by the conenction object in the Apache module.
AUTHOR
Marc Lehmann <schmorp@schmorp.de>
http://home.schmorp.de/