cleaned up sub runner
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Script / FastCGI.pm
CommitLineData
0ba6e8aa 1package Catalyst::Script::FastCGI;
2
cc999ce2 3BEGIN { $ENV{CATALYST_ENGINE} ||= 'FastCGI' }
4use FindBin qw/$Bin/;
5use lib "$Bin/../lib";
6use Pod::Usage;
7use Moose;
4ebd5ecf 8use namespace::autoclean -except => [ qw(meta) ];
cc999ce2 9
10with 'MooseX::Getopt';
11
12has help => ( isa => 'Bool', is => 'ro', required => 0, default => sub { 0 } );
13has listen => ( isa => 'Int', is => 'ro', required => 1 );
14has pidfile => ( isa => 'Str', is => 'ro', required => 0 );
15has daemon => ( isa => 'Bool', is => 'ro', required => 0, default => sub { 0 } );
16has manager => ( isa => 'Str', is => 'ro', required => 0 );
17has keep_stderr => ( isa => 'Bool', is => 'ro', required => 0 );
18has nproc => ( isa => 'Int', is => 'ro', required => 0 );
19has detach => ( isa => 'Bool', is => 'ro', required => 0, default => sub { 0 } );
20has app => ( isa => 'Str', is => 'ro', required => 1 );
21
22sub run {
23 my $self = shift;
24
25 pod2usage() if $self->help;
26 my $app = $self->app;
27 Class::MOP::load_class($app);
335130bc 28 $app->run(
cc999ce2 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
0ba6e8aa 411;