Commit | Line | Data |
0ba6e8aa |
1 | package Catalyst::Script::FastCGI; |
2 | |
cc999ce2 |
3 | BEGIN { $ENV{CATALYST_ENGINE} ||= 'FastCGI' } |
cc999ce2 |
4 | use Moose; |
4e45780e |
5 | use MooseX::Types::Moose qw/Str Bool Int/; |
2adf69c3 |
6 | use namespace::autoclean; |
cc999ce2 |
7 | |
d3082fac |
8 | with 'Catalyst::ScriptRole'; |
f4dc8d2f |
9 | |
10 | has listen => ( |
ad8b4c91 |
11 | traits => [qw(Getopt)], |
12 | cmd_aliases => 'l', |
13 | isa => Str, |
14 | is => 'ro', |
d3082fac |
15 | documentation => 'Specify a listening port/socket', |
f4dc8d2f |
16 | ); |
17 | |
18 | has pidfile => ( |
ad8b4c91 |
19 | traits => [qw(Getopt)], |
ad08ab75 |
20 | cmd_aliases => [qw/pid p/], |
ad8b4c91 |
21 | isa => Str, |
22 | is => 'ro', |
d3082fac |
23 | documentation => 'Specify a pidfile', |
f4dc8d2f |
24 | ); |
25 | |
ab7eb5a9 |
26 | has daemon => ( |
ad8b4c91 |
27 | traits => [qw(Getopt)], |
28 | isa => Bool, |
29 | is => 'ro', |
30 | cmd_aliases => 'd', |
53c6ec79 |
31 | documentation => 'Daemonize (go into the background)', |
f4dc8d2f |
32 | ); |
33 | |
ab7eb5a9 |
34 | has manager => ( |
ad8b4c91 |
35 | traits => [qw(Getopt)], |
36 | isa => Str, |
37 | is => 'ro', |
38 | cmd_aliases => 'M', |
53c6ec79 |
39 | documentation => 'Use a different FastCGI process manager class', |
f4dc8d2f |
40 | ); |
41 | |
53c6ec79 |
42 | has keeperr => ( |
ad8b4c91 |
43 | traits => [qw(Getopt)], |
44 | cmd_aliases => 'e', |
45 | isa => Bool, |
46 | is => 'ro', |
d3082fac |
47 | documentation => 'Log STDERR', |
f4dc8d2f |
48 | ); |
49 | |
50 | has nproc => ( |
ad8b4c91 |
51 | traits => [qw(Getopt)], |
52 | cmd_aliases => 'n', |
53 | isa => Int, |
54 | is => 'ro', |
53c6ec79 |
55 | documentation => 'Specify a number of child processes', |
f4dc8d2f |
56 | ); |
57 | |
d3082fac |
58 | sub _application_args { |
59 | my ($self) = shift; |
60 | return ( |
cc999ce2 |
61 | $self->listen, |
57dc50b0 |
62 | { |
cc999ce2 |
63 | nproc => $self->nproc, |
64 | pidfile => $self->pidfile, |
65 | manager => $self->manager, |
e1d59dc4 |
66 | detach => $self->daemon, |
53c6ec79 |
67 | keep_stderr => $self->keeperr, |
57dc50b0 |
68 | } |
cc999ce2 |
69 | ); |
cc999ce2 |
70 | } |
71 | |
73e4f0f1 |
72 | __PACKAGE__->meta->make_immutable; |
73 | |
d3082fac |
74 | =head1 NAME |
75 | |
76 | Catalyst::Script::FastCGI - The FastCGI Catalyst Script |
77 | |
78 | =head1 SYNOPSIS |
79 | |
53c6ec79 |
80 | myapp_fastcgi.pl [options] |
81 | |
82 | Options: |
ad8b4c91 |
83 | -? --help display this help and exits |
84 | -l --listen Socket path to listen on |
85 | (defaults to standard input) |
86 | can be HOST:PORT, :PORT or a |
87 | filesystem path |
88 | -n --nproc specify number of processes to keep |
89 | to serve requests (defaults to 1, |
90 | requires -listen) |
91 | -p --pidfile specify filename for pid file |
92 | (requires -listen) |
93 | -d --daemon daemonize (requires -listen) |
94 | -M --manager specify alternate process manager |
95 | (FCGI::ProcManager sub-class) |
96 | or empty string to disable |
97 | -e --keeperr send error messages to STDOUT, not |
98 | to the webserver |
d3082fac |
99 | |
100 | =head1 DESCRIPTION |
101 | |
53c6ec79 |
102 | Run a Catalyst application as fastcgi. |
d3082fac |
103 | |
104 | =head1 AUTHORS |
105 | |
106 | Catalyst Contributors, see Catalyst.pm |
107 | |
108 | =head1 COPYRIGHT |
109 | |
110 | This library is free software. You can redistribute it and/or modify it under |
111 | the same terms as Perl itself. |
112 | |
113 | =cut |