Creating a mini-mirror with the cpan CPAN :: Mini

February 5, 2010 · Posted in Perl

DEPRECATED: This text has been obsoleted by the text Perl increasingly easy .

Online since 26/10/1995, with 17,365 modules written by 7930 authors (until the time of writing this post), the CPAN is the official repository of Perl modules. In it we often find hundreds of ready modules for various tasks. This is one of the facilities that make Perl programmers are so efficient.

However, reliance on an internet connection to install new modules, is sometimes an obstacle to the use of this powerful tool. But as in Perl there is always more than one way to do this post will show you how to create a mini-mirror the cpan to be used in environments where an internet connection is not always possible.

After you configure the application to install cpan modules locally with local :: lib , the first step is to configure the mirror to install and configure the module CPAN :: Mini and its applications.

There are several ways to configure minicpan. The one I use is that which is done through a configuration file called. Minicpanrc to be created in the user's home directory. He only has two lines as follows:

  A
 2
  Local / minicpan
 remote: http://www.cpan.org 

The first line indicates what directory the files will be the mirror, while the second indicates where the information about the packages will be downloaded.

That done, we can install the module CPAN :: Mini with the command:

  A
  user @ host: ~ $ cpan CPAN :: Mini 

After installing the module, run the command minicpan that will synchronize the repository specified in 'remote' from. Minicpanrc with the repository on the Internet. This part may take from a few minutes to several hours depending on the speed of its link.

  A
 2
 3
 4
 5
 6
 7
  perl-user @ host: ~ $ minicpan
 authors/01mailrc.txt.gz ...  updated
 modules/02packages.details.txt.gz ...  updated
 modules/03modlist.data.gz ...  updated
 authors/id/A/AA/AAYARS/Devel-Ladybug-0.406.tar.gz ...  updated
 authors / id / A / AA / AAYARS / checksums ...  updated
 ... 

The last step is to configure the application to use cpan mirror site as our first option to download. This is done by the cpan prompt:

  A
  cpan> o conf urllist unshift file :/ / / home / blabos / minicpan 

Where / home / blabos is the user's home directory, in my case, blabos, and minicpan is the directory that configure the option 'local' the. Minicpanrc.

With these simple step, we build a mini-mirror the cpan to be used in environments with little or no Internet access. Additionally, the mirror to replicate on other machines, just copy the directory minicpan and add it as a download option for the command cpan (last step described above).

My sincere thanks to edenc who first told me about the minicpan, by Randal Schwartz, who wrote the original script and Ricardo minicpan SIGNES that Randal turned the script into a module.

If you want to know more about, check out the original article from Randal or online documentation of the module .

Comments

  • http://blog.blabos.org/2011/01/perl-cada-vez-mais-facil/ Perl increasingly easy: Blog Blabos of Blebe

    [...] Some old posts I showed how to configure the application cpan, install modules in the user's home and create [...]

blog comments powered by Disqus