[Catalyst] Reloading Controllers on a change

Matt S Trout catalyst at trout.me.uk
Sat Jul 2 02:15:52 CEST 2005


On Thu, Jun 30, 2005 at 02:33:50PM +0200, KXCG Maas wrote:
> Dear Catalyst hackers,
>     we are playing with Catalyst for a while and doing a project in it. 
> 
> We noticed when developing using Catalyst in combination with the apache 
> webserver that we have to restart the server
> whenever we make a change to a Controller or any other object in the 
> framework.
> 
> We tried Apache::Reload but this gives us strange unpredictable behaviour. 
> Is there any other way we can reload the controllers whenever one changes.

Module::Refresh may work better - I think there may also be a modified
version of Apache::Reload.

Alternatively you could try using the (highly experimental, not recommended
for production) Apache::Worlds via this snapshot URL:

http://dev.catalyst.perl.org/snapshots/bast/20050702/Apache-Worlds.tgz

Copy the module from lib/ into your @INC somewhere, and then have a
startup.pl that contains something like

use Apache::Worlds;
Apache::Worlds->register_world('keyname', 'cat::app', '/path/to/file');

and put

PerlSetVar Apache_Worlds_Key keyname
PerlHandler Apache::Worlds

into your apache config in place of "PerlHandler cat::app". Apache::Worlds
creates a Safe::World compartment and loads the application into that. Then
each request is passed through into the compartment by Apache::Worlds, and
whenever /path/to/file is touched Apache::Worlds will drop the compartment
and reload it.

WARNING: Only tested, by me, for development work. Works ok on my mod_perl
under apache 1, may work other places or not as the case may be. PUT THIS
ANYWHERE NEAR A PRODUCTION MACHINE AT YOUR OWN RISK.

-- 
     Matt S Trout           Website: http://www.shadowcatsystems.co.uk
  Technical Director        E-mail:  mst (at) shadowcatsystems.co.uk
Shadowcat Systems Ltd.



More information about the Catalyst mailing list