We don't bite newbies here... much | |
PerlMonks |
Re: system or exec in a web environmentby paulbort (Hermit) |
on Jun 09, 2004 at 13:58 UTC ( [id://362729]=note: print w/replies, xml ) | Need Help?? |
The other monks are correct, 'exec' never returns. Never. I would suggest changing the CGI script to give the user a message like "Your file is being processed" and just end. Then in the background, you need a listener program that watches that directory for new files, picks them up in turn, and processes them. The one I wrote is a shell-script that runs a Perl script every 10 seconds, and is started by rc.local. If you want it to process multiple files at a time, a thread pool can be your friend. If you need to keep users informed about how their files are going, a CGI script that displays results from a status table, updated by the worker threads, might make sense. (You could even make it part of the original script with a refresh, if you want that 'interactive application' style.) -- Spring: Forces, Coiled Again!
In Section
Seekers of Perl Wisdom
|
|