added a test application to get the new scripts working
[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::clean -except => [ qw(meta) ];
9
10 with 'MooseX::Getopt';
11
12 has help        => ( isa => 'Bool',   is => 'ro', required => 0, default => sub { 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, default => sub { 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, default => sub { 0 } );
20 has app         => ( isa => 'Str',    is => 'ro', required => 1 );
21
22 sub run {
23     my $self = shift;
24     
25     pod2usage() if $self->help;
26     my $app = $self->app;
27     Class::MOP::load_class($app);
28     $app->new(
29         $self->listen,
30         {  
31             nproc   => $self->nproc,
32             pidfile => $self->pidfile,
33             manager => $self->manager,
34             detach  => $self->detach,
35             keep_stderr => $self->keep_stderr,
36         }  
37     );
38
39 }
40
41 1;