| 1 | package Mojolicious::Command::cgi; | ||||||||||
| 2 | 1 | ▶ | use Mojo::Base 'Mojolicious::Command'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | 1 | ▶ | use Mojo::Server::CGI; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use Mojo::Util qw(getopt); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 1 | has description => 'Start application with CGI'; | |||||||||
| 8 | 1 | ▶ | has usage => sub { shift->extract_usage }; | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | sub run { | ||||||||
|
Subroutine
run: called CC=2 SCAR=8.1
Pod
documented
| |||||||||||
| 11 | 1 | my ($self, @args) = @_; | |||||||||
| 12 | 1 | ▶ | die $self->usage unless getopt \@args, nph => \(my $nph = 0); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 13 | 0 | Mojo::Server::CGI->new(app => $self->app, nph => $nph)->run; | |||||||||
| 14 | } | ||||||||||
| 15 | |||||||||||
| 16 | 1 | 1; | |||||||||
| 17 | |||||||||||
| 18 | =encoding utf8 | ||||||||||
| 19 | |||||||||||
| 20 | =head1 NAME | ||||||||||
| 21 | |||||||||||
| 22 | Mojolicious::Command::cgi - CGI command | ||||||||||
| 23 | |||||||||||
| 24 | =head1 SYNOPSIS | ||||||||||
| 25 | |||||||||||
| 26 | Usage: APPLICATION cgi [OPTIONS] | ||||||||||
| 27 | |||||||||||
| 28 | ./myapp.pl cgi | ||||||||||
| 29 | |||||||||||
| 30 | Options: | ||||||||||
| 31 | -h, --help Show this summary of available options | ||||||||||
| 32 | --home <path> Path to home directory of your application, defaults to | ||||||||||
| 33 | the value of MOJO_HOME or auto-detection | ||||||||||
| 34 | -m, --mode <name> Operating mode for your application, defaults to the | ||||||||||
| 35 | value of MOJO_MODE/PLACK_ENV or "development" | ||||||||||
| 36 | --nph Enable non-parsed-header mode | ||||||||||
| 37 | |||||||||||
| 38 | =head1 DESCRIPTION | ||||||||||
| 39 | |||||||||||
| 40 | L<Mojolicious::Command::cgi> starts applications with the L<Mojo::Server::CGI> backend. | ||||||||||
| 41 | |||||||||||
| 42 | This is a core command, that means it is always enabled and its code a good example for learning to build new commands, | ||||||||||
| 43 | you're welcome to fork it. | ||||||||||
| 44 | |||||||||||
| 45 | See L<Mojolicious::Commands/"COMMANDS"> for a list of commands that are available by default. | ||||||||||
| 46 | |||||||||||
| 47 | =head1 ATTRIBUTES | ||||||||||
| 48 | |||||||||||
| 49 | L<Mojolicious::Command::cgi> inherits all attributes from L<Mojolicious::Command> and implements the following new | ||||||||||
| 50 | ones. | ||||||||||
| 51 | |||||||||||
| 52 | =head2 description | ||||||||||
| 53 | |||||||||||
| 54 | my $description = $cgi->description; | ||||||||||
| 55 | $cgi = $cgi->description('Foo'); | ||||||||||
| 56 | |||||||||||
| 57 | Short description of this command, used for the command list. | ||||||||||
| 58 | |||||||||||
| 59 | =head2 usage | ||||||||||
| 60 | |||||||||||
| 61 | my $usage = $cgi->usage; | ||||||||||
| 62 | $cgi = $cgi->usage('Foo'); | ||||||||||
| 63 | |||||||||||
| 64 | Usage information for this command, used for the help screen. | ||||||||||
| 65 | |||||||||||
| 66 | =head1 METHODS | ||||||||||
| 67 | |||||||||||
| 68 | L<Mojolicious::Command::cgi> inherits all methods from L<Mojolicious::Command> and implements the following new ones. | ||||||||||
| 69 | |||||||||||
| 70 | =head2 run | ||||||||||
| 71 | |||||||||||
| 72 | $cgi->run(@ARGV); | ||||||||||
| 73 | |||||||||||
| 74 | Run this command. | ||||||||||
| 75 | |||||||||||
| 76 | =head1 SEE ALSO | ||||||||||
| 77 | |||||||||||
| 78 | L<Mojolicious>, L<Mojolicious::Guides>, L<https://mojolicious.org>. | ||||||||||
| 79 | |||||||||||
| 80 | =cut | ||||||||||