http://www.perlmonks.org?node_id=130644


in reply to CGI Error Handling

There is one useful package in Perl standard library - CGI::Carp.
It will help you to redirect ALL errors and warnings to your own log file.
BEGIN{ use CGI::Carp qw(carpout); open LOG, $logfile or die "Couldn't open log file: $!"; carpout(LOG); }
see also 'man CGI::Carp';