expand backend documentation
[perl/plp/.git] / PLP / Backend / FastCGI.pm
index 8ee326172d1fa8dcfb114ed9aab9f9befc26e29d..85a5234b75cbc325fe8455ca832c188a9513d0f4 100644 (file)
@@ -6,11 +6,15 @@ use PLP::Backend::CGI;
 use FCGI;
 use base 'PLP::Backend::CGI';
 
-our $VERSION = '1.00';
+our $VERSION = '1.01';
 
 sub import {
        my $self = shift;
        my $request = FCGI::Request();
+       $SIG{TERM} = sub {
+               $request->LastCall();
+       };
+       $SIG{PIPE} = 'IGNORE';
        while ($request->Accept() >= 0) {
                $PLP::use_cache = !defined $ENV{PLP_CACHE} || $ENV{PLP_CACHE}; # before it's clean()ed
                delete $ENV{PATH_TRANSLATED};
@@ -46,8 +50,8 @@ Example F</foo/bar/plp.fcgi>:
     #!/usr/bin/perl
     use PLP::Backend::FastCGI;
 
-Then enable either I<mod_fastcgi> or I<mod_fcgid>, and setup F<httpd.conf>
-(often just create a F</etc/apache2/conf.d/plp>) with:
+Then enable either I<mod_fcgid> (recommended) or I<mod_fastcgi>, and
+setup F<httpd.conf> (in new installs just create F</etc/apache/conf.d/plp>) with:
 
     <IfModule mod_fastcgi.c>
         AddHandler fastcgi-script plp
@@ -59,11 +63,35 @@ Then enable either I<mod_fastcgi> or I<mod_fcgid>, and setup F<httpd.conf>
         FCGIWrapper /foo/bar/plp.fcgi .plp
     </IfModule>
 
+=head1 DESCRIPTION
+
+This is usually the preferred backend, providing persistent processes
+for speeds comparable to L<mod_perl|PLP::Backend::Apache> and
+reliability closer to L<CGI|PLP::Backend::CGI>.
+
+Servers often feature auto-adjusting number of daemons, script timeouts,
+and occasional restarts.
+
+=head2 Configuration directives
+
+PLP behaviour can be configured by setting environment variables.
+
+=over 16
+
+=item PLP_CACHE
+
+Sets caching off if false (0 or empty), on otherwise (true or undefined).
+When caching, PLP saves your script in memory and doesn't re-read
+and re-parse it if it hasn't changed. PLP will use more memory,
+but will also run 50% faster.
+
+=back
+
 =head1 AUTHOR
 
 Mischa POSLAWSKY <perl@shiar.org>
 
 =head1 SEE ALSO
 
-L<PLP|PLP>, L<PLP::Backend::CGI|PLP::Backend::CGI>, L<FCGI|FCGI>
+L<PLP>, L<PLP::Backend::CGI>, L<FCGI>