cleaned up
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Script / FastCGI.pm
1 package Catalyst::Script::FastCGI;
2
3 BEGIN { $ENV{CATALYST_ENGINE} ||= 'FastCGI' }
4 use FindBin qw/$Bin/;
5 use lib "$Bin/../lib";
6 use Pod::Usage;
7 use Moose;
8 use namespace::autoclean;
9
10 with 'MooseX::Getopt';
11
12 has help        => ( isa => 'Bool',   is => 'ro', required => 0 );
13 has listen      => ( isa => 'Int',    is => 'ro', required => 1 );
14 has pidfile     => ( isa => 'Str',    is => 'ro', required => 0 );
15 has daemon      => ( isa => 'Bool',   is => 'ro', required => 0 );
16 has manager     => ( isa => 'Str',    is => 'ro', required => 0 );
17 has keep_stderr => ( isa => 'Bool',   is => 'ro', required => 0 );
18 has nproc       => ( isa => 'Int',    is => 'ro', required => 0 );
19 has detach      => ( isa => 'Bool',   is => 'ro', required => 0 );
20 has _app => (
21     reader   => 'app',
22     init_arg => 'app',
23     traits => [qw(NoGetopt)],
24     isa => 'Str',
25     is => 'ro',
26 );
27
28 sub run {
29     my $self = shift;
30
31     pod2usage() if $self->help;
32     my $app = $self->app;
33     Class::MOP::load_class($app);
34     $app->run(
35         $self->listen,
36         {
37             nproc   => $self->nproc,
38             pidfile => $self->pidfile,
39             manager => $self->manager,
40             detach  => $self->detach,
41             keep_stderr => $self->keep_stderr,
42         }
43     );
44
45 }
46
47 1;