You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Tosh Cooey <to...@1200group.com> on 2010/02/22 00:11:48 UTC
Forking and/or spawning long running processes under ModPerl::Registry
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/