in reply to Re: cleanup a cancelled CGI script
in thread cleanup a cancelled CGI script

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