Apache::Reload(3)
πΈ NAME πΈ
Apache::Reload β Reload changed modules π
π¦ SYNOPSIS π¦
Okay bestie, in httpd.conf you're gonna put:
PerlInitHandler Apache::Reload
PerlSetVar ReloadAll Off
Then in your module:
package My::Apache::Module;
use Apache::Reload;
sub handler { ... }
1;
π DESCRIPTION π
This module is literally two things at once, and ngl the first one is giving main character energy. First, it's an adaptation of Randal Schwartz's Stonehenge::Reload module, but it tries to be a little more intuitive and lowkey makes usage easier. Stonehenge::Reload was written by Randal to make specific modules reload themselves when they changed. Unlike Apache::StatINC, the way Stonehenge::Reload worked is it only checked the change time of modules that registered themselves with Stonehenge::Reload, which reduced stat() calls. Apache::Reload also offers the exact same functionality as Apache::StatINC, so it's designed to be a drop-in replacement. Apache::Reload only checks modules that register themselves with Apache::Reload if you explicitly turn off the StatINC emulation method (see below). Like Apache::StatINC, Apache::Reload must be installed as an Init Handler.
π₯ StatINC Replacement π₯
To use it as a StatINC replacement, just add this config to your httpd.conf:
PerlInitHandler Apache::Reload
π Register Modules Implicitly π
To only reload modules that have registered with Apache::Reload, add this to httpd.conf:
PerlInitHandler Apache::Reload
PerlSetVar ReloadAll Off
# ReloadAll defaults to On
Then any modules with the line:
use Apache::Reload;
will be reloaded when they change. Slay. Iconic behavior.
β¨ Register Modules Explicitly β¨
You can also register modules explicitly in your httpd.conf file that you want reloaded on change:
PerlInitHandler Apache::Reload
PerlSetVar ReloadAll Off
PerlSetVar ReloadModules "My::Foo My::Bar Foo::Bar::Test"
Heads up: these are split on whitespace, but the module list must be in quotes, otherwise Apache tries to parse the parameter list. No cap.
π Un-Register Modules Explicitly π
If ReloadAll is set to On, then you can explicitly force a module not to be reloaded with:
no Apache::Reload;
A warning will appear in the error log that the file has changed, but it will not be reloaded.
π«Ά Special "Touch" File π«Ά
You can also set a file that you can touch() that causes the reloads to be performed. If you set this, and don't touch() the file, the reloads don't happen. This can be a great boon in a live environment:
PerlSetVar ReloadTouchFile /tmp/reload_modules
Now when you're happy with your changes, simply go to the command line and type:
touch /tmp/reload_modules
And your modules will be magically reloaded on the next request. This option works in both StatINC emulation mode and the registered modules mode.
π PSUEDOHASHES π
The short summary is: don't use psuedohashes. Use an array with constant indexes. It's faster in the general case, it's more guaranteed, and generally, it works. Fr fr.
The long summary is highkey that I've done some work to get this working with modules that use psuedo hashes, but it's still broken in the case of a single module that contains multiple packages that all use psuedohashes.
So don't do that. π
π AUTHOR π
Matt Sergeant, matt@sergeant.org
π MAINTAINERS π
the mod_perl developers, dev@perl.apache.org
π SEE ALSO π
Apache::StatINC, Stonehenge::Reload β iykyk
β¨ This page is User Contributed Perl Documentation, from perl v5.42.0, dated 2025-03-19, for Apache::Reload(3) β that's the whole vibe, bestie, periodt π
π«Ά
π¦ where this page comes from
- opensuse-leap 16.0: apache2-mod_perl 2.0.13-bp160.1.10 Β· Apache-2.0
- opensuse-leap 16.0: apache2-mod_perl 2.0.13-bp160.1.10 Β· Apache-2.0
- opensuse-leap 16.0: apache2-mod_perl 2.0.13-bp160.1.10 Β· Apache-2.0
- opensuse-leap 16.0: apache2-mod_perl 2.0.13-bp160.1.10 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms