File Coverage

blib/lib/Mojolicious/Command/cgi.pm
Criterion Covered Total %
statement 12 12 100.0
branch 2 2 100.0
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 19 19 100.0


line stmt bran cond sub pod time code
1             package Mojolicious::Command::cgi;
2 2     2   507 use Mojo::Base 'Mojolicious::Command';
  2         5  
  2         12  
3              
4 2     2   675 use Mojo::Server::CGI;
  2         6  
  2         14  
5 2     2   14 use Mojo::Util qw(getopt);
  2         4  
  2         392  
6              
7             has description => 'Start application with CGI';
8             has usage => sub { shift->extract_usage };
9              
10             sub run {
11 10     10 1 32 my ($self, @args) = @_;
12 10 100       43 die $self->usage unless getopt \@args, nph => \(my $nph = 0);
13 9         44 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 to home directory of your application, defaults to
33             the value of MOJO_HOME or auto-detection
34             -m, --mode 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 starts applications with the L 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 for a list of commands that are available by default.
46              
47             =head1 ATTRIBUTES
48              
49             L inherits all attributes from L 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 inherits all methods from L 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, L, L.
79              
80             =cut