X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FScript%2FFastCGI.pm;h=ba6ab9bfda85e5cf9fc28b2f7663ba04a59e1085;hb=15c40696c8e1e840553573af61037032cc16768d;hp=a67aa5709a591b79e2fb030ee034bc0af7ae82ed;hpb=182f8b1e3c426d62337e186c2409c555794152d7;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Script/FastCGI.pm b/lib/Catalyst/Script/FastCGI.pm index a67aa57..ba6ab9b 100644 --- a/lib/Catalyst/Script/FastCGI.pm +++ b/lib/Catalyst/Script/FastCGI.pm @@ -75,22 +75,42 @@ sub BUILD { $self->proc_title; } +# Munge the 'listen' arg so that Plack::Handler::FCGI will accept it. +sub _listen { + my ($self) = @_; + + if (defined (my $listen = $self->listen)) { + return [ $listen ]; + } else { + return undef; + } +} + sub _plack_loader_args { my ($self) = shift; - return ( - map { $_->[0] => $self->${ \($_->[1] ? $_->[1]->[0] : $_->[0]) } } - Data::OptList::mkopt([ - qw/pidfile listen manager nproc keep_stderr proc_title/, - detach => [ 'daemon' ], - ]) - ); + + my $opts = Data::OptList::mkopt([ + qw/manager nproc proc_title/, + pid => [ 'pidfile' ], + daemonize => [ 'daemon' ], + keep_stderr => [ 'keeperr' ], + listen => [ '_listen' ], + ]); + + my %args = map { $_->[0] => $self->${ \($_->[1] ? $_->[1]->[0] : $_->[0]) } } @$opts; + + # Plack::Handler::FCGI thinks manager => undef means "use no manager". + delete $args{'manager'} unless defined $args{'manager'}; + + return %args; } -sub _application_args { - my ($self) = shift; +around _application_args => sub { + my ($orig, $self) = @_; return ( $self->listen, { + %{ $self->$orig }, nproc => $self->nproc, pidfile => $self->pidfile, manager => $self->manager, @@ -99,9 +119,10 @@ sub _application_args { proc_title => $self->proc_title, } ); -} +}; __PACKAGE__->meta->make_immutable; +1; =head1 NAME @@ -134,6 +155,10 @@ Catalyst::Script::FastCGI - The FastCGI Catalyst Script Run a Catalyst application as fastcgi. +=head1 SEE ALSO + +L + =head1 AUTHORS Catalyst Contributors, see Catalyst.pm