![]() |
Practical mod_perl / HTML Book / | ![]() |
||
![]() |
||||
![]() |
![]() |
|||
![]() |
![]() |
|||
![]() |
||||
|
|
||||
![]() |
![]() |
|||
![]() |
6.8.1. The @INC Array Under mod_perl |
![]() |
||
![]() |
||||
![]() |
![]() |
![]() |
||
![]() |
||||
Under mod_perl, @INC can be modified only during server startup. After each request, mod_perl resets @INC's value to the one it had before the request.
If mod_perl encounters a statement like the following:
use lib qw(foo/bar);
it modifies @INC only for the period during which the code is being parsed and compiled. Afterward, @INC is reset to its original value. Therefore, the only way to change @INC permanently is to modify it at server startup.
There are two ways to alter @INC at server startup:
In the configuration file, with:
PerlSetEnv PERL5LIB /home/httpd/perl
or:
PerlSetEnv PERL5LIB /home/httpd/perl:/home/httpd/mymodules
use lib qw(/home/httpd/perl /home/httpd/mymodules); 1;
As always, the startup file needs to be loaded from httpd.conf:
PerlRequire /path/to/startup.pl
To make sure that you have set @INC correctly, configure perl-status into your server, as explained in Chapter 21. Follow the "Loaded Modules" item in the menu and look at the bottom of the generated page, where the contents of @INC are shown:
@INC = /home/httpd/mymodules /home/httpd/perl /usr/lib/perl5/5.6.1/i386-linux /usr/lib/perl5/5.6.1 /usr/lib/perl5/site_perl/5.6.1/i386-linux /usr/lib/perl5/site_perl/5.6.1 /usr/lib/perl5/site_perl . /home/httpd/httpd_perl/ /home/httpd/httpd_perl/lib/perl
As you can see in our setup, we have two custom directories prepended at the beginning of the list. The rest of the list contains standard directories from the Perl distribution, plus the $ServerRoot and $ServerRoot/lib/perl directories appended at the end (which mod_perl adds automatically).
 
Continue to:
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.