2012年5月25日 星期五

How to Use CPAN to Install Perl Module and Script

CPAN stands for “Comprehensive Perl Archive Network”.   It provides many useful perl modules.

Method 1: manually install

(i) Download the tarball from CPAN

(ii) tar zxvf tarball

(iii) cd decompressed directory, then ‘perl Makefile.PL’.  It there is dependency error, go to step (i)

(iv) ‘make’, then ‘make test’, then ‘make install’.

Pro: Method 1 works both for install module (WWW::Extractor) and script (e.g. xls2csv)

Con: Method 1 is time consumping to deal with dependency error!!

 

 

Method 2: auto install Module

(i) type “cpan”,  set urllist by “o conf init urllist –> http://cpan.develooper.com/

(ii) install CPAN to install the updated cpan.   then “reload cpan”

(ii) perl –MCPAN –e ‘install module’   e.g. perl –MCPAN –e ‘install WWW::Extractor’

Pro: Method 2 solve the dependency issues by cpan automatically!!

Con: Method 2 only works with module,  NOT work with script, e.g. “xls2csv”!

Need to do perl –MCPAN –e ‘install K/KE/KEN/xls2csv-1.06.tar.gz’

沒有留言:

張貼留言

追蹤者