agronbach has asked for the wisdom of the Perl Monks concerning the following question:
Hello,
I have a question regarding the best way to run a background process in a web application using CGI and Perl. My best attempt currently forks a parent process which creates a dummy output page (that is set to auto-refresh) and then exits. The child is where I am doing all of my work in my script, and while I know it is rather unorthodox to force the parent to exit before the child, I couldn't figure out another way to accomplish backgrounding within my scripts.
The good part of this solution is that it works; the parent creates an auto-refreshing dummy page, and once the child is done, it overwrites the dummy page with the actual output, and when the dummy page auto-refreshes, it loads the real output and stops refreshing.
The bad part about this solution is that I am unable to incrementally print to the dummy page when my subroutines complete (to show progress in the script). My die statements (for when things like open should fail) are completely hidden however.
I am about to start rewriting all of my dies to print their error message to the dummy page as a work-around, but I feel like there must be a better way than the one I have implemented.
And this brings me to you, oh wise monks, seeking any and all advice you may have about this topic. Thank you in advance.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI Script backgrounding
by ww (Archbishop) on Aug 10, 2011 at 00:20 UTC | |
|
Re: CGI Script backgrounding
by locked_user sundialsvc4 (Abbot) on Aug 09, 2011 at 23:44 UTC | |
by agronbach (Novice) on Aug 10, 2011 at 16:16 UTC | |
|
Re: CGI Script backgrounding
by scorpio17 (Canon) on Aug 10, 2011 at 13:33 UTC | |
by agronbach (Novice) on Aug 10, 2011 at 16:45 UTC | |
by scorpio17 (Canon) on Aug 11, 2011 at 12:50 UTC |