1Mojo::Server::CGI(3)  User Contributed Perl Documentation Mojo::Server::CGI(3)
2
3
4

NAME

6       Mojo::Server::CGI - CGI server
7

SYNOPSIS

9         use Mojo::Server::CGI;
10
11         my $cgi = Mojo::Server::CGI->new;
12         $cgi->unsubscribe('request')->on(request => sub ($cgi, $tx) {
13
14           # Request
15           my $method = $tx->req->method;
16           my $path   = $tx->req->url->path;
17
18           # Response
19           $tx->res->code(200);
20           $tx->res->headers->content_type('text/plain');
21           $tx->res->body("$method request for $path!");
22
23           # Resume transaction
24           $tx->resume;
25         });
26         $cgi->run;
27

DESCRIPTION

29       Mojo::Server::CGI is a simple and portable implementation of RFC 3875
30       <https://tools.ietf.org/html/rfc3875>.
31
32       See "DEPLOYMENT" in Mojolicious::Guides::Cookbook for more.
33

EVENTS

35       Mojo::Server::CGI inherits all events from Mojo::Server.
36

ATTRIBUTES

38       Mojo::Server::CGI inherits all attributes from Mojo::Server and
39       implements the following new ones.
40
41   nph
42         my $bool = $cgi->nph;
43         $cgi     = $cgi->nph($bool);
44
45       Activate non-parsed header mode.
46

METHODS

48       Mojo::Server::CGI inherits all methods from Mojo::Server and implements
49       the following new ones.
50
51   run
52         my $status = $cgi->run;
53
54       Run CGI.
55

SEE ALSO

57       Mojolicious, Mojolicious::Guides, <https://mojolicious.org>.
58
59
60
61perl v5.36.0                      2022-07-22              Mojo::Server::CGI(3)
Impressum