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 "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},
);
# build the Kill request
my $req =
- HTTP::Request->new( 'KILL', '/',
+ HTTP::Request->new( 'RESTART', '/',
HTTP::Headers->new( 'Connection' => 'close' ) );
$req->protocol('HTTP/1.0');
}
}
- return $self->NEXT::run( $class, $port, $host, $options );
-}
+ return $self->next::method( $class, $port, $host, $options );
+};
1;
__END__
=head1 METHODS
-=over 4
-
-=item run
-
-=back
+=head2 run
=head1 SEE ALSO