On Apr 28, 2011, at 11:19 , brian d foy wrote:

> On Tue, Feb 8, 2011 at 4:44 AM, Adam Kennedy <a...@ali.as> wrote:
>> I think I may have implemented what you're looking for several years
>> ago for JSAN, which has a client that auto-detected appropriate
>> mirrors in a few seconds each time it starts.
>> 
>> http://search.cpan.org/~adamk/Mirror-URI-0.90/lib/Mirror/YAML.pm
> 
> I was looking at this, but it seems like the idea of downloading a
> small file from several mirrors isn't a good way to figure out which
> mirrors to use, especially with a large number of mirrors.
> 
> I guess you could randomly choose some mirrors and keep checking until
> you find some that are fast enough.
> 
> However, shouldn't knowing something about the location can start that
> more quickly when there are several hundred mirrors?

No need for everyone to contact all mirrors.

http://mirrors.cpan.org/ constantly monitors CPAN mirrors for freshness. This 
data can be obtained in JSON form at

http://mirrors.cpan.org/cpan-json.txt

for example

   {
      "url" : "http://ftp.wa.co.za/pub/CPAN/";,
      "city" : "Cape Town",
      "region" : null,
      "country" : "South Africa",
      "continent" : "Africa",
      "cc" : "za",
      "age" : "1303986001",
      "last_status" : "ok",
      "last_ok_probe" : "1304001901"
   },

It checks each mirror by fetching a file which is constantly updated on the 
CPAN master site. The age field is the epoch timestamp for that file

Graham.

Reply via email to