[Israel.pm] using modules
oferk at oren.co.il
Thu May 20 00:00:58 PDT 2004
> I am using hp-unix, and I am not an administrator.
Installing modules manually with the PREFIX option passed to "./configure"
and then doing "use lib" in your scripts would work, but module dependencies
would be a bitch to manage. Much better for you to let CPAN do the work for
I did this once a long time ago, and all I can say is that it was not
trivial (automatic) but eventually I got it to work. Simply put, the first
time you run CPAN.pm from the command line:
perl -MCPAN -e shell
It will ask you to configure it. See:
for details. Anyway, the way I remember it, I couldn't exactly get it to do
a local install through this initial dialog, so eventually I ran it once and
then edited the configuration file:
by hand. If you do, make sure that anywhere there is a path it points to
your home dir, for example:
'makepl_arg' => q[PREFIX=/home/dir/my/CPAN],
I also had some problems with the default method of using ftp, I think
because I'm behind a firewall. I decided to use wget, I must say it is very
good. Finally, I also edited the list of CPAN mirrors byt hand, here is mine
but you can select whichever works for you:
'urllist' => [q[http://ftp.iglu.org.il/pub/CPAN/],
The last thing you have to do is add your locally installed modules to @INC.
To do this on a permanant basis, add the following to yout startup file
(e.g. .cshrc file):
Caveat- all of the above worked for me on a linux station with perl 5.8.0.
For a different OS and/or perl version, YMMV.
If all of the above works for you, all you have to do to install and use a
new module is:
> perl -MCPAN -e shell
cpan> install New::Module
... (cpan does it's magic) ...
and now use New::Module from your scripts as you would any built-in module:
More information about the Perl