[Catalyst] New restarter code in Catalyst::Devel 1.14_01

Dave Rolsky autarch at urth.org
Mon May 11 02:25:39 GMT 2009

I recently did some work to rewrite the Catalyst restarter code and make 
it both simpler and less fragile.

The restarter no longer attempts to reload changed modules in an existing 
process. This was fragile, and tended to produce a lot of bogus 
compilation failures.

The new restarter just _tries_ to restart on every change. If the restart 
fails, the server dies, rather than continuing to run with the old code. 
However, the restarter keeps watching for changes, and will attempt to 
start the server on the next change.

I think this makes for a much saner development process. I always found it 
very confusing to make a change, reload a web page, and not see the change 
reflected, only to realize that the server didn't actually reload.

Restarting is also much faster. All of the Catalyst core code is preloaded 
in a parent process, and the server runs in a child. That means that when 
the child is killed and a new child spawned for a new server, it does not 
need to load all that Catalyst code again, just your application.

The new restarter has been moved from Catalyst-Runtime, where it lived as 
a weird bastardized Engine subclass, to Catalyst-Devel, where it lives as 
a standalone Catalyst::Restarter module.

I also switched the actual file monitoring away from the existing 
File::Modified implementation. The new implementation uses a new module I 
wrote called File::ChangeNotify. This module is much better suited to 
Catalyst's needs, as it simply reports on relevant filesystem changes.

File::ChangeNotify is designed so that it is easy to implement per-OS 
subclasses to do file monitoring. It currently comes with an Inotify 
subclass that uses the Linux inotify interface, as well as a fallback that 
is just written in Perl.

I'm hoping that in the future we'll see other OS-specific implementations.

I'd appreciate if people would test out the new code. You'll need to 
regenerate your myapp_server.pl script to actually see the changes. Old 
scripts will of course continue to work, since the old restarter code is 
still in Catalyst-Runtime.


http://VegGuide.org               http://blog.urth.org
Your guide to all that's veg      House Absolute(ly Pointless)

More information about the Catalyst mailing list