Permalink
Browse files

use apikey

  • Loading branch information...
1 parent 8b5ceac commit 16c98cc5843bd442e6b75cf1a829c675a271c460 @gray committed Sep 30, 2009
Showing with 7 additions and 1 deletion.
  1. +7 −1 ex/custom-useragent.pl
View
8 ex/custom-useragent.pl
@@ -5,6 +5,9 @@
use Data::Dumper;
use Geo::Coder::Mapquest;
+unless ($ENV{MAPQUEST_APIKEY}) {
+ die "MAPQUEST_APIKEY environment variable must be set";
+}
my $location = join(' ', @ARGV) || die "Usage: $0 \$location_string";
# Custom useragent identifier.
@@ -18,7 +21,10 @@
# Load any proxy settings from environment variables.
$ua->env_proxy;
-my $geocoder = Geo::Coder::Mapquest->new(ua => $ua);
+my $geocoder = Geo::Coder::Mapquest->new(
+ apikey => $ENV{MAPQUEST_APIKEY},
+ ua => $ua,
+);
my $result = $geocoder->geocode(location => $location);
local $Data::Dumper::Indent = 1;

0 comments on commit 16c98cc

Please sign in to comment.