Re: question on installing perl modules

Adam Flott <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>

On Sun, 23 Jan 2011, André Warnier wrote:

> Adam Flott wrote:
>> On Sun, 23 Jan 2011, André Warnier wrote:
>> 
>>> My problem : I am trying to install a CPAN module, from CPAN, into a 
>>> "custom" location rather than the system perl locations.
>>> This is a hpux system where I have no root access, and in this case the 
>>> specific module is XML::SAX.
>> 
>> I don't know how to fix your exact problem (may be a bug in
>> ExtUtils::MakeMaker, CPAN, etc), but you could give cpanm a try:
>> 
>> http://search.cpan.org/perldoc?App::cpanminus
>> 
>> It has made my life significantly easier.
>> 
>> There is also local::lib (http://search.cpan.org/perldoc?local::lib) which
>> others are quite fond of, but I don't have any personal experience with it.
>> 
>> 
> Hi.
> Many thanks for the pointers.  In the principle, it does look like what I 
> need.
>
> But I just read the doc of App::cpanminus.
> Do I understand it correctly, that at some point, you need to be root on the 
> machine ?
> (Because on that target machine, that's something I can definitely never be, 
> even for a short moment.)
>

When running as a non-root user:

$ cpanm Cwd 
!
! Can't write to /usr/local/share/perl/5.10.1 and /usr/local/bin: Installing
modules to /home/aflott/perl5
! To turn off this warning, you have to do one of the following:
!   - run me as a root or with --sudo option (to install to
/usr/local/share/perl/5.10.1 and /usr/local/bin)
|   - run me with --local-lib option e.g. cpanm --local-lib=~/perl5
!   - Set PERL_CPANM_OPT="--local-lib=~/perl5" environment variable (in your
shell rc file)
!   - Configure local::lib in your shell to set PERL_MM_OPT etc.
!

Therefore, I usually set PERL_CPANM_OPT. It uses INSTALL_BASE (see
ExtUtils::MakeMaker docs) to make a "cleaner" install.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.