I’ve got a small Perl program that I want to run on the command line. I need to require another Perl script (not a module) that someone else has written. That, in turn, requires some other scripts. (I cannot do anything about the way this works).
Now, it is really annoying that one of these scripts has use CGI; and use CGI::Carp qw(fatalsToBrowser) in it. I do not want that. Having 15 lines of 500 Internal Server Error page on my console every time something breaks is really getting on my nerves. I’ve tried
require 'otherscript.pl';
no CGI;
no CGI::Carp;
and
no CGI;
no CGI::Carp;
require 'otherscript.pl';
to unload it, like the use doc describes, but it doesn’t work.
Can I somehow manipulate the symbol table or do some other magic to get rid of it?
There is no
unimportroutine in the CGI::Carp package, sonohas no effect. Undo the relevant part of theimportroutine manually.Lexical scope (see caveat):
Global scope: