Skip to content

Installation of cpan modules by cpanm and cpanfile

Roger Crew edited this page Sep 24, 2013 · 2 revisions

Download cpanm

Donwload cpanm.

curl -LO http://xrl.us/cpanm

Write cpanfile

Write cpanfile. cpanfile is file to specify module version. Let's create file which name is cpanfile.

Example:

requires 'DBI', '== 1.619';
requires 'DBD::SQLite', '== 1.36_04';
requires 'DBIx::Custom', '== 0.25';

Syntax:

requires MODULE_NAME VERSION

You can use the following version expression.

<MEANING>               <EXPRESION>            <EXAMPLE>
equal                   == VERSION              == 0.03
greater than or equal   VERSION or >= VERSION  0.03 or >= 0.03
lower than or equal     <= VERSION             <= 0.03
greater than            > VERSION              > 0.03
lower than              < VERSION              < 0.03

Install modules

You can install modules using cpanfile in current directory by --installdeps option of cpanm.

perl cpanm --installdeps .

You can also install modules into specified directory by -L option.

perl cpanm -L extlib --installdeps .
Clone this wiki locally