You are on the right track. I want it to work like
fatalsToBrowser which also captures compilation errors. Unfortunately, that subroutine doesn't accept arguments (you are not suppose to call it yourself), but I want the same convenience to turn it on or off with a single comment. For example:
# On
use CGI::Carp qw(fatalsToBrowser);
# Off
# use CGI::Carp qw(fatalsToBrowser);
I think the solution lies in creating my own custom import sub. I realized this right after posting. Thanks everyone for the thoughts!!