perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Schout <msch...@gkg.net>
Subject Re: reload modules for development environments on modperl2
Date Wed, 05 Mar 2008 16:46:09 GMT
Jeremy Wall wrote:
> I currently use Apache2::Reload on my development environments. However it's 
> usefulness has been spotty particularly on win32 environments. Someone 
> recently recommended Module::Refresh to me as an alternative.

FWIW, I have not had much luck with Apache2::Reload in my development 
environment (Linux, Apache2 Prefork MPM).  Most of the time when I 
change something, it produces "Not a CODE reference" type errors.

I have had much better luck with Module::Refresh.  I did it this way to 
only reload packages starting with MyApp::

in httpd.conf

PerlInitHandler MyApp::Apache2::Reload

the module looks like this:

package MyApp::Apache2::Reload;

use Module::Refresh;

my $cache = Module::Refresh->new;

sub handler : method {
     for my $mod (keys %INC) {
         next unless $mod =~ /^MyApp/;
         $cache->refresh_module_if_modified($mod);
     }
}

1;

__END__

This has worked perfectly for me.

Regards,
Michael Schout

Mime
View raw message