.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.48) .\" .\" 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 .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . 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 .\" .\" Required to disable full justification in groff 1.23.0. .if n .ds AD l .\" ======================================================================== .\" .IX Title "HTTP::Server::Simple::CGI 3" .TH HTTP::Server::Simple::CGI 3 2026-09-06 "perl v5.44.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 HTTP::Server::Simple::CGI \- CGI.pm\-style version of HTTP::Server::Simple .SH DESCRIPTION .IX Header "DESCRIPTION" HTTP::Server::Simple was already simple, but some smart\-ass pointed out that there is no CGI in HTTP, and so this module was born to isolate the CGI.pm\-related parts of this handler. .SS accept_hook .IX Subsection "accept_hook" The accept_hook in this sub\-class clears the environment to the start\-up state. .SS post_setup_hook .IX Subsection "post_setup_hook" Initializes the global CGI object, as well as other environment settings. .SS "cgi_class [Classname]" .IX Subsection "cgi_class [Classname]" Gets or sets the class to use for creating the \f(CW$cgi\fR object passed to \&\f(CW\*(C`handle_request\*(C'\fR. .PP Called with a single argument, it sets the coderef. Called with no arguments, it returns this field\*(Aqs current value. .PP To provide an initialization subroutine to be run in the post_setup_hook, see "cgi_init". .PP e.g. .PP .Vb 1 \& $server\->cgi_class(\*(AqCGI\*(Aq); \& \& $server\->cgi_init(sub { \& require CGI; \& CGI::initialize_globals(); \& }); .Ve .PP or, if you want to use CGI::Simple, .PP .Vb 4 \& $server\->cgi_class(\*(AqCGI::Simple\*(Aq); \& $server\->cgi_init(sub { \& require CGI::Simple; \& }); .Ve .SS "cgi_init [CODEREF]" .IX Subsection "cgi_init [CODEREF]" A coderef to run in the post_setup_hook. .PP Called with a single argument, it sets the coderef. Called with no arguments, it returns this field\*(Aqs current value. .SS setup .IX Subsection "setup" This method sets up CGI environment variables based on various meta\-headers, like the protocol, remote host name, request path, etc. .PP See the docs in HTTP::Server::Simple for more detail. .SS "handle_request CGI" .IX Subsection "handle_request CGI" This routine is called whenever your server gets a request it can handle. .PP It\*(Aqs called with a CGI object that\*(Aqs been pre\-initialized. You want to override this method in your subclass .SS handler .IX Subsection "handler" Handler implemented as part of HTTP::Server::Simple API