line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
use Moose; |
2
|
2
|
|
|
2
|
|
73284
|
use Data::OptList; |
|
2
|
|
|
|
|
470729
|
|
|
2
|
|
|
|
|
17
|
|
3
|
2
|
|
|
2
|
|
15429
|
use namespace::clean -except => [ 'meta' ]; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
18
|
|
4
|
2
|
|
|
2
|
|
678
|
|
|
2
|
|
|
|
|
6173
|
|
|
2
|
|
|
|
|
21
|
|
5
|
|
|
|
|
|
|
|
6
|
15
|
|
|
15
|
|
55
|
with 'Catalyst::ScriptRole'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has listen => ( |
9
|
|
|
|
|
|
|
traits => [qw(Getopt)], |
10
|
|
|
|
|
|
|
cmd_aliases => 'l', |
11
|
|
|
|
|
|
|
isa => 'Str', |
12
|
|
|
|
|
|
|
is => 'ro', |
13
|
|
|
|
|
|
|
documentation => 'Specify a listening port/socket', |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has pidfile => ( |
17
|
|
|
|
|
|
|
traits => [qw(Getopt)], |
18
|
|
|
|
|
|
|
cmd_aliases => [qw/pid p/], |
19
|
|
|
|
|
|
|
isa => 'Str', |
20
|
|
|
|
|
|
|
is => 'ro', |
21
|
|
|
|
|
|
|
documentation => 'Specify a pidfile', |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has daemon => ( |
25
|
|
|
|
|
|
|
traits => [qw(Getopt)], |
26
|
|
|
|
|
|
|
isa => 'Bool', |
27
|
|
|
|
|
|
|
is => 'ro', |
28
|
|
|
|
|
|
|
cmd_aliases => [qw/d detach/], # Eww, detach is here as we fucked it up.. Deliberately not documented |
29
|
|
|
|
|
|
|
documentation => 'Daemonize (go into the background)', |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has manager => ( |
33
|
|
|
|
|
|
|
traits => [qw(Getopt)], |
34
|
|
|
|
|
|
|
isa => 'Str', |
35
|
|
|
|
|
|
|
is => 'ro', |
36
|
|
|
|
|
|
|
cmd_aliases => 'M', |
37
|
|
|
|
|
|
|
documentation => 'Use a different FastCGI process manager class', |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
has keeperr => ( |
41
|
|
|
|
|
|
|
traits => [qw(Getopt)], |
42
|
|
|
|
|
|
|
cmd_aliases => 'e', |
43
|
|
|
|
|
|
|
isa => 'Bool', |
44
|
|
|
|
|
|
|
is => 'ro', |
45
|
|
|
|
|
|
|
documentation => 'Log STDERR', |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
has nproc => ( |
49
|
|
|
|
|
|
|
traits => [qw(Getopt)], |
50
|
|
|
|
|
|
|
cmd_aliases => 'n', |
51
|
|
|
|
|
|
|
isa => 'Int', |
52
|
|
|
|
|
|
|
is => 'ro', |
53
|
|
|
|
|
|
|
documentation => 'Specify a number of child processes', |
54
|
|
|
|
|
|
|
); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
has proc_title => ( |
57
|
|
|
|
|
|
|
traits => [qw(Getopt)], |
58
|
|
|
|
|
|
|
isa => 'Str', |
59
|
|
|
|
|
|
|
is => 'ro', |
60
|
|
|
|
|
|
|
lazy => 1, |
61
|
|
|
|
|
|
|
builder => '_build_proc_title', |
62
|
|
|
|
|
|
|
documentation => 'Set the process title', |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
my ($self) = @_; |
66
|
|
|
|
|
|
|
return sprintf 'perl-fcgi-pm [%s]', $self->application_name; |
67
|
|
|
|
|
|
|
} |
68
|
14
|
|
|
14
|
|
36
|
|
69
|
14
|
|
|
|
|
443
|
my ($self) = @_; |
70
|
|
|
|
|
|
|
$self->proc_title; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
15
|
|
|
15
|
0
|
338183
|
# Munge the 'listen' arg so that Plack::Handler::FCGI will accept it. |
74
|
15
|
|
|
|
|
522
|
my ($self) = @_; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
if (defined (my $listen = $self->listen)) { |
77
|
|
|
|
|
|
|
return [ $listen ]; |
78
|
|
|
|
|
|
|
} else { |
79
|
15
|
|
|
15
|
|
33
|
return undef; |
80
|
|
|
|
|
|
|
} |
81
|
15
|
100
|
|
|
|
425
|
} |
82
|
2
|
|
|
|
|
14
|
|
83
|
|
|
|
|
|
|
my ($self) = shift; |
84
|
13
|
|
|
|
|
86
|
|
85
|
|
|
|
|
|
|
my $opts = Data::OptList::mkopt([ |
86
|
|
|
|
|
|
|
qw/manager nproc proc_title/, |
87
|
|
|
|
|
|
|
pid => [ 'pidfile' ], |
88
|
|
|
|
|
|
|
daemonize => [ 'daemon' ], |
89
|
15
|
|
|
15
|
|
36
|
keep_stderr => [ 'keeperr' ], |
90
|
|
|
|
|
|
|
listen => [ '_listen' ], |
91
|
15
|
|
|
|
|
98
|
]); |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
my %args = map { $_->[0] => $self->${ \($_->[1] ? $_->[1]->[0] : $_->[0]) } } @$opts; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# Plack::Handler::FCGI thinks manager => undef means "use no manager". |
96
|
|
|
|
|
|
|
delete $args{'manager'} unless defined $args{'manager'}; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
return %args; |
99
|
15
|
100
|
|
|
|
1518
|
} |
|
105
|
|
|
|
|
177
|
|
|
105
|
|
|
|
|
2818
|
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
around _application_args => sub { |
102
|
15
|
100
|
|
|
|
55
|
my ($orig, $self) = @_; |
103
|
|
|
|
|
|
|
return ( |
104
|
15
|
|
|
|
|
165
|
$self->listen, |
105
|
|
|
|
|
|
|
{ |
106
|
|
|
|
|
|
|
%{ $self->$orig }, |
107
|
|
|
|
|
|
|
nproc => $self->nproc, |
108
|
|
|
|
|
|
|
pidfile => $self->pidfile, |
109
|
|
|
|
|
|
|
manager => $self->manager, |
110
|
|
|
|
|
|
|
detach => $self->daemon, |
111
|
|
|
|
|
|
|
keep_stderr => $self->keeperr, |
112
|
|
|
|
|
|
|
proc_title => $self->proc_title, |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
); |
115
|
|
|
|
|
|
|
}; |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
118
|
|
|
|
|
|
|
1; |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 NAME |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Catalyst::Script::FastCGI - The FastCGI Catalyst Script |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 SYNOPSIS |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
myapp_fastcgi.pl [options] |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Options: |
129
|
|
|
|
|
|
|
-? --help display this help and exits |
130
|
|
|
|
|
|
|
-l --listen Socket path to listen on |
131
|
|
|
|
|
|
|
(defaults to standard input) |
132
|
|
|
|
|
|
|
can be HOST:PORT, :PORT or a |
133
|
|
|
|
|
|
|
filesystem path |
134
|
|
|
|
|
|
|
-n --nproc specify number of processes to keep |
135
|
|
|
|
|
|
|
to serve requests (defaults to 1, |
136
|
|
|
|
|
|
|
requires -listen) |
137
|
|
|
|
|
|
|
-p --pidfile specify filename for pid file |
138
|
|
|
|
|
|
|
(requires -listen) |
139
|
|
|
|
|
|
|
-d --daemon daemonize (requires -listen) |
140
|
|
|
|
|
|
|
-M --manager specify alternate process manager |
141
|
|
|
|
|
|
|
(FCGI::ProcManager sub-class) |
142
|
|
|
|
|
|
|
or empty string to disable |
143
|
|
|
|
|
|
|
-e --keeperr send error messages to STDOUT, not |
144
|
|
|
|
|
|
|
to the webserver |
145
|
|
|
|
|
|
|
--proc_title set the process title |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 DESCRIPTION |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Run a Catalyst application as fastcgi. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head1 SEE ALSO |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
L<Catalyst::ScriptRunner> |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head1 AUTHORS |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Catalyst Contributors, see Catalyst.pm |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 COPYRIGHT |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
This library is free software. You can redistribute it and/or modify it under |
162
|
|
|
|
|
|
|
the same terms as Perl itself. |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=cut |