question on installing perl modules

question on installing perl modules

am 23.01.2011 20:30:43 von aw

Hi.

This is not directly a question on mod_perl, apologies.
But I figure that there should be the required expertise on this list to which I am
subscribed.

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 did what is indicated in the perldoc of CPAN.pm (FAQ section), namely set

o conf makepl_arg "LIB=~/myperl/lib \
INSTALLMAN1DIR=~/myperl/man/man1 \
INSTALLMAN3DIR=~/myperl/man/man3 \
INSTALLSCRIPT=~/myperl/bin \
INSTALLBIN=~/myperl/bin"

and it seems to be doing what I want, except that it insists on trying to install the
documentation in "/opt/perl32/man/man3", to which I do not have write permissions.
Therefore it breaks down at the install step, and does not install.

Am I forgetting something ? is there something inaccurate or outdated in the above ? is
there a way to get past it ?

Thanks in advance for any tips

Re: question on installing perl modules

am 23.01.2011 20:56:56 von Adam Flott

This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.

--8323329-1939708547-1295812616=:20271
Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8BIT

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.


Adam
--8323329-1939708547-1295812616=:20271--

Re: question on installing perl modules

am 23.01.2011 21:35:11 von aw

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.)

I also read the doc of local::lib, and for that one it does not seem that you need to be
root, but it seems a bit more complicated to handle.

Re: question on installing perl modules

am 23.01.2011 22:00:43 von Adam Flott

This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.

--8323329-1895448551-1295816393=:20271
Content-Type: TEXT/PLAIN; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8BIT
Content-ID:



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.
--8323329-1895448551-1295816393=:20271--

Re: question on installing perl modules

am 24.01.2011 07:18:50 von Octavian Rasnita

Another solution might be to install Perl in your home directory where you
have privileges, then to install any module for it.

--Octavian

----- Original Message -----
From: "Adam Flott"
To:
Cc: "mod_perl list"
Sent: Sunday, January 23, 2011 11:00 PM
Subject: Re: question on installing perl modules


>
>
> 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.

Re: question on installing perl modules

am 24.01.2011 08:37:30 von aw

Octavian Rasnita wrote:
> Another solution might be to install Perl in your home directory where
> you have privileges, then to install any module for it.
>
> --Octavian
>
> ----- Original Message ----- From: "Adam Flott"
> To:
> Cc: "mod_perl list"
> Sent: Sunday, January 23, 2011 11:00 PM
> Subject: Re: question on installing perl modules
>
>
>>
>>
>> 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.
>
>
local::lib seems to work when I try it on one of my own test systems.
I will try cpanm later today, and then I can try them again on the customer system to
which I do not have root access.
Anyway, I consider myself helped.

Thanks for the tips.

Re: question on installing perl modules

am 25.01.2011 18:29:40 von aw

marco.masetti@softeco.it wrote:
> Hi André ,
>
> use local::lib:
>
> http://search.cpan.org/~apeiron/local-lib-1.008001/
>
> it nicely handles your issue.
>
By the way, I tried to use local::lib "out of the box", and could not install it.
I think it is because the Makefile relies on a GNU make, and the HPUX host I was trying
this on, has another version of make.
That version chokes on the last 2 lines of the Makefile generated by local::lib's
Makefile.pl, and which look like this :

PERL += -Ietc...
FULLPERL += -Ietc....

The error is something like :
missing separator on line 838
missing separator on line 839

(Apologies for not being more precise, but I do not have access to that system right now)

Not being a great specialist of make (or in fact of anything), I figured that the HPUX
version of make does not like these "+=" operators, but I did not know how to correct
these 2 lines. Of course not being root, I cannot easily install a GNU make on that
system either.

Anyway, in fits and starts, by trying things derived from what I understood of the docs of
local::lib about what local::lib does, I did in the end manage to get CPAN configured in
such a way that it does install perl modules under my own chosen directory, while not root.

The gist of the matter is : if you do not have access to the target system as root *at any
time*, it is quite tricky to get this done.

For example, on another system which I was using to "practice" this first, I could simply
not run "perl -MCPAN ..", because there was a lockfile /root/.cpan/.lock, leftover I
suppose from an aborted root session with CPAN, and when I tried to run CPAN with another
user (to do a "o conf init"), it threw me out each time, because it was still trying to
use the default CPAN parameters (from the /root/.cpan directory), and choking on this
leftover .lock file, which could not be removed of course because it was owned by root.
Fortunately, on that particular system I did have root access, so I could go and remove
that .lock file. Had I been on the real target system, I would have been stuck right there.