天天看點

CGI::Carp

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.

繼續閱讀