Help-Site Computer Manuals
Software
Hardware
Programming
Networking
  Algorithms & Data Structures   Programming Languages   Revision Control
  Protocols
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac

FCGI::Async
Module to allow use of FastCGI asynchronously

FCGI::Async - Module to allow use of FastCGI asynchronously


NAME

FCGI::Async - Module to allow use of FastCGI asynchronously


SYNOPSIS

This module allows a program to respond to FastCGI requests using an asynchronous model. It is based on the IO::Async manpage and will fully interact with any program using this base.


 use FCGI::Async;

 use IO::Async::Set::IO_Poll;

 my $fcgi = FCGI::Async->new(

    on_request => sub {

       my ( $fcgi, $req ) = @_;

       # Handle the request here

    }

 );

 my $set = IO::Async::Set::IO_Poll->new();

 $set->add( $fcgi );

 $set->loop_forever;

$fcgi = FCGI::Async->new( %args )

This function returns a new instance of a FCGI::Async object, containing a master socket to listen on. The constructor returns immediately; it does not make any blocking calls.

The function operates in one of three ways, depending on arguments passed in the %args hash:

  • Listening on an existing socket.
    
     socket => $socket

    This must be a socket opened in listening mode, derived from IO::Socket, or any other class that handles the fileno and accept methods in a similar way.

  • Creating a new listening socket.
    
     port => $port

    A new IO::Socket::INET socket will be opened on the given port number. It will listen on all interfaces, from all addresses.

  • Using the socket passed as STDIN from a webserver.

    When running a local FastCGI responder, the webserver will create a new INET socket connected to the script's STDIN file handle. To use the socket in this case, pass neither of the above options.

The %args hash must also contain a CODE reference to a callback function to call when a new FastCGI request arrives


 on_request => sub { ... }

or


 on_request => \&handler

This will be passed two parameters; the FCGI::Async container object, and a new FCGI::Async::Request object representing the specific request.


 $on_request->( $fcgi, $request )


SEE ALSO


AUTHOR

Paul Evans <leonerd@leonerd.org.uk>

Programminig
Wy
Wy
yW
Wy
Programming
Wy
Wy
Wy
Wy