[Catalyst-dev] PATCH: refactor Catalyst::Engine::HTTP::Restarter to standalone module

Matt S Trout dbix-class at trout.me.uk
Fri Aug 3 16:38:20 GMT 2007


On Thu, Aug 02, 2007 at 10:43:48PM -0400, Mark Stosberg wrote:
> 
> Hello,
> 
> I have now completed a refactor so that re-usable parts from
> 
> Catalyst::Engine::HTTP::Restarter 
> and
> Catalyst::Engine::HTTP::Restarter::Watcher
> 
> have been split out into re-usable modules. I have prepared complete
> module releases for three new modules, as well as a patch to Catalyst
> to use them. I believe the the functionality of Catalyst remains
> unchanged. Here's an overview of what happened.
> 
> The "Watcher" module has become "File::Monitor::Simple". It has a
> Synopsis like this:
> 
>   my $watcher = File::Monitor::Simple->new(
>       directory => ’/path/to/MyApp’,
>       regex     => ’\.yml$|\.yaml$|\.pm$’,
>   );
> 
>   while (sleep 1) {
>       my @changed_files = $watcher->watch;
>   }
> 
> Next, the "Restarter" functionality has been split into 
> two modules. The basic version has few dependencies and issues 
> a HUP to a server that is affected by the directory changes:
> 
>     App::MonitorAndRestart->new(
>         pid        => 321,
> 
>         file_regex => ’\.yml$|\.yaml$|\.pm$’,
>         delay      => 1,
>         directory  => ’../’,
>         exit       => 1,
>    );
> 
> It has defaults for everything, so you can just do:
> 
>   App::MonitorAndRestart->new;
> 
> This should work with the recently released HTTP::Server::Simple
> (on platforms that support signals).
> 
> Finally, there is a sub-class that depends on some networking modules
> and uses the kind of restart that Catalyst has, sending a non-standard
> HTTP request method of "RESTART":
> 
>   App::MonitorAndRestart::ByHTTP->new(
>       file_regex => ’\.yml$|\.yaml$|\.pm$’,
>       delay      => 1,
>       directory  => ’../’,
> 
>       port       => 3000,
>       host       => ’127.0.0.1’,
>   );

All sounds good. Send me an htpasswd line and I'll get you setup with svn
structures for these.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/                    http://www.shadowcat.co.uk/ 



More information about the Catalyst-dev mailing list