(title inspired by a blog post)
CPAN.pm used to ask a bunch of questions the first time it is run. One of the questions is what CPAN mirrors to use.
Now it doesn't any more: it comes preconfigured. But that comes at a price: a lot of distros simply assume use of http://cpan.perl.org/ or of http://www.cpan.org/ (while several perl ports use their own private CPAN mirror by default, such as Strawberry Perl for Windows, and, I thought, ActiveState's ActivePerl.
Is the idea of using CPAN mirrors simply outdated? Or, should the CPAN client be smarter, and figure out for itself which mirrors to use? The latter feels like overkill to me. It presumes inclusion of a geolocator module and database, like Geo::IP (the free version of that database is far more than sufficient for this purpose, so the license price is no objection). But having that module and database on every Perl installation, just to get a list of mirrors once, or maybe a few times, in the lifetime of a perl installation, really is far too much.
I can remember how http://www.perl.com/CPAN, thanks to Tom Christiansen IIRC, used to have a built in redirector, where it figured out where in the world you are, and hence, which (single) mirror to use. But if that one mirror was offline, you were out of luck. It didn't check the status of the mirror, it just redirected you there.
If we still wish to use mirrors, why not drag CPAN into the age of webservices?
(actually we're already late for that, as the age of webservices seems to have
text/plain page with one URL of a mirror
per line, returning maybe 5 or 10 URLs in total. Easy to generate, and dead easy to parse.
(Note: the order of mirrors that are close to each other in level of preference could be randomly shuffled for each request, to avoid that all users in one area all hammer the same mirror.)
CPAN.pm can still be made a bit smarter, and for example, use
ping to test
responsiveness of the mirror, or, simpler still, time the fetch time of a page
from the currently chosen mirror, and check if it's fast enough
(depending on your internet connection; it should keep track of responsiveness
of the mirrors, so it can compare them); and switch the order of mirrors, if
that may, likely, seriously improve matters.