 |
 |
Where do local Perl modules go?
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jun 2002
Status:
Offline
|
|
Hello.
Okay, I've got a few perl modules I need to install. I'm not big on CPAN (I prefer to run my own perl Makefile.PL, make, make test, make install).
I've read somewhere (although I can't find the webpage) that it is a good idea to install custom perl modules into /usr/local to avoid messing up MacOS X's default perl modules.
I'm trying to figure out how this should work.
Do I just create a directory in /usr/local/<perl module director>. Add it to the @INC path for perl?
If so, how do I tell future perl modules I want to use where to look for previously installed perl modules?
Finally, how do I uninstall a module that I don't want anymore?
Does this make any sense?
|
|
PowerBook G4 800Mhz
1GB RAM
60GB 7200rpm Hard Drive
Running Tiger
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Oct 2000
Location: Midwest
Status:
Offline
|
|
When you first install CPAN using sudo perl -MCPAN -eshell you will be presented with the option of configuring your installation. You can specify where you want the modules. I've used /usr/local/perl and ~/perl. Currenly /usr/local/perl has my modules. The CPAN installation willl create directories where needed.
In the info presented when first installing, the command to re-configure is given. You can Google OS X CPAN to get lots of help.
Craig
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Feb 2001
Location: Manhattan
Status:
Offline
|
|
or if you insist on continuing to use the configure/make/install method, i think you can do something like this:
Code:
./configure --prefix=/usr/local
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Nov 2001
Location: Adelaide, South Australia
Status:
Offline
|
|
Originally posted by GATTACA:
I've read somewhere (although I can't find the webpage) that it is a good idea to install custom perl modules into /usr/local to avoid messing up MacOS X's default perl modules.
I'm trying to figure out how this should work.
Do I just create a directory in /usr/local/<perl module director>. Add it to the @INC path for perl?
If so, how do I tell future perl modules I want to use where to look for previously installed perl modules?
I'm not sure, but I wonder whether you're slightly misunderstanding
the advice. If you install modules they'll go into a site-perl directory (relative to your current perl installation), and this won't be touched if Apple chooses to install a later Perl.
The /usr/local recommendation is probably for if you choose to install a new version of Perl yourself. This is pretty easy to do (5.8.5 compiles out of the box on Panther for example), and the default is for everything to live in /usr/local/. The perl binaries are thrown in /usr/local/bin, the modules are in /usr/local/lib/perl5/... and so forth.
In short, I'd just install the modules into the standard location and trust the directory structure to do the right thing with respect to possible upgrades.
Cheers,
Paul (happily running the 5.8.1 stock perl and 5.8.5 in /usr/local)
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jun 2002
Status:
Offline
|
|
Thanks for all of your replies.
I'm liking this CPAN idea.
The only concern I have is what if I want to uninstall a CPAN module? Is this easy to do?
|
|
PowerBook G4 800Mhz
1GB RAM
60GB 7200rpm Hard Drive
Running Tiger
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jun 2002
Status:
Offline
|
|
Tried the CPAN idea. Doesn't work.
It seems I need root access to install the modules. Since this particular powerbook isn't mine, I our tech support is a little uneasy about granting a user root access.
So back to square one I guess.
|
|
PowerBook G4 800Mhz
1GB RAM
60GB 7200rpm Hard Drive
Running Tiger
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Feb 2001
Location: Manhattan
Status:
Offline
|
|
you can configure cpan to install into any directory you want...for instance a ~/perl/lib directory. Edit the file:
Code:
~/.cpan/CPAN/MyConfig.pm
And modify/add the hash item makepl_arg with the following string:
Code:
q[ LIB=/Users/USERNAME/perl/lib
INSTALLMAN1DIR=/Users/USERNAME/perl/man/man1
INSTALLMAN3DIR=/Users/USERNAME/perl/man/man3]
You will be able to then maintain your own little library of perl modules. Just make sure to add the lib directory to your path in your scripts that use one of the new modules:
Code:
use lib qw(/Users/USERNAME/perl/lib);
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jun 2002
Status:
Offline
|
|
I finally solved my problems!
I convinced the IT people that installing perl 5.8.5 on the powerbook would in no way damage it (thanks to Paul McCann here).
So I downloaded the latest Perl source code and compiled it. and put it into my path. Now when I use CPAN, everything gets installed into my local ~/perl directory and it works! No hicups!
Thanks for your comments everyone!
|
|
PowerBook G4 800Mhz
1GB RAM
60GB 7200rpm Hard Drive
Running Tiger
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|