LPM: How do you use CPAN?

Frank Price fprice at mis.net
Thu Apr 13 22:33:04 CDT 2000


On Thu, Apr 13, 2000 at 11:12:51PM +0000, Michael Wallace wrote:
> Could someone give me a good description on how to use CPAN?  I am a newbie
> in this Perlish world, and need some help getting some modules.
> Specifically, I do not have root permission on the box I'm using, and so I
> want to install the modules under my personal directory.  How do I direct
> the install to install in my directory and not in
> /path/to/where/perl/is/installed/ ??  

The way I usually do this is to build the module "by hand."  Another
way, and a very nice one, is to use the CPAN module itself -- but I
don't know how to make it install somewhere different and a quick
'perldoc CPAN' didn't help.  Maybe someone knows?

Anyway, I assume you can find your module du jour and download into
someplace like ~/tmp/.  Then do this (*nix bias):

	$ cd ~/tmp/
	$ tar xzvf Good-Module-6.6.6.tar.gz  # uncompress and unpack
	$ cd Good-Module-6.6.6/				 # 
	$ perl Makefile.PL LIB=~/perllib	 # will install into ~/perllib
	$ make								 # create module
	$ make install					 	 # install it.

> Secondly, once I get the modules
> installed, what do I need to do to get my program to locate the modules
> since they are in an uncommon place (i.e. my directory)??

Put this at the top of your program:

  use lib '/home/me/perllib';

Note that the ~ doesn't expand; neither does $ENV{'USER'}.

For more info run 'perldoc perlmodinstall'.

HTH,

-Frank.
-- 
Frank Price -oOo- fprice at mis.net -oOo- www.sxse.org/fprice/
GPG fingerprint: A34A 793E A408 9096 DA0C  33BA 164D 7F6D 3960 C7A9
GPG key: www.sxse.org/fprice/gpg.asc




More information about the Lexington-pm mailing list