Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I install local modules with the cpan tool?

my admin has given me sudo rights for

cpan

I also need to install a couple of non-CPAN modules (Atlassian Crowd -> svn connector) to the global PERL5LIB.

I vaguely remember that cpan can install from local sources, without pulling modules from the web.

any pointers? can I do it or should I just have him install those modules manually as root (a major hassle for me)? thanks!

like image 697
webwesen Avatar asked Dec 30 '22 14:12

webwesen


2 Answers

If you want to install the Perl distribution in the current directory, use the dot instead of a filename:

 cpan .

If you are using one of the latest versions of the cpan program (not the one that currently comes with CPAN.pm), you can use the -j switch to specify an alternate configuration file where you can set the --install_base or INSTALL_BASE directives, and also set values for options like connect_to_internet_ok.

 cpan -j /path/to/Config.pm Foo::Bar

If you want to modify your current config to make your alternate config file, use -J to get the file text:

 cpan -J

Ideally, instead for giving you superuser priveleges, that sysadmin would have created a group for Perl admins, would have specified a directory for module installations owned by that group, and added you to that group. You wouldn't need any special powers then.

like image 104
brian d foy Avatar answered Jan 01 '23 04:01

brian d foy


You don't actually need your admin to give you rights to install CPAN modules. In fact local::lib is a better solution for a number of reasons.

like image 43
singingfish Avatar answered Jan 01 '23 03:01

singingfish