in reply to cleanup a cancelled CGI script
I tried the solution of using SIGPIPE posted by others above on Windows XP just to try it. Of course, there is no SIGPIPE sent to the script when running under Win32 (well, WinXP anyhow). What happened in my test is that the script doesn't even realize that the client has disconnected. The script finishes running normally, with no change in execution (in a simple test anyhow). Even adding a or die("print failed: $!"); to a print statement that should fail doesn't change anything. My test script below:
#!perl -w $| = 1; BEGIN { $SIG{PIPE} = sub { die "Pipe error: @_\n" }; } use strict; use CGI; my $q = CGI->new(); print $q->header(); print "output #1\n"; sleep 15; # we stop the browser load during the 15 sec. sleep print "output #2\n" or die("print failed: $!"); END { open my $fh, '>>', 'debug.txt'; print $fh "We made it to the END block.\n"; close $fh; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: cleanup a cancelled CGI script
by zebedee (Pilgrim) on Jun 08, 2004 at 19:58 UTC | |
by cLive ;-) (Prior) on Jun 08, 2004 at 21:22 UTC | |
by kragen (Sexton) on Jun 09, 2004 at 21:16 UTC | |
by cLive ;-) (Prior) on Jun 09, 2004 at 21:40 UTC | |
by zakzebrowski (Curate) on Jun 08, 2004 at 20:06 UTC | |
|
Re^2: cleanup a cancelled CGI script
by paulbort (Hermit) on Jun 08, 2004 at 20:02 UTC | |
|
Re^2: cleanup a cancelled CGI script
by iburrell (Chaplain) on Jun 08, 2004 at 20:28 UTC |