You could try putting this at the top of the script:
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);
}
This will change the server's response code from 500 to 200 and would give you content like:
[Wed Oct 5 23:53:36 2021] test.cgi: Died at /web/test.cgi line 15.
However, the fact that the script you are calling with LWP::Simple does not appear in the logs would suggest that it is not actually being called.
I would not discount the role of user-agent - non-standard user-agents can be blocked to prevent web scraping. Maybe something at the server level was updated or reconfigured by your hosting company? To test you will need to use LWP::UserAgent directly.
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;
}