good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Detect Stop Buttonby sevensven (Pilgrim) |
on Nov 26, 2001 at 18:58 UTC ( [id://127546]=note: print w/replies, xml ) | Need Help?? |
You need to check if your script has lost access to STDOUT. One easy way to make sure your script will stop is to keep it printing info as it processes (and make sure output is not buffered). The script will die as soon as it tries to access STDOUT and it is no longer available. I tried to check if the script would get an alarm from Apache, but could not get anything (wich is ok, because Apache docs do not talk about signals to CGI scripts when client disconnects ;^) I'll put my test code here, just in case you want to fidget with it a bit. If all output is placed into $out instead of dumping it straight to STDOUT, the CGI will not stop running until it normaly ends :
Update : this sample did not work in IIS (as giulienk reported, tks!), but you only need to add a or die("gone"); after each print. Perl dies in unix CGI land when it cannot access STDOUT, but it lives on in CGI/IIS windows land. And please remember, the snippet *does not* receive signals from apache, the handlers are there just to show that :-) -- sevensven or nana korobi, ya oki
In Section
Seekers of Perl Wisdom
|
|