Friday, January 20, 2012

Setting up a mini CPAN for private modules (Windows 2003 x64)

Set up CPAN::Mini

  1. Install the CPAN::Mini module.
  2. Create the file structure where the mini CPAN be.
  3. D:/www/MINICPAN
    D:/www/MINICPAN/authors
    D:/www/MINICPAN/authors/01mailrc.txt.gz (empty file)
    D:/www/MINICPAN/modules
    D:/www/MINICPAN/modules/02packages.details.txt.gz (empty file)
    
  4. Create the config file lib/CPAN/Mini/minicpan.conf (this is needed particularly for using CPAN::Mini::Webserver) with the following contents.
  5. local:  D:/www/MINICPAN/
    remote: http://mirror.optusnet.com.au/CPAN/ # or some other mirror from http://www.cpan.org/SITES.html
    exact_mirror: 1
    
  6. Set the CPAN_MINI_CONFIG environment variable to point to lib/CPAN/Mini/minicpan.conf. (Even though the conf file was created in a default location, this is not recognised in Windows.)

I didn't execute minicpan, because I only wanted my own private modules in here. But if I were to run it (which would have set up the mini CPAN for me):

minicpan -l D:/www/MINICPAN/ -r http://mirror.optusnet.com.au/CPAN/ # or some other mirror from http://www.cpan.org/SITES.html

Set up the webserver

  1. Install CPAN::Mini::Webserver module
  2. Execute minicpan_webserver

Set up CPAN::Mini::Inject

  1. Install the CPAN::Mini::Inject module.
  2. Create the config file D:/.mcpani/config with the following contents.
  3. local: D:/www/MINICPAN
    remote: ftp://ftp.cpan.org/pub/CPAN ftp://ftp.kernel.org/pub/CPAN
    repository: D:/MINICPAN
    passive: yes
    dirmode: 0755
    
  4. Set the MCPANI_CONFIG environment variable to D:\.mcpani\config.

Using the mini CPAN

  1. Upload modules to the mini CPAN.
  2. # add your modules to a repository
    mcpani --add --module My::Module --authorid STEVENL --modversion 0.001 --file My-Module-0.001.tar.gz
    # upload the repository modules into mini CPAN
    mcpani --inject
    
  3. Install modules from the mini CPAN (using cpanminus).
  4. cpanm --mirror file://D:/www/MINICPAN My::Module
    cpanm --mirror http://[SERVER:PORT] My::Module
    

1 comment:

  1. very good explanation, but not worjing under windows 7:
    cpanm --mirror c:\Users\TOSH\Documents\GitHub\mirror --mirror-only Genealogy::Gedcom
    ! cannot open file '/.cpanm/sources/c%Users%TOSH%Documents%GitHub%mirror/02packages.details.txt.gz': No such file or directory opening compressed index
    ! Couldn't find module or a distribution Genealogy::Gedcom ()

    ReplyDelete