X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FEngine%2FHTTP%2FRestarter.pm;h=3eb7d046ebb0e8d672d3ff64431eda7267bb9ae6;hp=df5565664bf3b617eeeaa4bf49df7ac1a984bcf1;hb=6f1f968a6bc42bf4a4b50a1ee22d3aaecd801876;hpb=8604aac5eee4b40f048da62924a47bca9e0e2451 diff --git a/lib/Catalyst/Engine/HTTP/Restarter.pm b/lib/Catalyst/Engine/HTTP/Restarter.pm index df55656..3eb7d04 100644 --- a/lib/Catalyst/Engine/HTTP/Restarter.pm +++ b/lib/Catalyst/Engine/HTTP/Restarter.pm @@ -1,31 +1,31 @@ package Catalyst::Engine::HTTP::Restarter; -use strict; -use warnings; -use base 'Catalyst::Engine::HTTP'; +use MRO::Compat; +use mro 'c3'; +use Moose; +extends 'Catalyst::Engine::HTTP'; +no Moose; + use Catalyst::Engine::HTTP::Restarter::Watcher; -use NEXT; sub run { my ( $self, $class, $port, $host, $options ) = @_; $options ||= {}; - die qq/Sorry, but "restart" doesn't work together with "fork".\n/ - if $options->{fork}; - # Setup restarter - my $restarter; - my $parent = $$; - - unless ( $restarter = fork ) { + unless ( my $restarter = fork ) { # Prepare close STDIN; close STDOUT; my $watcher = Catalyst::Engine::HTTP::Restarter::Watcher->new( - directory => File::Spec->catdir( $FindBin::Bin, '..' ), + directory => ( + $options->{restart_directory} || + File::Spec->catdir( $FindBin::Bin, '..' ) + ), + follow_symlinks => $options->{follow_symlinks}, regex => $options->{restart_regex}, delay => $options->{restart_delay}, ); @@ -57,7 +57,7 @@ sub run { # build the Kill request my $req = - HTTP::Request->new( 'KILL', '/', + HTTP::Request->new( 'RESTART', '/', HTTP::Headers->new( 'Connection' => 'close' ) ); $req->protocol('HTTP/1.0'); @@ -69,8 +69,8 @@ sub run { } } - return $self->NEXT::run( $class, $port, $host, $options ); -} + return $self->next::method( $class, $port, $host, $options ); +}; 1; __END__ @@ -90,11 +90,7 @@ and restart the server when any changes are detected. =head1 METHODS -=over 4 - -=item run - -=back +=head2 run =head1 SEE ALSO