Installing
Options/Software |
||||||||||||||
|
Installing
your own Perl5 modules Utilities for installing perl5 modules generally assume that the installation is being done in the root area of the file system of the host machine. As a Virtual Server user you do not have access to the root area of the host machine. So, you must install perl5 modules locally, within your Virtual Server file system. Installing Perl5 modules
locally % perl5 Makefile.PL % make % make test % make install The first command, % perl5 Makefile.PL PREFIX=/usr/home/<username>/usr/local The value <username> above should be replaced with the username of your Virtual Server. So the complete installation process is: % perl5 Makefile.PL PREFIX=/usr/home/<username>/usr/local % make % make test % make install For older modules it may be necessary to designate several other variables on the command line during the module installation:
% perl5 Makefile.PL PREFIX=/usr/home/<username>/usr/local \
INSTALLPRIVLIB=/usr/home/<username>/usr/local/lib/perl5 \
INSTALLSCRIPT=/usr/home/<username>/usr/local/bin \
INSTALLSITELIB=/usr/home/<username>/usr/local/lib/perl5/site_perl \
INSTALLBIN=/usr/home/<username>/usr/local/bin \
INSTALLMAN1DIR=/usr/home/<username>/usr/local/lib/perl5/man \
INSTALLMAN3DIR=/usr/home/<username>/usr/local/lib/perl5/man/man3
To save yourself some typing you can create a file and put these variable assignments above in the file (<filename>) something like this: PREFIX=/usr/home/<username>/usr/local \ INSTALLPRIVLIB=/usr/home/<username>/usr/local/lib/perl5 \ INSTALLSCRIPT=/usr/home/<username>/usr/local/bin \ INSTALLSITELIB=/usr/home/<username>/usr/local/lib/perl5/site_perl \ INSTALLBIN=/usr/home/<username>/usr/local/bin \ INSTALLMAN1DIR=/usr/home/<username>/usr/local/lib/perl5/man \ INSTALLMAN3DIR=/usr/home/<username>/usr/local/lib/perl5/man/man3 Then, each time you install a perl5 module you can use the following syntax: % perl5 Makefile.PL `cat <filename>` % make % make test % make install You also can have a few different local modules installation procedures, for example one for production perl and another for development: % perl5 Makefile.PL `cat <filename>.production` or % perl5 Makefile.PL `cat <filename>.development` Making scripts find the modules you have installed /usr/lib/perl5 /usr/lib/perl5/i386-bsdos/5.00X /usr/lib/perl5/site_perl/i386-bsdos /usr/lib/perl5/site_perl These 4 directories are already preset in the perl5's @INC array. That array contains the paths that perl5 searches in order to find modules. If you install perl5 modules locally as described above, you will need to append these two directories, which are local to your Virtual Server, to the @INC array: /usr/home/<username>/usr/local/lib/perl5 /usr/home/<username>/usr/local/lib/perl5/site_perl The architecture specific directories are being searched by perl automatically Each time you want to use modules in that path you should add the following line to your scripts:
use lib qw(/usr/home/<username>/usr/local/lib/perl5
/usr/home/<username>/usr/local/lib/perl5/site_perl);
You don't have to put it into a BEGIN block; the lib.pm module takes care of that for you. It also adds the architecture specific directories. You also can use a BEGIN block to include your installed modules:
BEGIN { unshift @INC, qw(/usr/home/<username>/usr/local/lib/perl5
/usr/home/<username>/usr/local/lib/perl5/site_perl); }
However, the Installing new modules that require locally installed modules The solution is simple. The PERL5LIB environment variable does the same job in
the shell as
% setenv PERL5LIB \
/usr/home/<username>/usr/local/lib/perl5:/usr/home/<username>/usr/local/lib/perl5/site_perl
Check the man page of your favorite shell how to set the environment variables if you
use a shell different from csh/tcsh. Put this Module installation using CPAN.pm When you install it or use it the first time, the module asks you a few questions, one of which is a PREFIX directory as described above (so you can define a different PREFIX directory if you will be doing local installations). After configuration of the module is complete, you run it like this: % perl5 -MCPAN -e shell > install CGI It will fetch the latest CGI module, unpack it, make it, test it and install it into your local area or the directory you specified as the PREFIX directory. The command: > i /CGI/ will return the list of modules that match that pattern. The CPAN.pm module has more functionality, like checking for the latest modules, for
example. Just run The content on this page was adapted from TULARC: The Ultimate Learn and Resource Center and was orignally authored by Bekman Stas. |
|||||||||||||
|
Contents Copyright 1997-2003 We-Host Web Hosting. See our copyright page for additional copyright and disclaimer information. Last Updated: 11 June, 2000 · Email support web site errors to webmaster@we-host.com |
||||||||||||||
![]()