|Practical mod_perl / HTML Book /|
3.9.3. Using the CPAN.pm Shell with Nonstandard Installation Directories
As we saw previously in this chapter, using the CPAN.pmshell to install mod_perl saves a great deal of time. It does the job for us, even detecting the missing modules listed in prerequisites, fetching them, 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. For example, for a user stas and Perl Version 5.6.1, it will search for the following configuration files:
If there is no CPAN shell 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.pm file for you.
If the CPAN shell is already configured system-wide, you should already have a /usr/lib/perl5/5.6.1/CPAN/Config.pm file. (As always, if you have a different Perl version, the path will include a different version number.) Create the directory for the local configuration file as well:
panic% mkdir -p /home/stas/.cpan/CPAN
(On many systems, mkdir -p creates the whole path at once.)
Now copy the system-wide configuration file to your local one:
panic% cp /usr/lib/perl5/5.6.1/CPAN/Config.pm /home/stas/.cpan/CPAN/MyConfig.pm
The only thing left is to change the base directory of .cpan in your local file to the one under your home directory. On our machine, we replace /root/.cpan (which is where our system's .cpan directory resides) with /home/stas. Of course, we use Perl to edit the file:
panic% perl -pi -e 's|/root|/home/stas|' \ /home/stas/.cpan/CPAN/MyConfig.pm
Now that you have the local configuration file ready, you have to tell it what special parameters you need to pass when executing perl Makefile.PL. Open the file in your favorite editor and replace the following line:
'makepl_arg' => q[ ],
'makepl_arg' => q[PREFIX=/home/stas],
Now you've finished the configuration. Assuming that you are logged in with the same username used for the local installation (stas in our example), start it like this:
panic% 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 PREFIX variable, modify MyConfig.pm to use the other variables. For example, if you have used these variables during the creation of the Makefile:
panic% perl Makefile.PL PREFIX=/home/stas \ INSTALLPRIVLIB=/home/stas/lib/perl5 \ INSTALLSCRIPT=/home/stas/bin \ INSTALLSITELIB=/home/stas/lib/perl5/site_perl \ INSTALLBIN=/home/stas/bin \ INSTALLMAN1DIR=/home/stas/lib/perl5/man \ INSTALLMAN3DIR=/home/stas/lib/perl5/man3
replace PREFIX=/home/stas in the line:
'makepl_arg' => q[PREFIX=/home/stas],
with all the variables from above, so that the line becomes:
'makepl_arg' => q[PREFIX=/home/stas \ INSTALLPRIVLIB=/home/stas/lib/perl5 \ INSTALLSCRIPT=/home/stas/bin \ INSTALLSITELIB=/home/stas/lib/perl5/site_perl \ INSTALLBIN=/home/stas/bin \ INSTALLMAN1DIR=/home/stas/lib/perl5/man \ INSTALLMAN3DIR=/home/stas/lib/perl5/man3 ],
mod_perl, modperl, Apache, perl, cgi, html, mod_perl, e-commerce, scalability, free, open source, OSS, apache, squid, high availability, modperl, linux, unix, Web, www, mod_perl, webserver, admin, apache, book, webmaster, tools, modperl, guide, docs, documentation, help, mod_perl, perl, information, apache, script, errata, eric cholet, perl, apache, mod-perl, stas bekman, mod_perl, cool, perl, Apache, performance, speed, choice
Other projects to check out: meta-religion.com is for those interested in Religious, Spiritual and Esoteric Phenomena. i-want-a-better.com is a community of people discussing what they would like to be improved in their lives and things they use and interact with. You may also want to find a healer in your area or read articles on variety of topics.