Skip to content

Commit

Permalink
Error if there's something wrong in the cache
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Mar 28, 2024
1 parent cf16e85 commit cc19a78
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions bin/address_lookup
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 7 additions & 4 deletions lib/Geo/Coder/List.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -209,7 +212,7 @@ sub geocode {
}
}

my $error;
# my $error;

ENCODER: foreach my $g(@{$self->{geocoders}}) {
my $geocoder = $g;
Expand Down Expand Up @@ -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;
Expand Down
13 changes: 6 additions & 7 deletions t/vars.t
Original file line number Diff line number Diff line change
Expand Up @@ -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 });

0 comments on commit cc19a78

Please sign in to comment.