A.7. The Apache::StatINC Class
When you write a script using the Apache::Registry mechanism, Apache::Registry watches the script file's modification date and reloads the script if it is more recent than the compiled version in memory. This lets you edit the script file and see the changes immediately.
However, this is not the case with Apache Perl API modules or any Perl library files that they depend on. Changing the .pm file does not cause the module to be reloaded automatically. You ordinarily have to restart the whole server with apachectl restart or apache -k restart to see any changes take effect.
You can use the Apache::StatINC to alter this behavior. Each time it runs, Apache::StatINC checks the contents of the Perl global %INC hash of loaded modules. Apache::StatINC keeps track of each module's modification time. When it notes that a module has been modified since it was last loaded, it removes the module from %INC, forcing Perl to reload and compile it.
To install Apache::StatINC, add the following configuration directive to perl.conf (or any of the configuration files):
PerlInitHandler Apache::StatINC
This directive arranges for Apache::StatINC 's handler() method to be invoked every time Apache handles an HTTP request, before any other Perl*Handlers are run.
Note that Apache::StatINC only sees the directories that were present in the @INC include path at the time the server was started. During a request, a script or module may modify the @INC path, but those changes ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access