in reply to Re: Failing noticeably in CGI
in thread Failing noticeably in CGI

CGI::Carp provides a handy hook for this:

use CGI::Carp qw( fatalsToBrowser set_message );

BEGIN {
    sub handle_errors {
        my $message = shift;
        # Insert some custom code here, for example check the remote address ...
        print "<h1>Oh gosh</h1>";
        print "<p>Got an error: $message</p>";
    }
    set_message( \&handle_errors );
}