You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Jeremy Wall <je...@marzhillstudios.com> on 2007/03/22 21:31:41 UTC

reload modules for development environments on modperl2

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

Posted by Michael Schout <ms...@gkg.net>.
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

Re: reload modules for development environments on modperl2

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
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.