Installation of mod_perl-enabled Apache Without Superuser Privileges Page 4
PERL5LIBsetting, you don't need to alter the
@INCvalue in your scripts. But if for example someone else (who doesn't have this setting in the shell) tries to execute your scripts, Perl will fail to find your locally installed modules. The best example is a crontab script that might use a different SHELL environment and therefore the
PERL5LIBsetting won't be available to it.
So the best approach is to have both the
variable and the explicit
@INC extension code at the beginning of
the scripts as described above.
CPAN.pm shell saves a great deal of time when you have to
deal with Perl modules installation and keeping them up to date. It does the
job for us, even detecting the missing modules listed in prerequisites,
fetching and installing them. So you might wonder whether you can use
CPAN.pm to maintain your local repository as well.
When you start the
CPAN interactive shell, it searches first
for the user's private configuration file and then for the system wide one.
When I'm logged as user
stas the two files on my setup are:
If there is no
CPANshell configured on your system, when you start the shell for the first time it will ask you a dozen configuration questions and then create the
Config.pmfile for you.
If you've got it already system-wide configured, you should have a
/usr/lib/perl5/5.00503/CPAN/Config.pm. If you have a different Perl version, alter the path to use your Perl's version number, when looking up the file. Create the directory (
mkdir -pcreates the whole path at once) where the local configuration file will go:% mkdir -p /home/stas/.cpan/CPAN
Now copy the system wide configuration file to your local one:% cp /usr/lib/perl5/5.00503/CPAN/Config.pm /home/stas/.cpan/CPAN/MyConfig.pm
The only thing left is to change the base directory of
.cpanin your local file to the one under your home directory. On my machine I replace
/usr/src/.cpan(that's where my system's
.cpandirectory resides) with
/home/stas. I use Perl of course!% perl -pi -e 's|/usr/src|/home/stas|' /home/stas/.cpan/CPAN/MyConfig.pm
Now you have the local configuration file ready, you have to tell it what special parameters you need to pass when executing the
Open the file in your favorite editor and replace line:'makepl_arg' => q,
with:'makepl_arg' => q[PREFIX=/home/stas],
Now you've finished the configuration. Assuming that you are logged in as the same user you have prepared the local installation for (stas in our example), start it like this:% perl -MCPAN -e shell
From now on any module you try to install will be installed locally. If you need to install some system modules, just become the superuser and install them in the same way. When you are logged in as the superuser, the system-wide configuration file will be used instead of your local one.
If you have used more than just the
MyConfig.pmto use them. For example if you have used these variables:
IT Solutions Builder TOP IT RESOURCES TO MOVE YOUR BUSINESS FORWARD
Which topic are you interested in?
What is your company size?
What is your job title?
What is your job function?
Searching our resource database to find your matches...