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.


-dave

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

_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to