Friday, September 7, 2012

Perl modules

You have already met this
Can't locate PerlIO/gzip.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at ...
because sometimes you have to install perl modules in non-standard folders (e.g. you are not root at the machine). How to solve it?

There is guide how to install perl module to specified folder
http://modperlbook.org/html/3-9-1-Installing-Perl-Modules-into-a-Nonstandard-Directory.html
In few steps:

perl Makefile.PL PREFIX=/your/folder
make
make install


  • export variable PERL5LIB to /your/folder/lib/perl/5.10.1
Now it should work.

To see what is in your @INC, run

perl -V
To test your module run
perl -Mmodule_name -e ''