1 package Catalyst::Script::FastCGI;
3 use MooseX::Types::Moose qw/Str Bool Int/;
5 use namespace::autoclean;
7 sub _plack_engine_name { 'FCGI' }
9 with 'Catalyst::ScriptRole';
12 traits => [qw(Getopt)],
16 documentation => 'Specify a listening port/socket',
20 traits => [qw(Getopt)],
21 cmd_aliases => [qw/pid p/],
24 documentation => 'Specify a pidfile',
28 traits => [qw(Getopt)],
31 cmd_aliases => [qw/d detach/], # Eww, detach is here as we fucked it up.. Deliberately not documented
32 documentation => 'Daemonize (go into the background)',
36 traits => [qw(Getopt)],
40 documentation => 'Use a different FastCGI process manager class',
44 traits => [qw(Getopt)],
48 documentation => 'Log STDERR',
52 traits => [qw(Getopt)],
56 documentation => 'Specify a number of child processes',
60 traits => [qw(Getopt)],
64 builder => '_build_proc_title',
65 documentation => 'Set the process title',
68 sub _build_proc_title {
70 return sprintf 'perl-fcgi-pm [%s]', $self->application_name;
78 sub _plack_loader_args {
81 map { $_->[0] => $self->${ \($_->[1] ? $_->[1]->[0] : $_->[0]) } }
82 Data::OptList::mkopt([
83 qw/pidfile listen manager nproc keep_stderr proc_title/,
84 detach => [ 'daemon' ],
89 sub _application_args {
94 nproc => $self->nproc,
95 pidfile => $self->pidfile,
96 manager => $self->manager,
97 detach => $self->daemon,
98 keep_stderr => $self->keeperr,
99 proc_title => $self->proc_title,
104 __PACKAGE__->meta->make_immutable;
108 Catalyst::Script::FastCGI - The FastCGI Catalyst Script
112 myapp_fastcgi.pl [options]
115 -? --help display this help and exits
116 -l --listen Socket path to listen on
117 (defaults to standard input)
118 can be HOST:PORT, :PORT or a
120 -n --nproc specify number of processes to keep
121 to serve requests (defaults to 1,
123 -p --pidfile specify filename for pid file
125 -d --daemon daemonize (requires -listen)
126 -M --manager specify alternate process manager
127 (FCGI::ProcManager sub-class)
128 or empty string to disable
129 -e --keeperr send error messages to STDOUT, not
131 --proc_title set the process title
135 Run a Catalyst application as fastcgi.
139 Catalyst Contributors, see Catalyst.pm
143 This library is free software. You can redistribute it and/or modify it under
144 the same terms as Perl itself.