diff --git a/lib/Geo/Coder/Free/Display/query.pm b/lib/Geo/Coder/Free/Display/query.pm index ecdff866..add6cdfa 100644 --- a/lib/Geo/Coder/Free/Display/query.pm +++ b/lib/Geo/Coder/Free/Display/query.pm @@ -61,27 +61,27 @@ sub html { } elsif(my $scantext = $params{'scantext'}) { my @rc = $geocoder->geocode(scantext => $scantext); - return '{}' if(scalar(@rc) == 0); - - # foreach my $l(@rc) { - # delete $l->{'md5'}; - # delete $l->{'sequence'}; - # foreach my $key(keys %{$l}) { - # if(!defined($l->{$key})) { - # delete $l->{$key}; + if(scalar(@rc) > 0) { + # foreach my $l(@rc) { + # delete $l->{'md5'}; + # delete $l->{'sequence'}; + # foreach my $key(keys %{$l}) { + # if(!defined($l->{$key})) { + # delete $l->{$key}; + # } # } # } - # } - # return encode_json \@rc; - - my @locations; - foreach my $l(@rc) { - push @locations, { - 'latitude' => $l->lat(), - 'longitude' => $l->long() + # return encode_json \@rc; + + my @locations; + foreach my $l(@rc) { + push @locations, { + 'latitude' => $l->lat(), + 'longitude' => $l->long() + }; }; - }; - return encode_json \@locations; + return encode_json \@locations; + } } return '{}';