cleaned up
[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;
2adf69c3 8use namespace::autoclean;
cc999ce2 9
10with 'MooseX::Getopt';
11
d9a32f71 12has help => ( isa => 'Bool', is => 'ro', required => 0 );
cc999ce2 13has listen => ( isa => 'Int', is => 'ro', required => 1 );
14has pidfile => ( isa => 'Str', is => 'ro', required => 0 );
d9a32f71 15has daemon => ( isa => 'Bool', is => 'ro', required => 0 );
cc999ce2 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 );
d9a32f71 19has detach => ( isa => 'Bool', is => 'ro', required => 0 );
20has _app => (
21 reader => 'app',
22 init_arg => 'app',
23 traits => [qw(NoGetopt)],
24 isa => 'Str',
25 is => 'ro',
26);
cc999ce2 27
28sub run {
29 my $self = shift;
57dc50b0 30
cc999ce2 31 pod2usage() if $self->help;
32 my $app = $self->app;
33 Class::MOP::load_class($app);
335130bc 34 $app->run(
cc999ce2 35 $self->listen,
57dc50b0 36 {
cc999ce2 37 nproc => $self->nproc,
38 pidfile => $self->pidfile,
39 manager => $self->manager,
40 detach => $self->detach,
41 keep_stderr => $self->keep_stderr,
57dc50b0 42 }
cc999ce2 43 );
44
45}
46
0ba6e8aa 471;