X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine%2FHTTP%2FRestarter.pm;h=02c58bac82f05202b44e971c41be1669916033cf;hb=9c71d51daf53bfd6f77d7e252b594392bd4be3de;hp=134e6be1739682e09aeeb59aeb10755909b5f0bb;hpb=1cf1c56a0c68611a361dbb8c797891baf6d0974f;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine/HTTP/Restarter.pm b/lib/Catalyst/Engine/HTTP/Restarter.pm index 134e6be..02c58ba 100644 --- a/lib/Catalyst/Engine/HTTP/Restarter.pm +++ b/lib/Catalyst/Engine/HTTP/Restarter.pm @@ -12,17 +12,18 @@ sub run { $options ||= {}; # 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}, ); @@ -49,17 +50,17 @@ sub run { PeerAddr => $host, PeerPort => $port ) - or die "can't create client socket (is server running?): ", + or die "Can't create client socket (is server running?): ", $!; # build the Kill request my $req = - HTTP::Request->new( 'KILL', '/', + HTTP::Request->new( 'RESTART', '/', HTTP::Headers->new( 'Connection' => 'close' ) ); $req->protocol('HTTP/1.0'); $client->send( $req->as_string ) - or die "can't send restart instruction: ", $!; + or die "Can't send restart instruction: ", $!; $client->close(); exit; } @@ -87,11 +88,7 @@ and restart the server when any changes are detected. =head1 METHODS -=over 4 - -=item run - -=back +=head2 run =head1 SEE ALSO