Hi,

I'm trying the LWP::RobotUA module. It should ensure automatically that
a certain delay is respected before the user agent contacts the same
server again. It works fine if it has already contacted the server
before, but if it's the first time it contacts this server it waits the
full delay time before doing it. This latter seems very strange to me.
Can someone tell me if I understood something wrong, if RobotsUA is
intended to behave like this or if it's a bug?

Find below my testing script.

regards

Holger


#!/usr/bin/perl -w

use strict;

use LWP::RobotUA;
use HTTP::Request;
use HTTP::Response;

my $rua = LWP::RobotUA->new('RobotUA_test',
'[EMAIL PROTECTED]');
$rua->delay(0.1); # waits 6 seconds before contacting the same server
again

my @urls = ("http://www.cis.uni-muenchen.de";,
            "http://www.focus.de";,
            "http://www.cis.uni-muenchen.de/CISMitarbeiter.html";);

foreach my $url (@urls) {
  my $request = HTTP::Request->new('GET',$url);
  print "Starting the request for $url\n";
  my $start = time();
  my $response = $rua->simple_request($request);
  my $ende = time();
  print "Response received after ",$ende-$start, " seconds \n";
  if ($response->is_success) {
   print "Success\n";
  } else {
   print $response->status_line, "\n";
  }
}



Reply via email to