Rename --title to --proc_title as that makes more sense. Remove -t option as it's...
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Script / FastCGI.pm
CommitLineData
0ba6e8aa 1package Catalyst::Script::FastCGI;
2
cc999ce2 3BEGIN { $ENV{CATALYST_ENGINE} ||= 'FastCGI' }
cc999ce2 4use Moose;
4e45780e 5use MooseX::Types::Moose qw/Str Bool Int/;
2adf69c3 6use namespace::autoclean;
cc999ce2 7
d3082fac 8with 'Catalyst::ScriptRole';
f4dc8d2f 9
10has 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
18has 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 26has daemon => (
ad8b4c91 27 traits => [qw(Getopt)],
28 isa => Bool,
29 is => 'ro',
7388bcae 30 cmd_aliases => [qw/d detach/], # Eww, detach is here as we fucked it up.. Deliberately not documented
53c6ec79 31 documentation => 'Daemonize (go into the background)',
f4dc8d2f 32);
33
ab7eb5a9 34has 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 42has keeperr => (
ad8b4c91 43 traits => [qw(Getopt)],
44 cmd_aliases => 'e',
45 isa => Bool,
46 is => 'ro',
d3082fac 47 documentation => 'Log STDERR',
f4dc8d2f 48);
49
50has 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
8865ee12 58has proc_title => (
d44d2d8f 59 traits => [qw(Getopt)],
d44d2d8f 60 isa => Str,
61 is => 'ro',
62 documentation => 'Set the process title',
63);
64
d3082fac 65sub _application_args {
66 my ($self) = shift;
67 return (
cc999ce2 68 $self->listen,
57dc50b0 69 {
cc999ce2 70 nproc => $self->nproc,
71 pidfile => $self->pidfile,
72 manager => $self->manager,
e1d59dc4 73 detach => $self->daemon,
53c6ec79 74 keep_stderr => $self->keeperr,
8865ee12 75 proc_title => $self->proc_title,
57dc50b0 76 }
cc999ce2 77 );
cc999ce2 78}
79
73e4f0f1 80__PACKAGE__->meta->make_immutable;
81
d3082fac 82=head1 NAME
83
84Catalyst::Script::FastCGI - The FastCGI Catalyst Script
85
86=head1 SYNOPSIS
87
53c6ec79 88 myapp_fastcgi.pl [options]
89
90 Options:
8865ee12 91 -? --help display this help and exits
92 -l --listen Socket path to listen on
93 (defaults to standard input)
94 can be HOST:PORT, :PORT or a
95 filesystem path
96 -n --nproc specify number of processes to keep
97 to serve requests (defaults to 1,
98 requires -listen)
99 -p --pidfile specify filename for pid file
100 (requires -listen)
101 -d --daemon daemonize (requires -listen)
102 -M --manager specify alternate process manager
103 (FCGI::ProcManager sub-class)
104 or empty string to disable
105 -e --keeperr send error messages to STDOUT, not
106 to the webserver
107 --proc_title set the process title
d3082fac 108
109=head1 DESCRIPTION
110
53c6ec79 111Run a Catalyst application as fastcgi.
d3082fac 112
113=head1 AUTHORS
114
115Catalyst Contributors, see Catalyst.pm
116
117=head1 COPYRIGHT
118
119This library is free software. You can redistribute it and/or modify it under
120the same terms as Perl itself.
121
122=cut