Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update Selenium.pm
Fixed bug in get_string_array where instead of correctly returning an empty array when there are no results it returns an array containing a single empty string. The new code uses a negative lookbehind assertion to split on unescaped commas. It then uses a map to remove the escape characters from the list of strings.
  • Loading branch information
James-Switzer committed Oct 14, 2013
commit 76a0ef552f448919b2ed31e61b97a44f6a2688ea
16 changes: 1 addition & 15 deletions lib/WWW/Selenium.pm
Original file line number Diff line number Diff line change
Expand Up @@ -522,21 +522,7 @@ sub get_string_array {
my $result = $self->get_string(@_);
my $token = "";
my @tokens = ();
my @chars = split(//, $result);
for (my $i = 0; $i < @chars; $i++) {
my $char = $chars[$i];
if ($char eq '\\') {
$i++;
$char = $chars[$i];
$token .= $char;
} elsif ($char eq ',') {
push (@tokens, $token);
$token = "";
} else {
$token .= $char;
}
}
push (@tokens, $token);
@tokens = map {s/\\(.)/\1/g; $_} split /(?<!\\),/, $result;
return @tokens;
}

Expand Down