Building notes, projects, and occasional rants

Bounjour, CPAN!

For a Perl programmer, a local (on your laptop) CPAN mirror is a worthy investment. The problem is that a full mirror is 5.8Gb of disk space. Fortunately we have CPAN::Mini that creates a mirror of the most important stuff using only 830Mb.

So now you have your local mirror, and after you add the path to your cpan urllist configuration, all your module installations will use this faster mirror.

But you shouldn't stop there. If you are using a Mac with 10.4.x or above, you can share you CPAN mirror with the others on your local lan, and announce it proudly using Bonjour.

To do that, just follow these steps. First create a Apache configuration file at /etc/httpd/users/. I called mine cpan.conf and it looks like this:

# My local mini CPAN mirror

Alias /cpan/ /Users/melo/Documents/cpan/
<Directory "/Users/melo/Documents/cpan/">
    Options none
    AllowOverride none
    Order allow,deny
    Allow from all

RegisterResource "Local CPAN Mirror" /cpan/ 80

This will share your CPAN mirror (change /Users/melo/Documents/cpan/ to the path of your local mirror) and announce it via Bounjour with the name "Local CPAN Mirror".

Make sure that you start Web Sharing, at System Preferences, Sharing. If yes, stop and then start to load the new configuration file.

To use this CPAN mirror from other computers, you just start cpan, and then type o conf urllist URL where URL is the URL advertised.