Java Mailing List Archive

http://www.apache-httpd.com/

Home » modperl.perl »

Forking and/or spawning long running processes under ModPerl::Registry

Tosh Cooey

2010-02-21


Author LoginPost Reply
This worked for me and perhaps somebody else will find this useful
because I for sure could not find any simple vanilla starting points for
creating forks under mod_perl, but I did find a way to spawn processes
and not get zombies (actually I haven't tested this fully, but I'm
pretty sure).

##### website.pl
... website stuff ...
system('/path/to/my_looooooong.pl', @args);
... more stuff ...


##### my_looooooong.pl
#!/usr/bin/perl

use Proc::Daemon;
Proc::Daemon::Init;

for my $num (1..10) {
 sleep 1;
}


Now that's right, all the above does is sleep for 10 seconds, but at
least it will sleep without zombies and won't hang up the browser
connection.

I hope one day this saves somebody weeks of futzing around. I also hope
it works the way I think it works.

Tosh

--
McIntosh Cooey - Twelve Hundred Group LLC - http://www.1200group.com/
©2008 apache-httpd.com - Jax Systems, LLC, U.S.A.