develooper Front page | perl.libwww | Postings from March 2001

LPW User Agent Timeout and Active State Perl on NT

Thread Next
From:
Paul Maine Jr.
Date:
March 30, 2001 08:23
Subject:
LPW User Agent Timeout and Active State Perl on NT
Message ID:
2B8C29895AE9D311B8A6009027DE6F1C2C8731@mail.noc.msicc.com
The timeout  method does not appear to be working. Is this a known bug? Is
there a workaround?

Thank You
Paul

****************************************************************************
*
use LWP::UserAgent;

  $ua = LWP::UserAgent->new;

  $ua->agent("$0/0.1 " . $ua->agent);
  $ua->timeout(10);

  $ua->agent("Mozilla/8.0"); # pretend we are very capable browser

  $req = HTTP::Request->new(GET => 'http://www.anycompany.com/');

  $req->header('Accept' => 'text/html');

  # send request

  $res = $ua->request($req);

  # check the outcome

  if ($res->is_success) {
     print $res->server();
     #print "\n";
     my $status = $res->status_line;
     print "$status\n";
     #print $res->headers_as_string;
     print $res->title;
     #print $ua->request($req)->as_string;
  } else {

     print "Error: " . $res->status_line . "\n";

  }

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About