65842035f7b6ce44ee618546813f2b58aaec16ba
[Geo-USCensus-Geocoding.git] / Geocoding / Match.pm
1 package Geo::USCensus::Geocoding::Match;
2
3 use strict;
4
5 sub new {
6   my $class = shift;
7   my $address = shift;
8   my $census = shift;
9
10   my $self = { %$address };
11   bless $self, $class;
12 }
13
14 sub matchedAddress {
15   my $self = shift;
16   $self->{matchedAddress};
17 }
18
19 sub coordinates {
20   my $self = shift;
21   $self->{coordinates};
22 }
23
24 sub addressComponents {
25   my $self = shift;
26   $self->{addressComponents};
27 }
28
29 sub geographies {
30   my $self = shift;
31   $self->{geographies};
32 }
33
34 sub censustract {
35   my $self = shift;
36   return '' unless $self->geographies
37                 and exists($self->geographies->{'Census Tracts'})
38                 and exists($self->geographies->{'Census Tracts'}->[0]);
39   my $ct = $self->geographies->{'Census Tracts'}->[0];
40   return $ct->{STATE} . $ct->{COUNTY} . $ct->{TRACT};
41 }
42
43 1;