Karthik, 

Thank you for the response.

 Could you please clarify a few things
for me?

 Here is your response to my initial post:

our flag;
sub alarm_handler 
{
        set flag;
}       
        
set alarm to expire after 10 secs;
Loop indefinitely {
 exit if ($flag);
 my $response = $ua->request($req);
 my $content = $response->content();

}

As with the other reply that I made on this list, there is a race
between
alarm and
the loop. It could be so that the alarm expires before the loop starts
on
a heavily loaded
system. 
/kk

- How do I set the alarm to expire after 10 seconds?
  (set alarm to expire after 10 secs;). 

- How could I tell if the alarm is expiring before the loop
  starts?

 Thanks again for your help!
 
My original post ( for reference)...

> Hi all,
> 
>  I have a script that goes out and "grabs"
> a specific HTML page. I then search through
> the page, gathering the info I want.
>  Sometimes, the site I'm hitting is either
> bogged down or unresponsive. I'd like to
> include a timing mechanism that basically
> says after 10 secs, quit trying to get
> the page and move on.
>  Some sample code:
> 
> 
>  my $url = "http://$host:$port/page";;
>  my $ua = LWP::UserAgent->new();
>  $ua->agent("Godzilla/v911 Mithril");
>  my $req = HTTP::Request->new(GET =>$url);
> 
>  $req->referer("http://nowhere.com";);
> 
> Loop until you reach 10 seconds {
> 
>  my $response = $ua->request($req);
>  my $content = $response->content();
> 
> }

--
Ken Hammer
Strategic Projects And Planning
University Of Michigan

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to