When you upload a new module to CPAN, most of you would say something like this on your blog or tweet: "Module Foo::Bar 0.50 is shipped to CPAN -- will be coming to a mirror near you soon, or if you can't wait you can get the latest from [git or svn URL]". As we discussed, "soon" is not really soon: it's a few hours in the case of search.cpan.org and could be a day for other mirrors. CPAN.pm itself has a local index cache that has a lifetime of 24 hours by default. So it could sum up to like 2 days.
Getting the latest code from git/svn repo would work, but it forces the users to install some tools that otherwise they might not need, and defeats some benefits of the CPAN ecosystem.
Now that CPAN uploads can be retrieved realtime, we can move on to actually take advantage of this feed to solve this problem. So I introduce you to my newest software: cpanf (App::CPAN::Fresh).
This is a command line tool to fetch latest update feeds from CPAN realtime bot, and install the module using the existent CPAN toolchain (i.e. Adam Kennedy's CPAN::Inject and CPAN.pm itself).
This works really great -- now you can upload your module and in about less than a minute, you can say "Foo::Bar is uploaded to CPAN: you can now install it with cpanf Foo::Bar". I've been testing the App::CPAN::Fresh itself with my friends on IRC and they can upgrade the module as soon as I uploaded to PAUSE.
The command also follows the existent cpan command line options, like -f for force install and -t for testing. Also for those great folks (Barbie in particular) running CPAN Testers: this command only allows you to install modules fresher than 2 days old. If the module you're trying to install is older than that, it just falls back to CPAN shell itself, which means you would use your own mirror to install it. This should be important to keep the fresh mirror's bandwidth as minimal as possible, but let me know if you have suggestions for that.
So what are you waiting? Type "install App::CPAN::Fresh" now and enjoy! (Hm, you may have to wait for a few hours to get that, or install from search.cpan.org archive. Bootstrapping is always the problem :))
Nice stuff, installing now. But note that you can already do
cpan> install $author/$foo-0.01.tar.gz
in fact I just did:
cpan> install C/CH/CHM/OpenGL-0.58.tar.gz
to get the latest one. you need to have a main mirror (like the one in finland) in your mirror list though. cpan shell will try all until it reaches a non 404
Posted by: Burak Gürsoy | 2009.09.06 at 15:28