On Tue, May 29, 2012 at 21:45:16 -0500 , Matt wrote:
> Thanks.  Yes, using Simple.  Looking at this.
> 
> Can I do something as simple as this?
> 
> $rststr = "";
> alarm(60); # set timer for 60 seconds
> $rststr = get("http://"; . $dst . "/request.htm" ); # try to get my data
> alarm(0); # turn off timer

More or less, yes--have you tried it? Also, do consider using 'my' to
declare your variables.

> If the get failed I just want $rststr empty or filled with what data
> was received.  Or MUST I define an alarm condition?  I am also
> thinking I must wrap this in eval?  This is on a linux server.  Thanks
> again.
> 

Yes, you need to use alarm with LWP::Simple because, well, it's simple.
It isn't very flexible because the API was designed to make it easy to
use. This is the tradeoff of using a ::Simple API--it's not as flexible
as something more complex. This is one of the fundamental tradeoffs of
programming.

-- 
Chris Nehren           | Coder, Sysadmin, Masochist
Shadowcat Systems Ltd. | http://shadowcat.co.uk/

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to