sub stop_app { my ($self, $app) = @_; if(defined($app->{handle}) && $app->{handle}) { print "Killing app " . $app->{description} . "...\n"; my $app_pid = $app->{handle}->GetProcessID(); $app->{handle}->Kill(0); $app->{handle}->Wait(2000); $app->{handle} = undef; print "...killed.\n"; } else { print "App " . $app->{description} . " already killed\n"; } }