[32205] | 1 | package Mojolicious::Command::cgi;
|
---|
| 2 | use Mojo::Base 'Mojolicious::Command';
|
---|
| 3 |
|
---|
| 4 | use Mojo::Server::CGI;
|
---|
| 5 | use Mojo::Util 'getopt';
|
---|
| 6 |
|
---|
| 7 | has description => 'Start application with CGI';
|
---|
| 8 | has usage => sub { shift->extract_usage };
|
---|
| 9 |
|
---|
| 10 | sub run {
|
---|
| 11 | my ($self, @args) = @_;
|
---|
| 12 | getopt \@args, nph => \(my $nph = 0);
|
---|
| 13 | Mojo::Server::CGI->new(app => $self->app, nph => $nph)->run;
|
---|
| 14 | }
|
---|
| 15 |
|
---|
| 16 | 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>
|
---|
| 41 | backend.
|
---|
| 42 |
|
---|
| 43 | This is a core command, that means it is always enabled and its code a good
|
---|
| 44 | example for learning to build new commands, you're welcome to fork it.
|
---|
| 45 |
|
---|
| 46 | See L<Mojolicious::Commands/"COMMANDS"> for a list of commands that are
|
---|
| 47 | available by default.
|
---|
| 48 |
|
---|
| 49 | =head1 ATTRIBUTES
|
---|
| 50 |
|
---|
| 51 | L<Mojolicious::Command::cgi> inherits all attributes from
|
---|
| 52 | L<Mojolicious::Command> and implements the following new ones.
|
---|
| 53 |
|
---|
| 54 | =head2 description
|
---|
| 55 |
|
---|
| 56 | my $description = $cgi->description;
|
---|
| 57 | $cgi = $cgi->description('Foo');
|
---|
| 58 |
|
---|
| 59 | Short description of this command, used for the command list.
|
---|
| 60 |
|
---|
| 61 | =head2 usage
|
---|
| 62 |
|
---|
| 63 | my $usage = $cgi->usage;
|
---|
| 64 | $cgi = $cgi->usage('Foo');
|
---|
| 65 |
|
---|
| 66 | Usage information for this command, used for the help screen.
|
---|
| 67 |
|
---|
| 68 | =head1 METHODS
|
---|
| 69 |
|
---|
| 70 | L<Mojolicious::Command::cgi> inherits all methods from L<Mojolicious::Command>
|
---|
| 71 | and implements the following new ones.
|
---|
| 72 |
|
---|
| 73 | =head2 run
|
---|
| 74 |
|
---|
| 75 | $cgi->run(@ARGV);
|
---|
| 76 |
|
---|
| 77 | Run this command.
|
---|
| 78 |
|
---|
| 79 | =head1 SEE ALSO
|
---|
| 80 |
|
---|
| 81 | L<Mojolicious>, L<Mojolicious::Guides>, L<https://mojolicious.org>.
|
---|
| 82 |
|
---|
| 83 | =cut
|
---|