required => 1,
);
+has argv => (
+ is => 'ro',
+ isa => 'ArrayRef',
+ required => 1,
+);
+
has _watcher => (
is => 'rw',
isa => 'File::ChangeNotify::Watcher',
delete $p->{start_sub};
- $p->{filter} ||= qr/(?:\/|^)(?!\.\#).+(?:\.yml$|\.yaml$|\.conf|\.pm)$/;
+ $p->{filter} ||= qr/(?:\/|^)(?![.#_]).+(?:\.yml$|\.yaml$|\.conf|\.pm)$/;
$p->{directories} ||= abs_path( File::Spec->catdir( $FindBin::Bin, '..' ) );
# We could make this lazily, but this lets us check that we
sub _restart_on_changes {
my $self = shift;
- my @events = $self->_watcher->wait_for_events();
- $self->_handle_events(@events);
+ # We use this loop in order to avoid having _handle_events() call back
+ # into this method. We used to do that, and the end result was that stack
+ # traces become longer and longer with every restart. Using the loop, the
+ # portion of the stack trace that covers this code never changes.
+ while (1) {
+ my @events = $self->_watcher->wait_for_events();
+ $self->_handle_events(@events);
+ }
}
sub _handle_events {
$self->_kill_child;
$self->_fork_and_start;
-
- $self->_restart_on_changes;
}
sub DEMOLISH {