use CGI::Carp;
BEGIN {
use CGI::Carp qw(carpout);
open(my $log, ">>", "cgi-logs/mycgi-log")
or die("Unable to open mycgi-log: $!\n");
carpout($log);
}
We can also make our errors go to a separate log, by using the carpout subroutine. This needs to be
done inside a BEGIN block in order to catch compiler errors as well as ones which occur at the
interpretation stage.
转载于:https://blog.51cto.com/716378/642619