[cgiapp] Tasks after fork()'ing a CGI::Application
Gurunandan R. Bhat
guru at informationmatters.in
Mon Aug 10 10:39:33 EDT 2009
Hi,
I am forking a CGI::Application to perform a long-running task. The
implementation is copied from this ingenious method:
http://www.stonehenge.com/merlyn/LinuxMag/col39.html
To summarize that article: The child process and begins the long task,
logging its progress to a Cache::FileCache object. The parent adds a
"refresh" header and exits. The browser refreshes the same URL and
displays the contents of the Cache::FileCache object on each refresh.
The child process writes a end-of-job string to the cache. When the
refreshing parent finds the string, it removes the header and does not
refresh anymore.
I would like this to be as robust as possible. Currently, all I do in
the child before launching the long-running process is close STDOUT. Is
there any other tasks I must perform? Is there a CPAN module that might
help clean up things in the child better than this? I tried Proc::Daemon
but that closes all file descriptors inherited from the parent(including
a few datafile descriptors that I need access to). I can of course
re-open them from well know locations.
Any advice on making this method more robust would be hugely
appreciated.
Regards
More information about the cgiapp
mailing list