From: Matt S Trout Date: Wed, 22 Jun 2011 12:56:46 +0000 (+0100) Subject: add guards to app server management methods to save callers needing to check if they... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5a4560702bcb88794d85856db5e6211d9c7cfadb;p=scpubgit%2FTest-Harness-Selenium.git add guards to app server management methods to save callers needing to check if they need using, add cleanup destructor --- diff --git a/lib/Test/Harness/Selenium.pm b/lib/Test/Harness/Selenium.pm index 99ffe43..3937119 100644 --- a/lib/Test/Harness/Selenium.pm +++ b/lib/Test/Harness/Selenium.pm @@ -128,13 +128,16 @@ sub stop_selenium_server { sub start_app_server { my($self) = @_; + return unless $self->{app_server_cmd}; my $child = Child->new(sub { exec($self->{app_server_cmd}) } ); $self->{app_server_proc} = $child->start; } sub stop_app_server { my($self) = @_; - $self->{app_server_proc}->kill("KILL"); + if (my $proc = $self->{app_server_proc}) { + $proc->kill("KILL"); + } } sub test_directory { @@ -171,13 +174,12 @@ sub get_rows_for { sub done { my($self) = @_; - if(exists $self->{selenium_rc}{xvnc_server_proc} and - exists $self->{selenium_rc}{selenium_server_proc}) { - $self->stop_selenium_server; - } + $self->stop_selenium_server; $self->stop_app_server; } +sub DESTROY { shift->done } + 1; __END__