CPAN::Mini::Inject doesnt update 03modlist.data.gz

439 views Asked by At

I have an intention of creating a empty local CPAN directory, and then inject the modules i need with the right version numbers.

So, i create a CPAN structure with CPAN::Mini like this:

my $local = '/tmp/CPAN';

my $minicpan = CPAN::Mini->new(
remote => "http://mirrors4.kernel.org/cpan/",
  local  => $local,
  passive  => 'yes',
  dirmode => 0755,
  repository => $local,
  module_filters => [ sub { $_[0] !~ m/No::Giro/i } ], #Thus us just to fetch this module only
  trace => 1                               
);

mkdir($local."/authors") or die("Could not create authors folder");

mkdir($local."/modules") or die("Could not create modules folder");

my @files = ('authors/01mailrc.txt.gz', 'modules/02packages.details.txt.gz', 'modules/03modlist.data.gz');
foreach my $file (@files){
  print "Creating file $local/$file \n";
  open(FILE, "+> $local/$file") or die("Could not create $local/$file");;
  close (FILE);  
}

And then i try to inject a module with CPAN::Mini::Inject:

use strict;
use warnings;
use Getopt::Long;
use CPAN::Mini::Inject;


my $module    = undef;
my $authorid  = undef;
my $version   = undef;
my $file      = undef;

GetOptions(
  "module=s"      => \$module,
  "authorid=s"    => \$authorid,
  "version=s"     => \$version,
  "file=s"        => \$file,
);

die ("--module not provided") if(!defined($module) || $module eq '');
die ("--authorid not provided") if(!defined($authorid) || $authorid eq '');
die ("--version not provided") if(!defined($version) || $version eq '');
die ("--file not provided") if(!defined($file) || $file eq '');


die("File $file does not exists") unless ((-e $file) || (-f $file) );
my $mcpi = CPAN::Mini::Inject->new;
$mcpi->loadcfg('/tmp/minicpan.conf');
$mcpi->parsecfg();
$mcpi->readlist();

$mcpi->add(
  module   => $module, 
  authorid => $authorid, 
  version  => $version, 
  file     => $file );
$mcpi->inject(1);
$mcpi->writelist();
exit(0);

But the 03modlist.data.gz file isnt getting updated (So its empty), so when i try to use cpan with the local repository i get and error which is related to this file. Does anyone know how to generate a valid modlist file? Or how to get CPAN::Mini or CPAN::Mini::Inject to do it for you?

Best regards

1

There are 1 answers

1
brian d foy On BEST ANSWER

The 03modlist.data.gz is a dead file. It used to mean something but it doesn't anymore even if some tools try to use it. For the MyCPAN stuff, I just create an empty file:

File:        03modlist.data
Modcount:    0
Date:        Fri, 01 Apr 2011 03:28:16 GMT

package CPAN::Modulelist;
sub data { my $result = {} }
$CPAN::Modulelist::cols = [];
$CPAN::Modulelist::data = [];

Which command was giving you a problem, what was the error message, and so on?

And, whenever you want to know how to make one of the CPAN index files, just look at the same file on the full CPAN for an example. :)