@@ -, +, @@ --- C4/Context.pm | 65 ++++----------------------------------------------- 1 file changed, 5 insertions(+), 60 deletions(-) --- a/C4/Context.pm +++ a/C4/Context.pm @@ -21,74 +21,19 @@ use Modern::Perl; use vars qw($AUTOLOAD $context @context_stack); BEGIN { - if ($ENV{'HTTP_USER_AGENT'}) { - require CGI::Carp; - # FIXME for future reference, CGI::Carp doc says - # "Note that fatalsToBrowser does not work with mod_perl version 2.0 and higher." - import CGI::Carp qw(fatalsToBrowser); - sub handle_errors { - my $msg = shift; - my $debug_level; - eval {C4::Context->dbh();}; - if ($@){ - $debug_level = 1; - } - else { - $debug_level = C4::Context->preference("DebugLevel"); - } - - print q( - -
The following fatal error has occurred:
-$msg
- Apache | $versions{apacheVersion} |
---|---|
Koha | $versions{kohaVersion} |
Koha DB | $versions{kohaDbVersion} |
MySQL | $versions{mysqlVersion} |
OS | $versions{osVersion} |
Perl | $versions{perlVersion} |
The following fatal error has occurred:
-$msg
";
- } else {
- print "production mode - trapped fatal error
"; - } - print ""; - } - #CGI::Carp::set_message(\&handle_errors); - ## give a stack backtrace if KOHA_BACKTRACES is set - ## can't rely on DebugLevel for this, as we're not yet connected - if ($ENV{KOHA_BACKTRACES}) { - $main::SIG{__DIE__} = \&CGI::Carp::confess; - } + if ( $ENV{'HTTP_USER_AGENT'} ) { # Only hit when plack is not enabled # Redefine multi_param if cgi version is < 4.08 # Remove the "CGI::param called in list context" warning in this case - require CGI; # Can't check version without the require. - if (!defined($CGI::VERSION) || $CGI::VERSION < 4.08) { + require CGI; # Can't check version without the require. + if ( !defined($CGI::VERSION) || $CGI::VERSION < 4.08 ) { no warnings 'redefine'; *CGI::multi_param = \&CGI::param; use warnings 'redefine'; $CGI::LIST_CONTEXT_WARN = 0; } - } # else there is no browser to send fatals to! -} + } +}; use Carp; use DateTime::TimeZone; --