From: Andrew Rodland Date: Mon, 24 Jan 2011 19:57:47 +0000 (+0000) Subject: Beat the args handling in Script::FastCGI into working condition. X-Git-Tag: 5.89001~17 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=f06d7696927be5f9d5d35da22c001b083b543d68 Beat the args handling in Script::FastCGI into working condition. --- diff --git a/lib/Catalyst/Script/FastCGI.pm b/lib/Catalyst/Script/FastCGI.pm index a67aa57..1b2a2e9 100644 --- a/lib/Catalyst/Script/FastCGI.pm +++ b/lib/Catalyst/Script/FastCGI.pm @@ -75,15 +75,33 @@ 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/pidfile manager nproc proc_title/, + detach => [ '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 {