Sam Vilain > PSA-0.49_01 > PSA::Acceptor::HTTP

Download:
PSA-0.49_01.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Source  

NAME ^

PSA::Acceptor::HTTP - raw HTTP acceptor for PSA applications

SYNOPSIS ^

 use PSA qw(Request::HTTP Acceptor::HTTP Response::HTTP);

 # defaults to port 80, or 8080 for users
 my $acceptor = PSA::Acceptor::HTTP->new();

 # note: this forks!
 while (my $request = $acceptor->get_request) {

     my $psa = PSA->new
         (acceptor => $acceptor,
          request => $request,
          response => PSA::Response::HTTP->new());

     # process $request

     if ($psa->response->is_template) {
         # issue template response
     } else {
         $psa->response->issue();
     }

 }

DESCRIPTION ^

PSA::Acceptor::HTTP cuts out the need for a web server for those situations where it is inconvenient to set one up, or for when you are using a braindead web server that doesn't support FastCGI.

Note that without root privileges you won't be able to listen on port 80 on Unix systems. To avoid this problem, when running as a user, the default port is 8080.

$acceptor->get_request

Returns a PSA::Request object, or undef if there are none.

$acceptor->output_fd

Returns the filehandle (either an IO::Handle or a ref GLOB) to write to to respond to this request

AUTHOR

Sam Vilain, <sv@snowcra.sh>