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

Mark Stosberg mark at summersault.com
Sun Jul 22 21:30:48 GMT 2007


Matt S Trout wrote:

> On Sun, Jul 22, 2007 at 08:58:42AM -0400, Mark Stosberg wrote:
>> Hello,
>> 
>> I like the auto-restart feature that is in the Catalyst HTTP::Restarter
>> server. I wanted to use the restarting trick with a project based on
>> HTTP::Server::Simple, so I looked to see how tied this functionality was
>> to Catalyst. Here's what I found:
>> 
>> Catalyst::Engine::HTTP::Restarter::Watcher is not functionally tied to
>> Catalyst at all. It just shares a namespace.
>> 
>> Catalyst::Engine::HTTP::Restarter depends on no functionality from
>> Catalyst but was still coupled with it through a base-class relationship
>> which could be easily avoided.
>> 
>> The attached patch moves these to modules into the
>> HTTP::Server::Restarter namespace, and makes slight alternations to the
>> other Catalyst files so that the functionality remains the same, as well
>> as the dependencies.
> 
> Wouldn't Devel::Restart::Automatic or similar be more sensible name-wise?
> 
> I don't see that there needs to be anything HTTP-dependent in the code
> you're factoring out.

The approach is HTTP specific. The monitor acts as HTTP client and sends a
special "RESTART" requeest over HTTP when a change is detected. I looked at
two different approaches today that involved sending a SIGHUP signal
instead, and I couldn't get either to work. I suspect the authors settled
on this approach because it was reliable by comparison.

So, I think HTTP::Server::Restarter is good that part. The second
module, "Watcher.pm" is not HTTP-specific, it just monitors a directory for
changes, based some options.  It is similar to: "File::Monitor". 

http://search.cpan.org/~andya/File-Monitor-v0.0.5/

I suggest it be named "File::Monitor::Simple"

> Once we've settled one a name, I'd be happy to set up a directory under
> Catalyst svn for the factored out code and give you commit to it, then we
> can move the core across to it once everybody's had a chance to play with
> the factored-out code and stabilise it.

Great.

> And can we move this to the -dev list where it belongs, please? 

I did try that first. Sending the message directly there was rejected
automatically, and attempting to subscribe seemed to be me in
account-moderation-limbo. I'd be happy to be post there once I'm able to.

    Mark




More information about the Catalyst mailing list