Carrying (mini)CPAN

Thanks to minicpan, I keep a local copy of the latest versions hosted on CPAN. Running minicpan weekly, I keep it up to date. My .minicpanrc file:
local: /home/netbook/minicpan/miniCPAN_20140405/
remote: http://your.favorite.cpan.mirror/
also_mirror: indices/ls-lR.gz
Now, I want to carry my local minicpan keeping it on a memory stick. Changing .minicpanrc to:
local: /media/USB16GB/miniCPAN_20140405/
remote: file://home/netbook/minicpan/miniCPAN_20140405/
also_mirror: indices/ls-lR.gz
and running minicpan again, sweeps my minicpan onto my stick. Fine. Now, I can install any module offline (as long as specific version dependencies are satisfied). Just mount my stick and either, first time running cpan:
Would you like to configure as much as possible automatically? [yes]
sites for you? (This means connecting to the Internet) [yes] no
Would you like to pick from the CPAN mirror list? [yes] no
Please enter your CPAN site: [] file:///mnt/minicpan
Enter another URL or ENTER to quit: []
New urllist

Autoconfiguration complete.
commit: wrote '/home/userOne/.cpan/CPAN/'

or by modifying manually ~/.cpan/CPAN/
'urllist' => [q[file:///mnt/minicpan]],
So, it's easy installing modules on offline systems or installing apps on user (e.g. /home/user) Perls.

After discovering how to comment, my .minicpanrc looks like:
## web ---> local disk (computer A)
#local: /home/netbook/minicpan/miniCPAN_20140414/
#remote: http://your.favorite.cpan.mirror/
#also_mirror: indices/ls-lR.gz

## local disk (computer A) ---> USB
local:  /media/USB16GB/miniCPAN_20140414/
remote: file://home/netbook/minicpan/miniCPAN_20140414/
also_mirror: indices/ls-lR.gz

## USB ---> local disk (computer B)
#local:  /home/dan/miniCPAN/miniCPAN_20140414/
#remote: file://media/usb/miniCPAN_20140414/
#also_mirror: indices/ls-lR.gz


The cpan(1) command also has the -j option to load any config file you like. You can create a wrapper program on the memory stick so everything you need is right there. That program can even figure out where it is mounted. :)

Leave a comment

About fishy

user-pic I blog about Perl.