X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine%2FFastCGI.pm;h=2eb34cda3ad34ca7e3a0bee1ea00d16755927c44;hb=6f409682667c23a00552d0573c157ee3487c29bc;hp=469d5dcc46327f9a34b4ea98b323db2995a0bd95;hpb=8f753f10fd2366d43eef630f40b6ba876d1e9ed5;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine/FastCGI.pm b/lib/Catalyst/Engine/FastCGI.pm index 469d5dc..2eb34cd 100644 --- a/lib/Catalyst/Engine/FastCGI.pm +++ b/lib/Catalyst/Engine/FastCGI.pm @@ -2,7 +2,8 @@ package Catalyst::Engine::FastCGI; use strict; use base 'Catalyst::Engine::CGI'; -use FCGI; +eval "use FCGI"; +die "Please install FCGI\n" if $@; =head1 NAME @@ -37,6 +38,7 @@ Options may also be specified; interrupted by Ctrl+C nproc Specify a number of processes for FCGI::ProcManager + pidfile Specify a filename for the pid file =cut @@ -61,7 +63,7 @@ sub run { } $options ||= {}; - + my %env; my $request = @@ -71,10 +73,17 @@ sub run { my $proc_manager; - if ( $listen and ( $options->{nproc} || 1 ) > 1 ) { + if ($listen) { require FCGI::ProcManager; + $options->{nproc} ||= 1; + $proc_manager = FCGI::ProcManager->new( { n_processes => $options->{nproc} } ); + + if ( $options->{pidfile} ) { + $proc_manager->pm_write_pid_file( $options->{pidfile} ); + } + $proc_manager->pm_manage(); }