[Melbourne-pm] caching CPAN dist files

Malcolm Herbert melbourne-pm at mjch.net
Tue Apr 19 16:51:59 PDT 2011

I'm in the process of putting together a project that I'm expecting to
use a fair number of CPAN modules directly rather than using the system
native packages of them, for portability.  I have a few development and
test instances and a few instances in production.  I'd like to use CPAN
to manage the modules installed on each, however I want to make sure
that they stay in sync with each other and avoid potential dependency
issues should my development and production environments drift too far
apart.  Ideally I'd like to use the CPAN tools to update the production
environment only from the set of modules I've collected and tested on my
dev/test hosts.

Is there a good method for doing this?  I've discovered Local::lib from
the Catalyst book which looks promising for installing modules into
non-system locations which means I can add and update modules without
being root on the host, but I can't see how to get CPAN to only ever
look in local directories for dist files rather than fetching from the

Also, if down the track I discover a need for module xxx, the current
version of which requires a later yyy than I have (ignoring issues of
whether this is a good idea) how would I go about trying to locate the
latest version of xxx that would be satisfied with the version of yyy
that I already have rather than trying to update both?  How long do old
versions of modules stick around in CPAN?

I've been able to avoid precisely this issue with pkgsrc by
pre-emptively downloading all the binary packages as they are available
in one hit, which has meant I've been able to add new packages to older
installs of hosts without issues, at the cost of downloading around 10GB
of data ... do people do similar things with CPAN?  How big is CPAN if I
were to attempt this?  Are there snapshot versions of CPAN out there
which don't change (apart from minor bug fixes)?  How long do they last
in that state?

So many questions ... :)


Malcolm Herbert                                This brain intentionally
mjch at mjch.net                                                left blank

More information about the Melbourne-pm mailing list