Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

apache::reload(3) [mojave man page]

Apache::Reload(3)					User Contributed Perl Documentation					 Apache::Reload(3)

NAME
Apache::Reload - Reload changed modules SYNOPSIS
In httpd.conf: PerlInitHandler Apache::Reload PerlSetVar ReloadAll Off Then your module: package My::Apache::Module; use Apache::Reload; sub handler { ... } 1; DESCRIPTION
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. Un-Register Modules Explicitly If ReloadAll is set to On, then you can explicity 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 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 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. AUTHOR
Matt Sergeant, matt@sergeant.org MAINTAINERS
the mod_perl developers, dev@perl.apache.org SEE ALSO
Apache::StatINC, Stonehenge::Reload perl v5.18.2 2015-06-18 Apache::Reload(3)

Check Out this Related Man Page

Module::Refresh(3pm)					User Contributed Perl Documentation				      Module::Refresh(3pm)

NAME
Module::Refresh - Refresh %INC files when updated on disk SYNOPSIS
# During each request, call this once to refresh changed modules: Module::Refresh->refresh; # Each night at midnight, you automatically download the latest # Acme::Current from CPAN. Use this snippet to make your running # program pick it up off disk: $refresher->refresh_module('Acme/Current.pm'); DESCRIPTION
This module is a generalization of the functionality provided by Apache::StatINC and Apache::Reload. It's designed to make it easy to do simple iterative development when working in a persistent environment. It does not require mod_perl. new Initialize the module refresher. refresh Refresh all modules that have mtimes on disk newer than the newest ones we've got. Calls "new" to initialize the cache if it had not yet been called. Specifically, it will renew any module that was loaded before the previous call to "refresh" (or "new") and has changed on disk since then. If a module was both loaded for the first time and changed on disk between the previous call and this one, it will not be reloaded by this call (or any future one); you will need to update the modification time again (by using the Unix "touch" command or making a change to it) in order for it to be reloaded. refresh_module_if_modified $module If $module has been modified on disk, refresh it. Otherwise, do nothing refresh_module $module Refresh a module. It doesn't matter if it's already up to date. Just do it. Note that it only accepts module names like "Foo/Bar.pm", not "Foo::Bar". unload_module $module Remove a module from %INC, and remove all subroutines defined in it. mtime $file Get the last modified time of $file in seconds since the epoch; update_cache $file Updates the cached "last modified" time for $file. unload_subs $file Wipe out subs defined in $file. BUGS
When we walk the symbol table to whack reloaded subroutines, we don't have a good way to invalidate the symbol table properly, so we mess up on things like global variables that were previously set. SEE ALSO
Apache::StatINC, Module::Reload COPYRIGHT
Copyright 2004,2011 by Jesse Vincent <jesse@bestpractical.com>, Audrey Tang <audreyt@audreyt.org> This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See <http://www.perl.com/perl/misc/Artistic.html> perl v5.12.4 2011-10-26 Module::Refresh(3pm)
Man Page