http://qs1969.pair.com?node_id=405018

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Has anyone ever successfully used the cpan mod to install mods into your home directory. I don't have root access and I get tired of doing this stuff manually.

It seems that there should be some way to do something like perl -MCPAN -e 'install Some::Module' PREFIX=/home/me

Thanks!
Toby

Replies are listed 'Best First'.
Re: Using CPAN to install in /home/dir
by neilh (Pilgrim) on Nov 03, 2004 at 22:47 UTC
    Hi Toby,

    From

    perldoc CPAN 5) I am not root, how can I install a module in a per- sonal directory? You will most probably like something like this: o conf makepl_arg "LIB=~/myperl/lib \ INSTALLMAN1DIR=~/myperl/man/man1 \ INSTALLMAN3DIR=~/myperl/man/man3" install Sybase::Sybperl You can make this setting permanent like all "o conf" settings with "o conf commit". You will have to add ~/myperl/man to the MANPATH envi- ronment variable and also tell your perl programs to look into ~/myperl/lib, e.g. by including use lib "$ENV{HOME}/myperl/lib"; or setting the PERL5LIB environment variable. Another thing you should bear in mind is that the UNINST parameter should never be set if you are not root.
    Neil
Re: Using CPAN to install in /home/dir
by itub (Priest) on Nov 03, 2004 at 22:26 UTC
    You can set

    makepl_arg' => q[PREFIX=/home/me],

    in your ~/.cpan/CPAN/MyConfig.pm file. (There's also a way of doing it from the CPAN shell, but I always forget and find it easier to edit the file manually.)

      Thanks to all for your suggestions. I used the makepl_arg suggestion and it worked nicely!

      Regards,
      Toby
Re: Using CPAN to install in /home/dir
by Nitrox (Chaplain) on Nov 03, 2004 at 22:49 UTC
    Also, when installing subsequent modules make sure PERL5LIB is set properly so that any module pre-reqs can be found.

    -Nitrox

Re: Using CPAN to install in /home/dir
by saintmike (Vicar) on Nov 04, 2004 at 15:25 UTC
    In case you can read German, here's a Linux Magazin article on it.