Apache::Reload - Reload changed modules In httpd.conf: PerlInitHandler Apache::Reload PerlSetVar ReloadAll Off Then your module: package My::Apache::Module; use Apache::Reload; sub handler { ... } 1; This module is two things. First it is an adaptation of Randal Schwartz's Stonehenge::Reload module that attempts to be a little more intuitive and makes the usage easier. Stonehenge::Reload was written by Randal to make specific modules reload themselves when they changed. Unlike Apache::StatINC, Stonehenge::Reload only checked the change time of modules that registered themselves with Stonehenge::Reload, thus reducing stat() calls. Apache::Reload also offers the exact same functionality as Apache::StatINC, and is thus 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 as a StatINC replacement, simply add the following configuration to your httpd.conf: PerlInitHandler Apache::Reload

Register Modules Implicitly
To only reload modules that have registered with Apache::Reload, add the following to the 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.

Register Modules Explicitly
You can also register modules explicitly in your httpd.conf file that you want to be reloaded on change: PerlInitHandler Apache::Reload PerlSetVar ReloadAll Off PerlSetVar ReloadModules "My::Foo My::Bar Foo::Bar::Test" Note that these are split on whitespace, but the module list must be in quotes, otherwise Apache tries to parse the parameter list.

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. The short summary of this is: Don't use psuedohashes. Use an array with constant indexes. Its faster in the general case, its more guaranteed, and generally, it works. The long summary is that I've done some work to get this working with modules that use psuedo hashes, but its still broken in the case of a single module that contains multiple packages that all use psuedohashes. So don't do that. Matt Sergeant, matt@sergeant.org the mod_perl developers, dev@perl.apache.org Apache::StatINC, Stonehenge::Reload