[Melbourne-pm] caching CPAN dist files
jarich at perltraining.com.au
Wed Apr 20 17:27:25 PDT 2011
Malcolm Herbert wrote:
> 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.
An alternative solution is as follows, although this can be overkill.
CPAN::Mini allows you to create a mirror of CPAN. The latest and
greatest of everything right now. App::cpanminus is CPAN::Mini aware, so
you can tell it to install from your mirror rather than CPAN directly.
Then you can use local::lib to refer to handle having everything
installed into a local location (App::cpanminus is local::lib aware too).
One not-so-obvious gotcha is that if you're using perlbrew as well, then
you need to install App::cpanminus for each new version of Perl you
install with perlbrew. I'm not exactly sure why, but App::cpanminus
forms an opinion on your version of Perl when you install it; and even
if you then invoke it later with a different (younger) version of Perl
in your path, it'll still baulk on version dependencies.
All the best,
More information about the Melbourne-pm