Subject: | Error at runtime: File does not exist: .../speedtest line 425 |
Date: | Thu, 17 Dec 2015 09:39:52 -0500 |
To: | bug-App-SpeedTest [...] rt.cpan.org |
From: | Russell Shingleton <reshingleton [...] gmail.com> |
This looks like an error that occurs when trying to retrieve the server
list from speedtest.net. The URL referenced is
http://www.speedtest.net/speedtest-servers-static.php, which returns and
empty page.
Line 424 contains the URL http://www.speedtest.net/speedtest-servers.php
and does return a list, but it is commented out.
I saw a similar bug noted in the python version which included a list of
URLs to try before failing. The inclusion of an array of URLs and a loop
here would probably solve this issue if no response is received from the
GET call.
sub get_servers {
my @urls = qw(
http://www.speedtest.net/speedtest-servers-static.php
http://www.speedtest.net/speedtest-servers.php
http://c.speedtest.net/speedtest-servers.php
);
my $rsp;
foreach my $url (@urls) {
print "Trying $url...\n";
$rsp = $ua->request( HTTP::Request->new( GET => $url ) );
last if $rsp->content;
}
( $rsp->is_success && $rsp->content ) or die "Cannot get config: ",
$rsp->status_line, "\n";
...
Thanks.