Well, if you want to use CPAN to install packages you need that I suppose. It is the configuration file for CPAN and sets where it should install the packages to f.e. But you don’t have to create it manually.
See also http://search.cpan.org/dist/CPAN/lib/CPAN.pm#CONFIGURATION
But that’s unrelated to your original question I’d say.
i have some consitency-errors within the perl - see below
install_cpan_pre.pl
#!/usr/bin/perl
use strict;
use warnings;
use Net::FTP;
use constant HOST => 'ftp.cpan.org';
use constant DIR1 => '/pub/CPAN/authors';
use constant FILE1 => '01mailrc.txt.gz';
use constant DIR2 => '/pub/CPAN/modules';
use constant FILE2 => '02packages.details.txt.gz';
use constant FILE3 => '03modlist.data.gz';
my $ftp = Net::FTP->new(
HOST,
Debug => 0,
Passive => 1,
Timeout => 1
);
$ftp->login('anonymous');
$ftp->cwd(DIR1);
$ftp->ascii;
$ftp->get(FILE1);
$ftp->cwd(DIR2);
$ftp->get(FILE2);
$ftp->size(FILE2);
$ftp->get(FILE3);
$ftp->quit;
}
See how i go on - and what is happening
#!/usr/bin/perl
use strict;
use warnings;
use YAML;
use YAML::Dumper;
use Parse::CPAN::Authors;
my $list = '/root/01mailrc.txt.gz';
my $p = Parse::CPAN::Authors->new( $list );
my @authors = $p->authors;
my $dumper = YAML::Dumper->new;
$dumper->indent_width(1);
print $dumper->dump({dump => $p}
some bad things happen
martin@linux-70ce:~/perl> perl cpan2.pl
Failed to read /root/01mailrc.txt.gz: no permission at /usr/lib/perl5/site_perl/5.18.1/Parse/CPAN/Authors.pm line 22.
martin@linux-70ce:~/perl>
guess that i have to put the file into another path
Well, isn’t it obvious?
You apparently downloaded it as root and are trying to access it as user.
chmod or chown should help. Or just download it again as user.
And a different path would not hurt either, yes. But you would have to change it in your cpan2.pl as well.
Why not just use the current directory there?
i.e. in line#9: