in reply to cleanup a cancelled CGI script

try using the sigtrap module

Replies are listed 'Best First'.
Re^2: cleanup a cancelled CGI script
by goofball (Acolyte) on Jun 16, 2004 at 13:09 UTC
    UPDATE:: I got a lot of good advice after posting this thread - thanks to all. I tried using
    $SIG{PIPE} = sub { ... };
    but found that it wasn't working all the time. It turns out that by hitting the stop button on the browser, a SIGTERM was ending the script in stead.

    I took this anonymous suggestion to use the sigtrap module, and that's working flawlessly now. Thanks!
    use sigtrap qw(die untrapped normal-signals); END { ... here's where I clean up the zip file ... }
    sigtrap