reload modules for development environments on modperl2
am 22.03.2007 21:31:41 von Jeremy Wall
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.
I was wondering in other peoples experience has been with modperl module
reloaders and refreshers. Or do most of you just prefer to go with an apache
restart?
Jeremy Wall
http://jeremy.marzhillstudios.com/
jeremy@marzhillstudios.com
Re: reload modules for development environments on modperl2
am 23.03.2007 01:21:14 von pgollucci
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.
>
> I was wondering in other peoples experience has been with modperl module
> reloaders and refreshers. Or do most of you just prefer to go with an apache
> restart?
>
> Jeremy Wall
> http://jeremy.marzhillstudios.com/
> jeremy@marzhillstudios.com
I can't speak for windows, but Apache::Reload or Apache2::Reload work
really well for me.
PerlModule Apache2::Reload
PerlChildInitHandler Apache2::Reload
PerlInitHandler Apache2::Reload
PerlSetVar ReloadAll Off
PerlSetVar ReloadModules "X::* Y::*"
Of course it doesn't play nice with fatal warnings, so you'll want this
in your code:
use warnings FATAL => 'all', NONFATAL => 'redefine';
I tend to do final testing with Reload still on, but enabling
fatal warnings for redefines too.
--
------------------------------------------------------------ ------------
Philip M. Gollucci (pgollucci@p6m7g8.com) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/EC88A0BF 0DE5 C55C 6BF3 B235 2DAB B89E 1324 9B4F EC88 A0BF
Work like you don't need the money,
love like you'll never get hurt,
and dance like nobody's watching.
Re: reload modules for development environments on modperl2
am 05.03.2008 17:46:09 von Michael Schout
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