PApp::CGI - use PApp in a CGI environment


  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


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).


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-connection). The methods in this class are mostly identical to the methods supported by the connection object in the Apache module.


 Marc Lehmann <>