.\" 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 .\" ======================================================================== .\" .IX Title "AnyEvent::FCGI::Request 3pm" .TH AnyEvent::FCGI::Request 3pm "2021-01-07" "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" AnyEvent::FCGI::Request \- a single FastCGI request handle for AnyEvent::FCGI .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& use AnyEvent; \& use AnyEvent::FCGI; \& use CGI::Stateless; \& \& my $fcgi = new AnyEvent::FCGI( \& port => 9000, \& on_request => sub { \& my $request = shift; \& \& local *STDIN; open STDIN, \*(Aq<\*(Aq, \e$request\->read_stdin; \& local %ENV = %{$request\->params}; \& local $CGI::Q = new CGI::Stateless; \& \& $request\->respond( \& \*(AqHello, \*(Aq . (CGI::param(\*(Aqname\*(Aq) || \*(Aqanonymous\*(Aq), \& \*(AqContent\-Type\*(Aq => \*(Aqtext/html; charset=utf8\*(Aq, \& \*(AqSet\-Cookie\*(Aq => \*(Aqcookie_a=1; path=/\*(Aq, \& \*(AqSet\-Cookie\*(Aq => \*(Aqcookie_b=2; path=/\*(Aq, \& ); \& } \& ); \& \& AnyEvent\->loop; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This is the request object as generated by AnyEvent::FCGI. When given to the controlling program, each request will already have its parameters and \s-1STDIN\s0 data. The program can then write response data to the \s-1STDOUT\s0 stream, messages to the \s-1STDERR\s0 stream, and eventually finish it. .PP This module would not be used directly by a program using \f(CW\*(C`AnyEvent::FCGI\*(C'\fR, but rather, objects in this class are passed into the \f(CW\*(C`on_request\*(C'\fR callback of the containing \f(CW\*(C`AnyEvent::FCGI\*(C'\fR object. .SH "METHODS" .IX Header "METHODS" .SS "is_active" .IX Subsection "is_active" Returns false if the webserver has already closed the control connection. No further work on this request is necessary, as it will be discarded. .PP This method can be used if response will not be sent immediately from \f(CW\*(C`on_request\*(C'\fR callback. .SS "param($key)" .IX Subsection "param($key)" This method returns the value of a single request parameter, or \f(CW\*(C`undef\*(C'\fR if no such key exists. .SS "params" .IX Subsection "params" This method returns a reference to a hash containing a copy of the request parameters that had been sent by the webserver as part of the request. .SS "read_stdin($size)" .IX Subsection "read_stdin($size)" This method works similarly to the \f(CW\*(C`read(HANDLE)\*(C'\fR function. It returns the next block of up to \f(CW$size\fR bytes from the \s-1STDIN\s0 buffer. If no data is available any more, then \f(CW\*(C`undef\*(C'\fR is returned instead. .SS "print_stdout($data)" .IX Subsection "print_stdout($data)" This method appends the given data to the \s-1STDOUT\s0 stream of the FastCGI request, sending it to the webserver to be sent to the client. .SS "print_stderr($data)" .IX Subsection "print_stderr($data)" This method appends the given data to the \s-1STDERR\s0 stream of the FastCGI request, sending it to the webserver. .SS "finish" .IX Subsection "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 \s-1STDOUT\s0 stream. .ie n .SS "respond($content, @headers)" .el .SS "respond($content, \f(CW@headers\fP)" .IX Subsection "respond($content, @headers)" This method sends the response to the webserver and finishes the request. \&\s-1HTTP\s0 reply code can be specified in \f(CW\*(C`Status\*(C'\fR header (200 by default). This method can be used instead of \f(CW\*(C`print_stdout\*(C'\fR and \f(CW\*(C`finish\*(C'\fR.