use CGI::Carp qw(set_die_handler);
BEGIN {
sub handle_errors {
my $msg = shift;
print "Content-Type: text/html\n\n";
print "$msg";
}
set_die_handler(\&handle_errors);
}
####
[Wed Oct 5 23:53:36 2021] test.cgi: Died at /web/test.cgi line 15.
##
##
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
$ua->agent('Mozilla/5.0'); # play with this string
my $response = $ua->get('http://localhost/web/test.cgi');
if ($response->is_success) {
print $response->decoded_content;
}
else {
print $response->status_line;
}