Thanks for the very helpful reply
You could try putting this at the top of the script:
use CGI::Carp qw(set_die_handler);
BEGIN {
sub handle_errors {
my $msg = shift;
print "Content-Type: text/html\n\n";
print "$msg";
}
set_die_handler(\&handle_errors);
}
I'm going to write some test code so that I can properly test what is going on. It will probably have to wait until the weekend though. But this code has been a little confused!
Is set_die_handler a method of CGI::Carp and set_die_handler(\&handle_errors); in the BEGIN block is overriding it?
Or is something different happening here?