in reply to Re: How do I tell if a remote site is up?
in thread How do I tell if a remote site is up?
#!/usr/bin/perl use LWP::Simple; print "Content-type: text/html\n\n<html><body bgcolor=white>\n"; local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required eval { alarm 4; $content = get("http://select.worldpay.com/wcc/info?op=rates&instI +d=36128"); alarm 0; }; if ($@) { die unless $@ eq "alarm\n"; # propagate unexpected errors # timed out print "timed out<BR>"; } else { # didn't print "succeeded<BR>"; } if($content) { print $content; } else { print "Durrr"; }
It's still hanging.
I haven't really understood how to use SIGALARM - I am just coding-by-numbers at the moment hoping that understanding will dawn.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: How do I tell if a remote site is up?
by Elliott (Pilgrim) on Nov 11, 2003 at 19:35 UTC |