I don’t travel away from a network very often, particularly now that I have an EVDO card. However, it is inevitable that when am away from a network (on a plane, in snow storm, on the road) I want to try out a CPAN module or need one that I haven’t yet installed. When this happens and I can’t do whatever it was that I wanted to do because I didn’t have it, I get grumpy. However, thanks to CPAN::Mini, I don’t have to worry about this problem anymore.
% sudo cpan CPAN::Mini
% mkdir -p ~/projects/minicpan
That installs the module itself and sets up the directory for the local repository. Then, I added a nice alias to my shell config:
alias cpansync="minicpan -l $HOME/projects/minicpan -r http://ftp.osuosl.org/pub/CPAN/"
I picked the OSL mirror here since I happen to know the man responsible for admin’ing that mirror. I can then run this to get a copy of the latest and greatest on CPAN:
% cpansync
After that runs, I can run it again any time I want to refresh, which I usually do right before I travel and any other time I want a fresh copy.
Finally, I modified the list of CPAN mirrors to include:
file:///home/sterling/projects/minicpan
Now, whenever I install modules, the modules are installed directly from my hard drive. This is also a bit faster than having to download the modules at install time (i.e., as long as I have already done the download previously).
This setup makes me happy, especially when on airplanes.
Cheers.

Leave a comment