Perl / Apache / CGI / Carp : Cannot get fatalsToBrowser to work

500 Views Asked by At

I am writing a perl web application running with apache and want to redirect error messages to the browser for debugging. For this, I found fatalsToBrowser from CGI::Carp.

Unfortunately, I still get an 'Internal Server Error' instead of the error message, which still ends up in the apache error log. Here is my code:

package Test;
use strict;
use warnings;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use Apache2::Request;

sub handler {
    my $request = Apache2::Request->new(shift);
    die("This is an error");
    print "here\n";
    return 1;
}

1;

In the documentation of CGI::Carp I read "Note that fatalsToBrowser may not work well with mod_perl version 2.0 and higher."

I am using mod_perl 2 and if I use fatalsToBrowser in a simple 'Hello World' cgi example, it works. But I am not sure if this function would not work in my setting or if I am doing something wrong.

Does anyone have an idea how to get this to work (maybe also with alternatives to CGI::Carp)?

0

There are 0 best solutions below