title: How to automate module installation from a local MiniCPAN repository?
body: <p>Having problems getting CPAN to work with a MiniCPAN repository from within a script (aim is a code deployment system to build local modules together with modules from CPAN, install to a local-lib, and then sync out to servers)</p>
  
  <p><code>$HOME/.cpan/CPAN/MyConfig.pm</code> exists, with urllist set to <code>['file:///home/user/minicpan/']</code></p>
  
  <p>The (non-CPAN) module distribution was injected sucessfully into the minicpan repo, and file exists: e.g. <code>/home/user/minicpan/authors/U/US/USER/My-Module-0.01.tar.gz</code>.</p>
  
  <p>The author is in <code>.../01mailrc.txt.gz</code>, module is in <code>.../modules/02packages.details.txt.gz</code></p>
  
  <p>The module is found and installs via the cpan shell.</p>
  
  <p>Fails through following code:</p>
  
  <pre><code>CPAN::HandleConfig-&gt;load;
  CPAN::Shell::setup_output;
  CPAN::Index-&gt;reload;
  
  # dumping config here shows urllist set correctly,
  # and config exactly the same as through shell
  use Data::Dumper;
  $Data::Dumper::Sortkeys = 1;
  print Dumper($CPAN::Config);
  
  CPAN::Shell-&gt;install("My::Module");
  </code></pre>
  
  <p>Either doesn't find module (<code>"Cannot install My::Module, don't know what it is."</code>) or claims is up to date (<code>My::Module is up to date (0.01)</code>)</p>
  
  <p>Module is not installed in the local-lib (and not anywhere else on machine, e.g. in /usr/...)
  Local-lib environment variables are set via
  <code>eval $(perl -I$HOME/foo/lib/perl5 -Mlocal::lib=$HOME/locallib)</code> in bash profile</p>
  
  <p>After getting either error (including 'Module is up to date'), a normal 'install' in the shell works without force, as does <code>perl -MCPAN -e "install My::Module"</code>, so I presume it's the config not set correctly, but the CPAN.pm docs are rather hard to follow...</p>
  
  <p>(CPAN.pm is v1.9402)</p>