- my $userid = $conf->config('ezlocate-userid')
- or die "no ezlocate-userid configured\n";
- my $password = $conf->config('ezlocate-password')
- or die "no ezlocate-password configured\n";
-
- my $tool = $class->new($userid, $password);
- my $match = $tool->findAddress(
- $location->{address1},
- $location->{city},
- $location->{state},
- $location->{zip}, #12345-6789 format is allowed
- );
- warn "ezlocate returned match:\n".Dumper($match) if $DEBUG > 1;
- # error handling - B codes indicate success
- die $ezlocate_error{$match->{MAT_STAT}}."\n"
- unless $match->{MAT_STAT} =~ /^B\d$/;
-
- my %result = (
- address1 => $match->{MAT_ADDR},
- address2 => $location->{address2},
- city => $match->{MAT_CITY},
- state => $match->{MAT_ST},
- country => $location->{country},
- zip => $match->{MAT_ZIP},
- latitude => $match->{MAT_LAT},
- longitude => $match->{MAT_LON},
- censustract => $match->{FIPS_ST}.$match->{FIPS_CTY}.
- sprintf('%07.2f',$match->{CEN_TRCT}),
- addr_clean => 'Y',
- );
- if ( $match->{STD_ADDR} ) {
- # then they have a postal standardized address for us
- %result = ( %result,
- address1 => $match->{STD_ADDR},
- address2 => $location->{address2},
- city => $match->{STD_CITY},
- state => $match->{STD_ST},
- zip => $match->{STD_ZIP}.'-'.$match->{STD_P4},
- );