Loading ...
Sorry, an error occurred while loading the content.

Timeouts in requesting pages with LWP

Expand Messages
  • Luke Metcalfe
    I m pulling my hair out over this one: use LWP::UserAgent; use HTTP::Request; use HTTP::Response; my $ua = new LWP::UserAgent; $ua- use_alarm(0) ; # I ve
    Message 1 of 8 , Sep 3, 2000
    • 0 Attachment

      I'm pulling my hair out over this one:



      use LWP::UserAgent;
      use HTTP::Request;
      use HTTP::Response;
       
      my $ua = new LWP::UserAgent;
      $ua->use_alarm(0) ;   # I've tried this at 1 too.
      $ua->timeout(1);
      my $request = new HTTP::Request('GET', $ARGV[0]);
      my $response = $ua->request($request);
      if ($response->is_success) {
           print $response->content;
      } else {
           print $response->error_as_HTML;
      }


      Gets the page ok, but doesn't timeout early if it's an invalid server..




      Luke Metcalfe
      Sydney Australia

      icq  684965
      mobile  0417 677 249
      email  luke@...

    Your message has been successfully submitted and would be delivered to recipients shortly.