.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Net::Async::FastCGI 3pm" .TH Net::Async::FastCGI 3pm "2021-01-09" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" "Net::Async::FastCGI" \- use FastCGI with IO::Async .SH "SYNOPSIS" .IX Header "SYNOPSIS" As an adapter: .PP .Vb 2 \& use Net::Async::FastCGI; \& use IO::Async::Loop; \& \& my $loop = IO::Async::Loop\->new(); \& \& my $fastcgi = Net::Async::FastCGI\->new( \& on_request => sub { \& my ( $fastcgi, $req ) = @_; \& \& # Handle the request here \& } \& ); \& \& $loop\->add( $fastcgi ); \& \& $fastcgi\->listen( \& service => 1234, \& on_resolve_error => sub { die "Cannot resolve \- $_[\-1]\en" }, \& on_listen_error => sub { die "Cannot listen \- $_[\-1]\en" }, \& ); \& \& $loop\->run; .Ve .PP As a subclass: .PP .Vb 2 \& package MyFastCGIResponder; \& use base qw( Net::Async::FastCGI ); \& \& sub on_request \& { \& my $self = shift; \& my ( $req ) = @_; \& \& # Handle the request here \& } \& \& ... \& \& use IO::Async::Loop; \& \& my $loop = IO::Async::Loop\->new(); \& \& my $fastcgi; \& $loop\->add( $fastcgi = MyFastCGIResponder\->new( service => 1234 ) ); \& \& $fastcgi\->listen( \& service => 1234, \& on_resolve_error => sub { die "Cannot resolve \- $_[\-1]\en" }, \& on_listen_error => sub { die "Cannot listen \- $_[\-1]\en" }, \& ); \& \& $loop\->run; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module allows a program to respond asynchronously to FastCGI requests, as part of a program based on IO::Async. An object in this class represents a single FastCGI responder that the webserver is configured to communicate with. It can handle multiple outstanding requests at a time, responding to each as data is provided by the program. Individual outstanding requests that have been started but not yet finished, are represented by instances of Net::Async::FastCGI::Request. .SH "EVENTS" .IX Header "EVENTS" The following events are invoked, either using subclass methods or \s-1CODE\s0 references in parameters: .ie n .SS "on_request $req" .el .SS "on_request \f(CW$req\fP" .IX Subsection "on_request $req" Invoked when a new FastCGI request is received. It will be passed a new Net::Async::FastCGI::Request object. .SH "PARAMETERS" .IX Header "PARAMETERS" The following named parameters may be passed to \f(CW\*(C`new\*(C'\fR or \f(CW\*(C`configure\*(C'\fR: .IP "on_request => \s-1CODE\s0" 8 .IX Item "on_request => CODE" \&\s-1CODE\s0 references for \f(CW\*(C`on_request\*(C'\fR event handler. .IP "default_encoding => \s-1STRING\s0" 8 .IX Item "default_encoding => STRING" Sets the default encoding used by all new requests. If not supplied then \&\f(CW\*(C`UTF\-8\*(C'\fR will apply. .SH "METHODS" .IX Header "METHODS" .ie n .SS "$fcgi\->listen( %args )" .el .SS "\f(CW$fcgi\fP\->listen( \f(CW%args\fP )" .IX Subsection "$fcgi->listen( %args )" Start listening for connections on a socket, creating it first if necessary. .PP This method may be called in either of the following ways. To listen on an existing socket filehandle: .IP "handle => \s-1IO\s0" 4 .IX Item "handle => IO" An \s-1IO\s0 handle referring to a listen-mode socket. This is now deprecated; use the \f(CW\*(C`handle\*(C'\fR key to the \f(CW\*(C`new\*(C'\fR or \f(CW\*(C`configure\*(C'\fR methods instead. .PP Or, to create the listening socket or sockets: .IP "service => \s-1STRING\s0" 4 .IX Item "service => STRING" Port number or service name to listen on. .IP "host => \s-1STRING\s0" 4 .IX Item "host => STRING" Optional. If supplied, the hostname will be resolved into a set of addresses, and one listening socket will be created for each address. If not, then all available addresses will be used. .PP This method may also require \f(CW\*(C`on_listen_error\*(C'\fR or \f(CW\*(C`on_resolve_error\*(C'\fR callbacks for error handling \- see IO::Async::Listener for more detail. .SH "Limits in FCGI_GET_VALUES" .IX Header "Limits in FCGI_GET_VALUES" The \f(CW\*(C`FCGI_GET_VALUES\*(C'\fR FastCGI request can enquire of the responder the maximum number of connections or requests it can support. Because this module puts no fundamental limit on these values, it will return some arbitrary numbers. These are given in package variables: .PP .Vb 2 \& $Net::Async::FastCGI::MAX_CONNS = 1024; \& $Net::Async::FastCGI::MAX_REQS = 1024; .Ve .PP These variables are provided in case the containing application wishes to make the library return different values in the request. These values are not actually used by the library, other than to fill in the values in response of \&\f(CW\*(C`FCGI_GET_VALUES\*(C'\fR. .SH "Using a socket on STDIN" .IX Header "Using a socket on STDIN" When running a local FastCGI responder, the webserver will create a new \s-1INET\s0 socket connected to the script's \s-1STDIN\s0 file handle. To use the socket in this case, it should be passed as the \f(CW\*(C`handle\*(C'\fR argument. .SH "SEE ALSO" .IX Header "SEE ALSO" .IP "\(bu" 4 CGI::Fast \- Fast \s-1CGI\s0 drop-in replacement of \s-1CGI\s0; single-threaded, blocking mode. .IP "\(bu" 4 \- The Common Gateway Interface Specification .IP "\(bu" 4 \- FastCGI Specification .SH "AUTHOR" .IX Header "AUTHOR" Paul Evans