Saturday, June 30, 2007

Gentoo: Installing perl modules using CPAN

After seeing this interesting example - http://secviz.org/?q=node/74, I feel like trying out afterglow with argus on my gentoo laptop. I install graphviz with emerge and download afterglow instantly.

shell>wget \ http://optusnet.dl.sourceforge.net/sourceforge/afterglow/afterglow-1.5.7.tar.gz

shell>tar xvzf afterglow-1.5.7.tar.gz

I try to run afterglow and I get an error -

Can't locate Text/CSV.pm in @INC (@INC contains: /etc/perl /usr/lib/perl5/vendor_perl/5.8.8/i686-linux /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib/perl5/site_perl/5.8.8/i686-linux /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/5.8.8/i686-linux /usr/lib/perl5/5.8.8 /usr/local/lib/site_perl .) at /home/geek00l/i-Apps/afterglow/src/perl/graph/afterglow.pl line 111.
BEGIN failed--compilation aborted at /home/geek00l/i-Apps/afterglow/src/perl/graph/afterglow.pl line 111.

Since CSV.pm is not ported to gentoo portage, I have to use cpan instead -

shell>export LANG=en_US shell>perl -MCPAN -e shell

Your configuration suggests that CPAN.pm should use a working
directory of
/home/geek00l/.cpan
Unfortunately we could not create the lock file
/home/geek00l/.cpan/.lock
due to permission problems.

Please make sure that the configuration variable
$CPAN::Config->{cpan_home}
points to a directory where you can write a .lock file. You can set
this variable in either
/usr/lib/perl5/5.8.8/CPAN/Config.pm
or
/home/geek00l/.cpan/CPAN/MyConfig.pm

Could not open >/home/geek00l/.cpan/.lock: Permission denied

Permission problem, easily solved with sudo -

shell>sudo perl -MCPAN -e shell

cpan shell -- CPAN exploration and modules installation (v1.7602)
ReadLine support enabled

cpan> test Text::CSV
CPAN: Storable loaded ok
Going to read /home/geek00l/.cpan/Metadata
Database was generated on Wed, 28 Feb 2007 06:09:10 GMT
LWP not available
CPAN: Net::FTP loaded ok
Fetching with Net::FTP:
ftp://ftp.perl.org/pub/CPAN/authors/01mailrc.txt.gz
Going to read /home/geek00l/.cpan/sources/authors/01mailrc.txt.gz
LWP not available
Fetching with Net::FTP:
ftp://ftp.perl.org/pub/CPAN/modules/02packages.details.txt.gz
Going to read /home/geek00l/.cpan/sources/modules/02packages.details.txt.gz
Database was generated on Thu, 07 Jun 2007 03:09:14 GMT
HTTP::Date not available

There's a new CPAN.pm version (v1.9102) available!
[Current version is v1.7602]
You might want to try
install Bundle::CPAN
reload cpan
without quitting the current session. It should be a seamless upgrade
while we are running...

LWP not available
Fetching with Net::FTP:
ftp://ftp.perl.org/pub/CPAN/modules/03modlist.data.gz
Going to read /home/geek00l/.cpan/sources/modules/03modlist.data.gz
Going to write /home/geek00l/.cpan/Metadata
Running test for module Text::CSV
Running make for A/AL/ALANCITT/Text-CSV-0.01.tar.gz
LWP not available
Fetching with Net::FTP:
ftp://ftp.perl.org/pub/CPAN/authors/id/A/AL/ALANCITT/Text-CSV-0.01.tar.gz
CPAN: Digest::MD5 loaded ok
LWP not available
Fetching with Net::FTP:
ftp://ftp.perl.org/pub/CPAN/authors/id/A/AL/ALANCITT/CHECKSUMS
Checksum for /home/geek00l/.cpan/sources/authors/id/A/AL/ALANCITT/Text-CSV-0.01.tar.gz ok
Scanning cache /home/geek00l/.cpan/build for sizes
Text-CSV-0.01/
Text-CSV-0.01/Makefile.PL
Text-CSV-0.01/test.pl
Text-CSV-0.01/README
Text-CSV-0.01/CSV.pm
Text-CSV-0.01/MANIFEST

CPAN.pm: Going to build A/AL/ALANCITT/Text-CSV-0.01.tar.gz

Checking if your kit is complete...
Looks good
Writing Makefile for Text::CSV
cp CSV.pm blib/lib/Text/CSV.pm
AutoSplitting blib/lib/Text/CSV.pm (blib/lib/auto/Text/CSV)
Manifying blib/man3/Text::CSV.3pm
/usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl5.8.8 "-Iblib/lib" "-Iblib/arch" test.pl
1..20
ok 1
ok 2
ok 3
ok 4
ok 5
ok 6
ok 7
ok 8
ok 9
ok 10
ok 11
ok 12
ok 13
ok 14
ok 15
ok 16
ok 17
ok 18
ok 19
ok 20
/usr/bin/make test -- OK

cpan> install Text::CSV
CPAN: Storable loaded ok
Going to read /home/geek00l/.cpan/Metadata
Database was generated on Thu, 07 Jun 2007 03:09:14 GMT
Running install for module Text::CSV
Running make for A/AL/ALANCITT/Text-CSV-0.01.tar.gz
CPAN: Digest::MD5 loaded ok
Checksum for /home/geek00l/.cpan/sources/authors/id/A/AL/ALANCITT/Text-CSV-0.01.tar.gz ok
Scanning cache /home/geek00l/.cpan/build for sizes
Text-CSV-0.01/
Text-CSV-0.01/Makefile.PL
Text-CSV-0.01/test.pl
Text-CSV-0.01/README
Text-CSV-0.01/CSV.pm
Text-CSV-0.01/MANIFEST
Removing previously used /home/geek00l/.cpan/build/Text-CSV-0.01

CPAN.pm: Going to build A/AL/ALANCITT/Text-CSV-0.01.tar.gz

Checking if your kit is complete...
Looks good
Writing Makefile for Text::CSV
cp CSV.pm blib/lib/Text/CSV.pm
AutoSplitting blib/lib/Text/CSV.pm (blib/lib/auto/Text/CSV)
Manifying blib/man3/Text::CSV.3pm
/usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl5.8.8 "-Iblib/lib" "-Iblib/arch" test.pl
1..20
ok 1
ok 2
ok 3
ok 4
ok 5
ok 6
ok 7
ok 8
ok 9
ok 10
ok 11
ok 12
ok 13
ok 14
ok 15
ok 16
ok 17
ok 18
ok 19
ok 20
/usr/bin/make test -- OK
Running make install
Installing /usr/lib/perl5/site_perl/5.8.8/Text/CSV.pm
Installing /usr/lib/perl5/site_perl/5.8.8/auto/Text/CSV/version.al
Installing /usr/lib/perl5/site_perl/5.8.8/auto/Text/CSV/new.al
Installing /usr/lib/perl5/site_perl/5.8.8/auto/Text/CSV/status.al
Installing /usr/lib/perl5/site_perl/5.8.8/auto/Text/CSV/error_input.al
Installing /usr/lib/perl5/site_perl/5.8.8/auto/Text/CSV/string.al
Installing /usr/lib/perl5/site_perl/5.8.8/auto/Text/CSV/fields.al
Installing /usr/lib/perl5/site_perl/5.8.8/auto/Text/CSV/combine.al
Installing /usr/lib/perl5/site_perl/5.8.8/auto/Text/CSV/parse.al
Installing /usr/lib/perl5/site_perl/5.8.8/auto/Text/CSV/_bite.al
Installing /usr/lib/perl5/site_perl/5.8.8/auto/Text/CSV/autosplit.ix
Installing /usr/share/man/man3/Text::CSV.3pm
Writing /usr/lib/perl5/site_perl/5.8.8/i686-linux/auto/Text/CSV/.packlist
Appending installation info to /usr/lib/perl5/5.8.8/i686-linux/perllocal.pod
/usr/bin/make install -- OK

cpan>quit
Lockfile removed.

Now I can use afterglow without much problems. It is decent tool to create network graph if you ask me, my friend mel has done it here with interesting example.

Peace ;]

No comments: