1Apache::Reload(3) User Contributed Perl Documentation Apache::Reload(3)
2
3
4
6 Apache::Reload - Reload changed modules
7
9 In httpd.conf:
10
11 PerlInitHandler Apache::Reload
12 PerlSetVar ReloadAll Off
13
14 Then your module:
15
16 package My::Apache::Module;
17
18 use Apache::Reload;
19
20 sub handler { ... }
21
22 1;
23
25 This module is two things. First it is an adaptation of Randal
26 Schwartz's Stonehenge::Reload module that attempts to be a little more
27 intuitive and makes the usage easier. Stonehenge::Reload was written by
28 Randal to make specific modules reload themselves when they changed.
29 Unlike Apache::StatINC, Stonehenge::Reload only checked the change time
30 of modules that registered themselves with Stonehenge::Reload, thus
31 reducing stat() calls. Apache::Reload also offers the exact same
32 functionality as Apache::StatINC, and is thus designed to be a drop-in
33 replacement. Apache::Reload only checks modules that register
34 themselves with Apache::Reload if you explicitly turn off the StatINC
35 emulation method (see below). Like Apache::StatINC, Apache::Reload must
36 be installed as an Init Handler.
37
38 StatINC Replacement
39 To use as a StatINC replacement, simply add the following configuration
40 to your httpd.conf:
41
42 PerlInitHandler Apache::Reload
43
44 Register Modules Implicitly
45 To only reload modules that have registered with Apache::Reload, add
46 the following to the httpd.conf:
47
48 PerlInitHandler Apache::Reload
49 PerlSetVar ReloadAll Off
50 # ReloadAll defaults to On
51
52 Then any modules with the line:
53
54 use Apache::Reload;
55
56 Will be reloaded when they change.
57
58 Register Modules Explicitly
59 You can also register modules explicitly in your httpd.conf file that
60 you want to be reloaded on change:
61
62 PerlInitHandler Apache::Reload
63 PerlSetVar ReloadAll Off
64 PerlSetVar ReloadModules "My::Foo My::Bar Foo::Bar::Test"
65
66 Note that these are split on whitespace, but the module list must be in
67 quotes, otherwise Apache tries to parse the parameter list.
68
69 Un-Register Modules Explicitly
70 If ReloadAll is set to On, then you can explicity force a module not to
71 be reloaded with
72
73 no Apache::Reload;
74
75 A warning will appear in the error log that the file has changed, but
76 will not be reloaded
77
78 Special "Touch" File
79 You can also set a file that you can touch() that causes the reloads to
80 be performed. If you set this, and don't touch() the file, the reloads
81 don't happen. This can be a great boon in a live environment:
82
83 PerlSetVar ReloadTouchFile /tmp/reload_modules
84
85 Now when you're happy with your changes, simply go to the command line
86 and type:
87
88 touch /tmp/reload_modules
89
90 And your modules will be magically reloaded on the next request. This
91 option works in both StatINC emulation mode and the registered modules
92 mode.
93
95 The short summary of this is: Don't use psuedohashes. Use an array with
96 constant indexes. Its faster in the general case, its more guaranteed,
97 and generally, it works.
98
99 The long summary is that I've done some work to get this working with
100 modules that use psuedo hashes, but its still broken in the case of a
101 single module that contains multiple packages that all use
102 psuedohashes.
103
104 So don't do that.
105
107 Matt Sergeant, matt@sergeant.org
108
110 the mod_perl developers, dev@perl.apache.org
111
113 Apache::StatINC, Stonehenge::Reload
114
115
116
117perl v5.34.0 2022-01-20 Apache::Reload(3)