Subject: | PlaceFinder API has been removed/replaced |
Yahoo apparently removed or replaced the PlaceFinder API on which this module relied.
Seems like there are two options: switch to the commercial BOSS placefinder API or use the (rate limited) datatables and YQL.
Maybe split into two modules?
The following hack-ish patch may provide a starting point for updating the module:
--- PlaceFinder.pm.orig 2013-04-05 12:10:01.000000000 +0200
+++ PlaceFinder.pm 2013-04-05 12:24:17.000000000 +0200
@@ -53,14 +53,17 @@
my ($self, @params) = @_;
my %params = (@params % 2) ? (location => @params) : @params;
my $raw = delete $params{raw};
+ my $location = delete $params{location};
$_ = Encode::encode('utf-8', $_) for values %params;
-
- my $uri = URI->new('http://where.yahooapis.com/geocode');
+ #http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.placefinder%20where%20text%3D%22701%2BFirst%2BAve%2C%2BSunnyvale%2C%2BCA%22&diagnostics=false&flags=JRSTX&gflags=AC&format=json
+ my $uri = URI->new('http://query.yahooapis.com/v1/public/yql');
$uri->query_form(
- appid => $self->{appid},
- flags => 'JRSTX',
- gflags => 'AC',
+ diagnostics => 'false',
+ flags => 'JRSTX',
+ gflags => 'AC',
+ format => 'json',
+ q => 'select * from geo.placefinder where text="' . $location . '"',
%params,
);
@@ -75,8 +78,9 @@
return unless $data;
return $data if $raw;
- my @results = @{ $data->{ResultSet}{Results} || [] };
- return wantarray ? @results : $results[0];
+ #my @results = @{ $data->{ResultSet}{Results} || [] };
+ #return wantarray ? @results : $results[0];
+ return $data->{query}{results}{Result};
}
Note that I didn´t check for array context. I´m not really sure how the JSON would look in cases of multiple results.