CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Time out

 



Gregorio
User

Aug 7, 2000, 6:30 PM

Post #1 of 5 (346 views)
Time out Can't Post

I use a lot of get statements that gets information from web pages in my cgi script. Is there a way to have the script go on to getting the next page if the page its trying to get takes longer than a certain amount of time (maybe 15-20 seconds)?


Kanji
User / Moderator

Aug 7, 2000, 7:17 PM

Post #2 of 5 (346 views)
Re: Time out [In reply to] Can't Post

If you're get'ing with LWP, then you can (ab)use the timeout function which is available in the OO mode (ie, $ua->timeout(15);).

Otherwise, investigate the use of alarm.


Gregorio
User

Aug 8, 2000, 1:47 PM

Post #3 of 5 (346 views)
Re: Time out [In reply to] Can't Post

Hi Kanji,
Currently I'm using the following code to get information from a page:

my $pageurl = "http://website.com/pagename.html";
my $pagecode = get ($pageurl);

Is there a better way to do this? Currently it takes up a lot of time because I get information from 5 pages. Would there be a way to use timout with this code?
Thanks for the help.


Kanji
User / Moderator

Aug 9, 2000, 5:15 AM

Post #4 of 5 (346 views)
Re: Time out [In reply to] Can't Post

Looks like you're using LWP::Simple. LWP::UserAgent is more suited to greater manipulation of HTTP requests, but I believe you can export the $ua object from LWP::Simple by asking for it (use LWP::Simple qw( $ua );), and then applything the timeout() method to that.

See the documentation and/or do some experiment, or make the jump to the more powerful -- but more complex -- LWP::UserAgent.


Gregorio
User

Aug 9, 2000, 6:17 AM

Post #5 of 5 (346 views)
Re: Time out [In reply to] Can't Post

Do you know if LWP::Useragent is faster than LWP::Simple?

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives