How can I install a CPAN module into a local directory?

cpan, installation, module, perl

Solution

I had a similar problem, where I couldn't even install local::lib

I created an installer that installed the module somewhere relative to the .pl files

The install goes like:

perl Makefile.PL PREFIX=./modulos
make
make install

Then, in the .pl file that requires the module, which is in ./

use lib qw(./modulos/share/perl/5.8.8/); # You may need to change this path
use module::name;

The rest of the files (makefile.pl, module.pm, etc) require no changes.

You can call the .pl file with just

perl file.pl

Problem

I'm using a hosted Linux machine so I don't have permissions to write into the `/usr/lib` directory. When I try to install a CPAN module by doing the usual: ``` perl Makefile.PL make test make install ``` That module is extracted to a `blib/lib/` folder. I have kept `use blib/lib/ModuleName` but it still the compiler says module can not be found. I have tried copying the .pm file into local directory and kept `require ModuleName` but still it gives me some error. How can I install a module into some other directory and use it?

Original source

Related problems