in reply to (joealba) Just making sure...
in thread Detect Stop Button

Actually, you do have to keep printing as that is the only way you are likely to get SIGPIPE, which is likely the only hope you have if you are already getting defunct CGI processes hanging around.

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
(joealba) Re: (tye)Re: Just making sure...
by joealba (Hermit) on Nov 27, 2001 at 00:35 UTC
    Yup. tye is right. I am wrong. S'ok. I've been wrong before. hehehe.

    use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser); use sigtrap qw(handler croak normal-signals error-signals); $|=1; print &header; for (1..60) { # Comment the next line, and see the difference! print "$_<BR>\n"; sleep(1); }
    Run this code and hit the STOP button while it's looping. You'll get $SIG{PIPE} and possibly $SIG{TERM} as well. Comment out the print line, and the script will run to completion -- because, although STDOUT is closed, the script isn't printing. So, it never fails on a write to STDOUT to cause the $SIG{PIPE}.

    Thanks for setting me straight, tye.