In Perl, how can I disable CGI :: Carp, which was loaded into the required script?

I have a small Perl program that I want to run on the command line. I need requireanother Perl script (not a module) that someone else wrote. These, in turn, are requiresome other scripts. (I can't do anything about how this works).

Now, really annoying that one of these scripts is use CGI;, and use CGI::Carp qw(fatalsToBrowser)in him. I dont need it. Having 15 lines 500 Internal Server Error pageon my console every time something breaks is really on my nerves. I tried

require 'otherscript.pl';
no CGI;
no CGI::Carp;

and

no CGI;
no CGI::Carp;
require 'otherscript.pl';

to unload it, for example, use a document , but it does not work.

- - , ?

+5
3

CGI:: Carp unimport, no . import .

(. caveat):

local $main::SIG{__DIE__} = \&CGI::Carp::realdie;

:

CGI::Carp::set_die_handler(\&CGI::Carp::realdie);
+3

$CGI::Carp::TO_BROWSER 0, HTML- die.

+3

, fatalsToBrowser? fatalsToBrowser - , . , fatalsToBrowser , , .

So, be sure to use the tricks that other people mentioned to disable it. But you should also do everything possible to change the violation code so that it is not used fatalsToBrowserin the production process.

+2
source

All Articles