diff --git a/bin/address_lookup b/bin/address_lookup index dcb11ba..c64af06 100755 --- a/bin/address_lookup +++ b/bin/address_lookup @@ -31,13 +31,14 @@ if(scalar(@ARGV) == 0) { die "Usage: $0 location"; } -my $cachedir; -if(my $e = $ENV{'CACHEDIR'}) { - $cachedir = File::Spec->catfile($e, basename($0)); +my $cache_dir; +if(my $e = $ENV{'CACHE_DIR'}) { + $cache_dir = File::Spec->catfile($e, basename($0)); } else { - $cachedir = File::Spec->catfile(File::Spec->tmpdir(), 'cache', basename($0)); + # $cache_dir = File::Spec->catfile(File::Spec->tmpdir(), 'cache', basename($0)); + $cache_dir = File::Spec->catfile(File::HomeDir->my_home(), '.cache', basename($0)) } -my $geocoder = Geo::Coder::List->new(cache => CHI->new(driver => 'File', root_dir => $cachedir)); +my $geocoder = Geo::Coder::List->new(cache => CHI->new(driver => 'File', root_dir => $cache_dir)); my $freegeocoder; if(my $oa = $ENV{'OPENADDR_HOME'}) { $freegeocoder = Geo::Coder::Free->new(openaddr => $oa);