[Catalyst-commits] r10422 - trunk/Catalyst-Engine-HTTP-Prefork/lib/Catalyst/Engine/HTTP

jshirley at dev.catalyst.perl.org jshirley at dev.catalyst.perl.org
Tue Jun 2 21:55:21 GMT 2009


Author: jshirley
Date: 2009-06-02 21:55:21 +0000 (Tue, 02 Jun 2009)
New Revision: 10422

Modified:
   trunk/Catalyst-Engine-HTTP-Prefork/lib/Catalyst/Engine/HTTP/Prefork.pm
Log:
Adding passthrough options for pid_file and setsid/background

Modified: trunk/Catalyst-Engine-HTTP-Prefork/lib/Catalyst/Engine/HTTP/Prefork.pm
===================================================================
--- trunk/Catalyst-Engine-HTTP-Prefork/lib/Catalyst/Engine/HTTP/Prefork.pm	2009-06-02 18:35:15 UTC (rev 10421)
+++ trunk/Catalyst-Engine-HTTP-Prefork/lib/Catalyst/Engine/HTTP/Prefork.pm	2009-06-02 21:55:21 UTC (rev 10422)
@@ -33,7 +33,15 @@
     # Restore ARGV since Getopt has eaten it and Net::Server needs it
     # for proper restart support
     @ARGV = @{ $options->{argv} };
-    
+   
+    my %extra = ();
+    if ( $options->{pidfile} or $options->{pid_file} ) {
+        $extra{pid_file} = $options->{pidfile} || $options->{pid_file};
+    } 
+    if ( $options->{background} ) {
+        $extra{setsid} = $extra{background} = 1;
+    }
+
     $self->SUPER::run(
         port                       => $port || 3000,
         host                       => $host || '*',
@@ -45,6 +53,8 @@
         max_servers                => $options->{max_servers}       || 50,
         max_requests               => $options->{max_requests}      || 1000,
         leave_children_open_on_hup => $options->{restart_graceful}  || 0,
+
+        %extra
     );
 }
 
@@ -385,6 +395,16 @@
 will not attempt to close child processes if the parent receives a SIGHUP.  Each
 child will exit as soon as possible after processing the current request if any.
 
+=head2 pidfile
+
+This passes through to Net::Server's pid_file option.  If set, the pidfile is
+written to the path.  Default is none.  This file is not removed on server exit 
+
+=head2 background
+
+This option passes through to Net::Server and also sets the 'setsid' option to
+true.
+
 =head1 AUTHOR
 
 Andy Grundman, <andy at hybridized.org>




More information about the Catalyst-commits mailing list