Writing to an Alternate Log File using CGI::Carp

#!/usr/bin/perl -T
use strict;
use CGI qw/:standard/;
BEGIN {
use CGI::Carp qw(carpout);
open (ERRORLOG, '>>', '/logs/cgierrors1234.log') or
die("Unable to open log file: $!\n");
carpout('ERRORLOG');
}
print header,
start_html("Testing CGI Carp");
warn ("This is a test warning");
print p("Hello, this is a test, check the logfile"),
end_html;
exit;

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.