By Stas Bekman, Eric Cholet
mod_perl2 User's Guide
By Stas Bekman, Jim Brandt
#httpd.conf or some such #can be any Perl*Handler PerlInitHandler Apache::StatINC
When Perl pulls a file via
require, it stores the filename in the
%INC. The next time Perl tries to
require the same
file, it sees the file in
%INC and does not reload from disk. This
module's handler iterates over
%INC and reloads the file if it has
changed on disk.
Note that StatINC operates on the current context of
Which means, when called as a Perl*Handler it will not see
added or removed by Apache::Registry scripts, as the value of
saved on server startup and restored to that value after each request.
In other words, if you want StatINC to work with modules that live in custom
@INC paths, you should modify
@INC when the server is started.
use lib in startup scripts, you can also set the
variable in the httpd's environment to include any non-standard 'lib'
directories that you choose. For example, you might use a
script called 'start_httpd' to start apache, and include a line like this:
PERL5LIB=/usr/local/foo/myperllibs; export PERL5LIB
When you have problems with modules not being reloaded, please refer to the following lines in perlmodlib:
-w. Try to
use strict; (or
use strict qw(...);).
Remember that you can add
no strict qw(...); to individual blocks
of code that need less strictness. Always use
-w. Always use
Follow the guidelines in the perlstyle(1) manual."
Warnings when running under mod_perl is enabled with
PerlWarn On in
It will most likely help you to find the problem. Really.
StatINC will turn of warnings to avoid "Subroutine
redefined" warnings when it reloads a file. However, this does not
disable the Perl mandatory warning when re-defining
subroutines (see perldoc perlsub). With this option On, StatINC will
undef_functions method to avoid these
PerlSetVar StatINC_UndefOnReload On
You can make
StatINC tell when it reloads a module by setting this
option to on.
PerlSetVar StatINC_Debug 1
The only used debug level is currently 1.
Maintainer is the person(s) you should contact with updates, corrections and patches.
Only the major authors are listed above. For contributors see the Changes file.