sub check_app { my ($self, $app) = @_; # Ignore if this application was never started # or was intentionally stopped if(!defined($app->{handle})) { return $self->start_app($app); } # First, check if the process exited if($app->{handle}->Wait(1)) { # Process exited, so, restart print "Process exit detected: " . $app->{description} . "!n"; return $self->start_app($app); } # All ok, just return true return 1; }