or download this
$SIG{__DIE__} = sub {
# PROMPT is for NT/2000, CMDLINE is for 95/98
return unless !defined $ENV{PROMPT} or (defined $ENV{CMDLINE} and $E
+NV{CMDLINE} eq 'WIN');
print shift,"This window will close in 10 seconds." and sleep 10 and
+ exit;
} if $^O =~ /Win32/;