Perl Module Installation in $HOME

2006-08-24 Thread Doug McNutt
At 17:03 +0100 8/24/06, David Cantrell wrote:
Run the CPAN shell as root as all will be well.

Idonwannadodat!

Although I have root privileges on all machines around here there are still two 
of use who install things and I much prefer NOT to step on the War Department's 
toes. She's the one who keeps my Linux OS's up to date and I rarely know 
whether it's Fedora or Ubuntu because I log in from OS neXt..

My solution is to use the --prefix option in ./configure to point to

--prefix $HOME/local

In $HOME/local/ there are the usual directories one of which is 
$HOME/local/bin/ or in some cases $HOME/perl/.  I see to it that the PERL5LIB 
environment variable gets set to one or the other of those. My $PATH is set to 
look at the $HOME/local/bin/ directory first.

The result is that I can compile and install without being root. My stuff does 
not get any chance to screw up something like a system update from Apple or 
some Linux distribution. I happily accept the responsibility for fixing things 
up if such an update requires changes to my stuff. My own perl modules end up 
in $HOME/local so there can be no accidental naming confusion.

The problem is - - - How do I tell cpan to do things that way? - especially 
when there is a batch of dependencies to worry about.

-- 
-- The message came to Abraham that he would beget a son. Sarah, who was 
behind the door, laughed. --


Re: Perl Module Installation in $HOME

2006-08-24 Thread John Delacour

At 11:32 am -0600 24/8/06, Doug McNutt wrote:


At 17:03 +0100 8/24/06, David Cantrell wrote:

Run the CPAN shell as root as all will be well.


Idonwannadodat!

...The result is that I can compile and install without being root. 
My stuff does not get any chance to screw up something like a system 
update from Apple or some Linux distribution. I happily accept the 
responsibility for fixing things up if such an update requires 
changes to my stuff. My own perl modules end up in $HOME/local so 
there can be no accidental naming confusion.


The problem is - - - How do I tell cpan to do things that way? - 
especially when there is a batch of dependencies to worry about.


I have never run the CPAN shell as root and I don't see what problems 
you're referring to.  I just do 'sudo cpan' and everything is 
installed where it should go.



Eremita:~ jd$ sudo cpan
CPAN: File::HomeDir loaded ok

cpan shell -- CPAN exploration and modules installation (v1.87)
ReadLine support enabled

cpan install CGI
CPAN: Storable loaded ok
Going to read /Users/jd/.cpan/Metadata
  Database was generated on Thu, 24 Aug 2006 01:35:30 GMT
Running install for module CGI
...
...
All tests successful, 1 subtest skipped.
Files=18, Tests=503,  3 wallclock secs ( 1.75 cusr +  0.50 csys =  2.25 CPU)
  /usr/bin/make test -- OK
Running make install
Installing /usr/local/lib/perl5/5.8.8/CGI.pm
Installing /usr/local/lib/perl5/5.8.8/CGI/Cookie.pm
Installing /usr/local/share/man/man3/CGI.3
... etc.

cpan



Re: Perl Module Installation in $HOME

2006-08-24 Thread Daniel T. Staal
On Thu, August 24, 2006 2:39 pm, John Delacour said:

 I have never run the CPAN shell as root and I don't see what problems
 you're referring to.  I just do 'sudo cpan' and everything is
 installed where it should go.

 Eremita:~ jd$ sudo cpan

That's running it as root, via sudo.

I don't think it is actually all that big a deal, on your own machine, but
do be aware you are doing it.

Daniel T. Staal

---
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---



Re: Perl Module Installation in $HOME

2006-08-24 Thread Doug McNutt
At 19:39 +0100 8/24/06, John Delacour wrote:
All tests successful, 1 subtest skipped.
Files=18, Tests=503,  3 wallclock secs ( 1.75 cusr +  0.50 csys =  2.25 CPU)
  /usr/bin/make test -- OK
Running make install
Installing /usr/local/lib/perl5/5.8.8/CGI.pm
Installing /usr/local/lib/perl5/5.8.8/CGI/Cookie.pm
Installing /usr/local/share/man/man3/CGI.3
... etc.

I guess I wasn't clear. I want the modules installed in my $HOME directory so 
that they won't

1) Get lost when a newer OS gets installed - especially with Linux.

2) Get in the way of someone else's, the main geek - my wife's, idea of what 
should be there.

Installation in /usr/local gets me into trouble. $HOME/local/bin and the like 
is what I want cpan to use for me. Just downloading source and doing any 
required makes myself seems to work OK except that dependencies get to be a 
PITA. When the module is all perl code there is really nothing to make anyway 
and I can just reload my $HOME directory from a backup.
-- 

-- From the U S of A, the only socialist country that refuses to admit it. --


Re: Perl Module Installation in $HOME

2006-08-24 Thread Joel Rees


I have never run the CPAN shell as root


I beg to disagree ...

and I don't see what problems you're referring to.  I just do 'sudo  
cpan'


unless, of course, you actually do it as something like

sudo -u myuser cpan




Re: Perl Module Installation in $HOME

2006-08-24 Thread Packy Anderson

On Aug 24, 2006, at 5:04 PM, Doug McNutt wrote:
I guess I wasn't clear. I want the modules installed in my $HOME  
directory so that they won't


1) Get lost when a newer OS gets installed - especially with Linux.

2) Get in the way of someone else's, the main geek - my wife's,  
idea of what should be there.


What you're looking for is http://search.cpan.org/~andk/CPAN-1.87/lib/ 
CPAN.pm#5 :

I am not root, how can I install a module in a personal directory?

First of all, you will want to use your own configuration, not the  
one that your root user installed. If you do not have permission to  
write in the cpan directory that root has configured, you will be  
asked if you want to create your own config. Answering yes will  
bring you into CPAN's configuration stage, using the system config  
for all defaults except things that have to do with CPAN's work  
directory, saving your choices to your MyConfig.pm file.


You can also manually initiate this process with the following  
command:


% perl -MCPAN -e 'mkmyconfig'
or by running

mkmyconfig
from the CPAN shell.

You will most probably also want to configure something like this:

  o conf makepl_arg LIB=~/myperl/lib \
INSTALLMAN1DIR=~/myperl/man/man1 \
INSTALLMAN3DIR=~/myperl/man/man3
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 environment  
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.

While we're speaking about $ENV{HOME}, it might be worth  
mentioning, that for Windows we use the File::HomeDir module that  
provides an equivalent to the concept of the home directory on Unix.


Another thing you should bear in mind is that the UNINST parameter  
can be dangerous when you are installing into a private area  
because you might accidentally remove modules that other people  
depend on that are not using the private area.



--
Packy Anderson   
[EMAIL PROTECTED]


La perfection est atteinte non quand il ne reste rien ‡ ajouter, mais  
quand

il ne reste rien ‡ enlever.

(You know you've achieved perfection in design, not when you have  
nothing

more to add, but when you have nothing more to take away.)

 --Antoine de Saint- 
Exupery