From: Matt S Trout Date: Wed, 22 Jun 2011 11:38:59 +0000 (+0100) Subject: allow individual env vars and add sane default, remove //= since no other 5.10-isms... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8b643e0b767dd83d14831c9398b57324f17bd006;p=scpubgit%2FTest-Harness-Selenium.git allow individual env vars and add sane default, remove //= since no other 5.10-isms present --- diff --git a/lib/Test/Harness/Selenium.pm b/lib/Test/Harness/Selenium.pm index 0df97e4..cd1d929 100644 --- a/lib/Test/Harness/Selenium.pm +++ b/lib/Test/Harness/Selenium.pm @@ -35,14 +35,14 @@ BEGIN { sub new { my $class = shift; my %args = @_; - if( $ENV{SELENIUM_RC_HOST} && - $ENV{SELENIUM_RC_PORT} && - $ENV{SELENIUM_RC_START} ) { - $args{selenium_rc}{host} = $ENV{SELENIUM_RC_HOST}; - $args{selenium_rc}{port} = $ENV{SELENIUM_RC_PORT}; - $args{selenium_rc}{start} = $ENV{SELENIUM_RC_START}; - } - $args{selenium_rc}{xvnc_display} //= '0'; + my $selrc = ($args{selenium_rc} ||={}); + $selrc->{$_} = $ENV{"SELENIUM_RC_${\uc $_}"} + for grep exists $ENV{"SELENIUM_RC_${\uc $_}"}, + qw(host port start start_xvnc xvnc_display); + $selrc->{xvnc_display} ||= '0'; + $selrc->{host} ||= 'localhost'; + $selrc->{port} ||= 4444; + $args{browser} ||= '*firefox'; my $self = \%args; bless $self, $class; }