Live CPAN

CPAN is one of the greatest things about Perl. However, sometimes I can't connect to the internet or I have spotty connectivity. That's why CPAN::Mini exists - it creates a local copy of CPAN. It takes up about 1.4 GB of space. However, this means that your local copy of CPAN is now out of date. You can run minicpan often, but I thought there could be a better solution, so I wrote CPAN::Mini::Live. This module allows you to have a local CPAN mirror which is instantly updated whenever new distributions are uploaded to CPAN.

How could this possibly work? First off, it relies upon using a CPAN mirror that is kept up to date. Andreas Koenig has been working on a way to do that using File::Rsync::Mirror::Recent and one of these mirrors using this method is the CPAN Testers CPAN mirror.

There are two bits: the backend and the frontend. The backend I run so that you don't have to. It hooks into CPAN::Mini updating from this mirror, sees what files have been added, changed or deleted and publishes these events in real time on FriendFeed

The frontend also hooks into CPAN::Mini. It does a quick update of what has changed and then listens to these events live and either downloads updates from the mirror or deletes a file locally.

The end result is that your local CPAN mirror is the same as live when you are online and recent when you are offline.

It's been running for a month or so and seems pretty stable, but it's a bit of a technology experiment. Does it work for you? What else should it do?

Thanks to Miyagawa for giving me the idea of using Friendfeed.

Leave a comment

About acme

user-pic Léon Brocard (aka acme) is an orange-loving Perl eurohacker with many varied contributions to the Perl community, including the GraphViz module on the CPAN. YAPC::Europe was all his fault. He is still looking for a Perl Monger group he can start which begins with the letter 'D'.