Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

URL Spider Timeout Issue

Status
Not open for further replies.

chitownclone

Programmer
Mar 30, 2004
22
0
0
US
My program was just transferred from a shared server to a dedicated. The default timeout on the decided is 3 minutes, so when my spider comes across a URL that is not active or doesn't return code....my spider tries for exactly 3 minutes, when I need it to be 30 seconds.

Here's the code:
---------------------------------------------
#!/usr/bin/perl -Tw
require "/home/&ReadParse(*in);
print &PrintHeader;
use LWP::Simple;
require LWP::RobotUA;
require LWP::UserAgent;

$ua = new LWP::UserAgent;
$ua->timeout([1]);

open (READ, "/home/@url=<READ>;
close(READ);

foreach $url (@url){
# Process Code
}
---------------------------------------------

Anyone see what I am doing wrong or have any suggestions to reset my timeout from 3 minutes to 30 seconds.

Thanks
 
Code:
$ua->timeout(30);

180 secs is default, dunno what [1] does, but seems it read it as an indication to use default

HTH
--Paul


cigless ...
 
PaulTEG's example is the correct way to do it.

Code:
$ua->timeout([1]);
Just to explain this - the square brackets indicate a reference to an anonymous array. In this case, that array has one element. The timeout() method is expecting an iteger, not a reference to an array of integers, which is why it's not working for you.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top