Apache-Reload

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
      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

lib/Apache/Reload.pm  view on Meta::CPAN

76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
my $r = shift;
 
my $DEBUG = ref($r) && (lc($r->dir_config("ReloadDebug") || '') eq 'on');
 
my $TouchFile = ref($r) && $r->dir_config("ReloadTouchFile");
 
my $TouchModules;
 
if ($TouchFile) {
    warn "Checking mtime of $TouchFile\n" if $DEBUG;
    my $touch_mtime = (stat($TouchFile))[9] || return 1;
    return 1 unless $touch_mtime > $TouchTime;
    $TouchTime = $touch_mtime;
    my $sym = Apache->gensym;
    open($sym, $TouchFile) || die "Can't open '$TouchFile': $!";
    $TouchModules = <$sym>;
    chomp $TouchModules;
}
 
if (ref($r) && (lc($r->dir_config("ReloadAll") || 'on') eq 'on')) {
    *Apache::Reload::INCS = \%INC;

lib/Apache/Reload.pm  view on Meta::CPAN

201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
  1;
 
=head1 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.
 
=head2 StatINC Replacement
 
To use as a StatINC replacement, simply add the following configuration
to your httpd.conf:

lib/Apache2/Reload.pm  view on Meta::CPAN

372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
This module is perfectly suited for a development environment. Though
it's possible that you would like to use it in a production
environment, since with C<Apache2::Reload> you don't have to restart
the server in order to reload changed modules during software
updates. Though this convenience comes at a price:
 
=over
 
=item *
 
If the "touch" file feature is used, C<Apache2::Reload> has to stat(2)
the touch file on each request, which adds a slight but most likely
insignificant overhead to response times. Otherwise C<Apache2::Reload>
will stat(2) each registered module or even worse--all modules in
C<%INC>, which will significantly slow everything down.
 
=item *
 
Once the child process reloads the modules, the memory used by these
modules is not shared with the parent process anymore. Therefore the
memory consumption may grow significantly.
 
=back



( run in 1.504 second using v1.01-cache-2.11-cpan-49f99fa48dc )