You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Michael Schout <ms...@gkg.net> on 2008/03/05 17:46:09 UTC

Re: reload modules for development environments on modperl2

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