NAME

FCGI::Async::Request - Class to represent one active FastCGI request

SYNOPSIS

This module would not be used directly by a program using FCGI::Async, but rather, objects in this class would be obtained by the waitingreq() method:

 my $fcgi = FCGI::Async->new();
 while( 1 ) {
    $fcgi->select();
    while( my $req = $fcgi->waitingreq ) {
       my $path = $req->param( "PATH_INFO" );
       $req->print_stdout( "HTTP/1.0 200 OK\r\n" .
                           "Content-type: text/plain\r\n" .
                           "\r\n" .
                           "You requested $path" );
       $req->finish();
    }
 }

FUNCTIONS

$fd = $req->fileno

This method returns the file descriptor for the socket underlying this particular FastCGI request.

%p = $req->params

This method returns a copy of the hash of request parameters that had been sent by the webserver as part of the request.

$p = $req->param( $key )

This method returns the value of a single request parameter, or undef if no such key exists.

$isready = $req->ready

This method returns a true when the request is ready to be processed; i.e., that the complete state has been streamed from the webserver.

$line = $req->read_stdin_line

This method works similarly to the <HANDLE> operator. If at least one line of data is available then it is returned, including the linefeed, and removed from the buffer. If not, then any remaining partial line is returned and removed from the buffer. If no data is available any more, then undef is returned instead.

$req->print_stdout( $data )

This method appends the given data to the STDOUT stream of the FastCGI request, sending it to the webserver to be sent to the client.

$req->finish

When the request has been dealt with, this method should be called to indicate to the webserver that it is finished. After calling this method, no more data may be appended to the STDOUT stream. At some point after calling this method, the request object will be removed from the containing FCGI::Async object, once all the buffered outbound data has been sent.

$req->pre_select( $readref, $writeref, $exceptref, $timeref )

This method is used by the corresponding method in FCGI::Async to interact with the containing program's select() loop. It should not be used directly.

$req->post_select( $readvec, $writevec, $exceptvec )

This method is used by the corresponding method in FCGI::Async to interact with the containing program's select() loop. It should not be used directly.