diff --git a/Changes b/Changes index 553fbab..9aabd60 100644 --- a/Changes +++ b/Changes @@ -4,6 +4,7 @@ Revision history for Geo-Coder-List Fix test count in t/googleplaces.t Don't test t/ua.t when network testing disabled Use Test::Needs + Error if there's something wrong in the cache 0.32 Sat Oct 7 10:07:45 EDT 2023 Set "geocoder" to "cached" when the values have been retrieved from the L2 cache diff --git a/bin/address_lookup b/bin/address_lookup index c64af06..26f4c72 100755 --- a/bin/address_lookup +++ b/bin/address_lookup @@ -11,6 +11,7 @@ use FindBin qw($Bin); use lib "$Bin/../lib"; use CHI; use File::Basename; +use File::HomeDir; use File::Spec; use Geo::Coder::Bing; use Geo::Coder::CA; diff --git a/lib/Geo/Coder/List.pm b/lib/Geo/Coder/List.pm index c5b88f4..f0325c7 100644 --- a/lib/Geo/Coder/List.pm +++ b/lib/Geo/Coder/List.pm @@ -183,13 +183,16 @@ sub geocode { if(ref($_) eq 'HASH') { if(defined($_->{geometry}{location}{lat})) { $allempty = 0; - delete $_->{'geocoder'}; + $_->{'geocoder'} = 'cached'; } else { delete $_->{'geometry'}; } } elsif(ref($_) eq 'Geo::Location::Point') { $allempty = 0; - delete $_->{'geocoder'}; + $_->{'geocoder'} = 'cached'; + } else { + print STDERR Data::Dumper->new([\@rc])->Dump(); + Carp::croak(ref($self), " '$location': unexpected item in the cache"); } } my $log = { @@ -209,7 +212,7 @@ sub geocode { } } - my $error; + # my $error; ENCODER: foreach my $g(@{$self->{geocoders}}) { my $geocoder = $g; @@ -254,7 +257,7 @@ sub geocode { }; CORE::push @{$self->{'log'}}, $log; Carp::carp(ref($geocoder), " '$location': $@"); - $error = $@; + # $error = $@; next ENCODER; } $timetaken = Time::HiRes::time() - $timetaken; diff --git a/t/vars.t b/t/vars.t index 92d42d4..16fa4e6 100644 --- a/t/vars.t +++ b/t/vars.t @@ -2,14 +2,13 @@ use strict; use warnings; + use Test::Most; +use Test::Needs 'Test::Vars'; -if(not $ENV{AUTHOR_TESTING}) { +if($ENV{'AUTHOR_TESTING'}) { + Test::Vars->import(); + all_vars_ok(ignore_vars => { '$self' => 0 }); +} else { plan(skip_all => 'Author tests not required for installation'); } - -eval 'use Test::Vars'; - -plan(skip_all => 'Test::Vars required for detecting unused variables') if $@; - -all_vars_ok(ignore_vars => { '$self' => 0 });