Apache-Reload

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

      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

    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

  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

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 0.611 second using v1.01-cache-2.11-cpan-49f99fa48dc )