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;
}
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|