brayk1990 has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to use the module Geo::Coder::Google, but I keep getting an error when I try to run it. I've searched around an my code is very similar (basically identical) to other code I have seen, and they say their code runs. My first thought when receiving the error was that I had left out the API key was I went to Google and got one of those. Unfortunately the error persisted. This leads me to believe that I am missing something, but I haven't been able to figure out what that is. I'm hoping someone can point me in the direction of what other code I need to add in order to get functioning. Thank you in advance.

Here is error I'm receiving: Google Maps API returned error: 500 Can't verify SSL peers without knowing which Certificate Authorities to trust at test.pl line 7.

Here is my code:

1:#!/usr/bin/perl 2:use strict; 3:use warnings; 4: 5:use Geo::Coder::Google; 6:my $geocoder = Geo::Coder::Google->new( apiver => 3, gl => 'us', api +key => 'My API Key Here' ); 7:my $location = $geocoder->geocode( location => 'Mount Vernon, IN' ); 8: 9:print "$location->{'geometry'}->{'location'}->{'lat'}"; 10:print "$location->{'geometry'}->{'location'}->{'lng'}";

Replies are listed 'Best First'.
Re: Error trying to use Geo::Coder::Google
by hippo (Archbishop) on Feb 28, 2016 at 10:35 UTC

    Your code runs fine without error for me (once I'd removed the line numbers - please don't include those in future).

    • Geo::Coder::Google 0.16
    • Mozilla::CA 20141217
    • LWP::Protocol::https 6.06
    • perl v5.20.3 x86_64-linux-thread-multi

    Did you run "make test" when you installed it? Did you set $ENV{TEST_GEOCODER_GOOGLE_LIVE} to 1 prior to running the tests? Are your versions of key modules too old/new?

Re: Error trying to use Geo::Coder::Google
by stevieb (Canon) on Feb 28, 2016 at 01:10 UTC

    I don't know what that module uses under the hood, but a quick drop of the error into Google came up with a few things ... does this help?

Re: Error trying to use Geo::Coder::Google
by poj (Abbot) on Feb 28, 2016 at 06:25 UTC
    .. what other code I need to add in order to get functioning

    Your code works fine for me without the apikey

    37.9322662
    -87.8950267
    poj
Re: Error trying to use Geo::Coder::Google
by Anonymous Monk on Feb 27, 2016 at 21:20 UTC
    A reply falls below the community's threshold of quality. You may see it by logging in.