ServersInstallation of mod_perl-enabled Apache Without Superuser Privileges Page 3

Installation of mod_perl-enabled Apache Without Superuser Privileges Page 3

ServerWatch content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

Another way is to write code to modify @INC explicitly:

    unshift @INC,

Note that with the lib module we don’t have to list the
corresponding architecture specific directories, since it adds them
automatically if they exist (to be exact, when //auto

Also, notice that both approaches prepend the directories to be
searched to @INC. This allows you to install a more recent module
into your local repository and Perl will use it instead of the older one
installed in the main system repository.

Both approaches modify the value of @INC at compilation time.
The lib module uses the BEGIN block as well, but

Now, let’s assume the following scenario. I have installed the
LWP package in my local repository. Now I want to install another
module (e.g. mod_perl) and it has LWP listed in its prerequisites
list. I know that I have LWP installed, but when I run perl
for the module I’m about to install I’m told that I don’t
have LWP installed.

There is no way for Perl to know that we have some locally installed
modules. All it does is search the directories listed in @INC, and
since the latter contains only the default four directories (plus the
. directory), it cannot find the locally installed
LWP package. We cannot solve this problem by adding code to modify
@INC, but changing the PERL5LIB environment variable
will do the trick. If you are using t?csh for interactive work, do

  setenv PERL5LIB /home/stas/lib/perl5/5.00503:

It should be a single line with directories separated by colons
(:) and no spaces. If you are a (ba)?sh user, do

  export PERL5LIB=/home/stas/lib/perl5/5.00503:

Again, make it a single line. If you use bash you can use multi-line
commands by terminating split lines with a backslash (), like

  export PERL5LIB=/home/stas/lib/perl5/5.00503:  /home/stas/lib/perl5/site_perl/5.005

As with use lib, perl automatically prepends the architecture
specific directories to @INC if those exist.

When you have done this, verify the value of the newly configured
@INC by executing perl -V as before. You should see
the modified value of @INC:

  % perl -V
  Characteristics of this binary (from libperl): 
  Built under linux
  Compiled at Apr  6 1999 23:34:07

When everything works as you want it to, add these commands to your
.tcshrc or .bashrc file. The next time you start a
shell, the environment will be ready for you to work with the new Perl.

Get the Free Newsletter!

Subscribe to Daily Tech Insider for top news, trends & analysis

Latest Posts

Related Stories