Not that this matters, but I noticed that your test script is a little inefficient because it recreates the LWP::UserAgent and HTTP::Request objects for each iteration of the while loop.
You should be able to create the objects just once ahead of time and then reuse the objects inside the while loop. Below is an updated script explaining my suggestion.
Note that the suggested changes should not have any effect on the possible bug you originally reported.
Code:
#!perl
use strict;
use warnings;
use LWP::UserAgent;
my $n = 1;
my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new(GET => "http://127.0.0.1/test.htm");
$req->header('Accept' => 'text/html');
while (1) {
print "Fetching page $n...";
my $res = $ua->request($req);
if ($res->is_success) {
print " OK!\n";
$n++;
}
else {
print " ERROR: " . $res->status_line . ".\n";
sleep 1;
}
}