CPAN::Indexer::Mirror implements a long-awaited (by me at least) chunk of functionality for the PAUSE indexer.
Specifically, it creates mirror.yaml and mirror.json files which contain something like the following.
---
version: 1.0
name: JavaScript Archive Network
master: http://openjsan.org/
timestamp: 2008-08-15T21:17:52Z
mirrors:
- http://jsan.caseywest.com/
- http://back.openjsan.org/
- http://jsan.jp/
- http://jsan.nc.cyut.edu.tw/
- http://jsan.stu.edu.tw/
- http://www.jsan.de/
- http://jsan.log.pt/
- http://jsan.davecardwell.co.uk/
- http://jsan.clueball.com/
- http://jsan.woobling.org/
- http://jsan.develooper.com/
- http://pair.openjsan.org/
- http://jsan.phunnel.org/
The file contains the absolute minimum needed for a client to work out if a mirror URI is valid, what it is mirroring, how long it has been since the last syncronisation (or at least since the last indexer run) and a list of mirrors that it can probe to look for a better option than the one it is currently running.
The mirror.json file is identical to the YAML version, but encoded in JSON instead of YAML, making it easier for webby applications to do similar mirror detection.
On the client side, a matching Mirror::YAML module (currently out of date, but being updated) implements the client logic needed to validate, check for updated mirror lists, and scan for the "best" mirror (serially).
More advanced modules, based on something like HTTP::Client::Parallel would give the ability to do the same mirror selection functions, but would call a number of mirrors at the same time, making the selection of a "good" mirror a completely automated (and reasonably fast) process.
Amoungst other features, this should finally allow us to do away with the (defunct) method of asking a user what mirror to use, when most of the time the user doesn't have any idea which one to use either.