X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FScript%2FFastCGI.pm;h=9ef4f63bc347e6d6a364fd1a3b866305ac8b4115;hb=80a909c28a951c5f2a9a98ab673c4c0a295b6988;hp=0c1bffdebe50bd486c5871a188b0cd6970ddf937;hpb=0ba6e8aaafec7621c9444f470a849bd161f176e0;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Script/FastCGI.pm b/lib/Catalyst/Script/FastCGI.pm index 0c1bffd..9ef4f63 100644 --- a/lib/Catalyst/Script/FastCGI.pm +++ b/lib/Catalyst/Script/FastCGI.pm @@ -1,3 +1,41 @@ package Catalyst::Script::FastCGI; +BEGIN { $ENV{CATALYST_ENGINE} ||= 'FastCGI' } +use FindBin qw/$Bin/; +use lib "$Bin/../lib"; +use Pod::Usage; +use Moose; +use namespace::autoclean -except => [ qw(meta) ]; + +with 'MooseX::Getopt'; + +has help => ( isa => 'Bool', is => 'ro', required => 0, default => sub { 0 } ); +has listen => ( isa => 'Int', is => 'ro', required => 1 ); +has pidfile => ( isa => 'Str', is => 'ro', required => 0 ); +has daemon => ( isa => 'Bool', is => 'ro', required => 0, default => sub { 0 } ); +has manager => ( isa => 'Str', is => 'ro', required => 0 ); +has keep_stderr => ( isa => 'Bool', is => 'ro', required => 0 ); +has nproc => ( isa => 'Int', is => 'ro', required => 0 ); +has detach => ( isa => 'Bool', is => 'ro', required => 0, default => sub { 0 } ); +has app => ( isa => 'Str', is => 'ro', required => 1 ); + +sub run { + my $self = shift; + + pod2usage() if $self->help; + my $app = $self->app; + Class::MOP::load_class($app); + $app->run( + $self->listen, + { + nproc => $self->nproc, + pidfile => $self->pidfile, + manager => $self->manager, + detach => $self->detach, + keep_stderr => $self->keep_stderr, + } + ); + +} + 1;