Factor stuff out into a script role, clean up all the script code
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Script / FastCGI.pm
1 package Catalyst::Script::FastCGI;
2
3 BEGIN { $ENV{CATALYST_ENGINE} ||= 'FastCGI' }
4 use Moose;
5 use MooseX::Types::Moose qw/Str Bool Int/;
6 use namespace::autoclean;
7
8 with 'Catalyst::ScriptRole';
9
10 has listen => (
11     cmd_aliases => 'l',
12     isa => Int,
13     is => 'ro',
14     documentation => 'Specify a listening port/socket',
15 );
16
17 has pidfile => (
18     cmd_aliases => 'pid',
19     isa => Str,
20     is => 'ro',
21     documentation => 'Specify a pidfile',
22 );
23
24 has daemon => ( 
25     isa => Bool,   
26     is => 'ro', 
27     cmd_aliases => 'd', 
28     documentation => 'Daemonize',
29 );
30
31 has manager => ( 
32     isa => Str,    
33     is => 'ro',
34     cmd_aliases => 'm',
35     documentation => 'Use a different FastCGI manager', # FIXME
36 );
37
38 has keep_stderr => ( 
39     cmd_aliases => 'std', 
40     isa => Bool,   
41     is => 'ro',  
42     documentation => 'Log STDERR',
43 );
44
45 has nproc => (
46     cmd_aliases => 'np',  
47     isa => Int,
48     is => 'ro',  
49     documentation => 'Specify an nproc', # FIXME
50 );
51
52 has detach => ( 
53     cmd_aliases => 'det', 
54     isa => Bool,   
55     is => 'ro',  
56     documentation => 'Detach this FastCGI process',
57 );
58
59 sub _application_args {
60     my ($self) = shift;
61     return (
62         $self->listen,
63         {
64             nproc   => $self->nproc,
65             pidfile => $self->pidfile,
66             manager => $self->manager,
67             detach  => $self->detach,
68             keep_stderr => $self->keep_stderr,
69         }
70     );
71 }
72
73 __PACKAGE__->meta->make_immutable;
74
75 =head1 NAME
76
77 Catalyst::Script::FastCGI - The FastCGI Catalyst Script
78
79 =head1 SYNOPSIS
80
81 See L<Catalyst>.
82
83 =head1 DESCRIPTION
84
85 FIXME
86
87 =head1 AUTHORS
88
89 Catalyst Contributors, see Catalyst.pm
90
91 =head1 COPYRIGHT
92
93 This library is free software. You can redistribute it and/or modify it under
94 the same terms as Perl itself.
95
96 =cut