#!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; }