Branch Coverage

File:blib/lib/Geo/Coder/Free/OpenAddresses.pm
Coverage:13.5%

line%coveragebranch
15650TFunless $class
158100TFif (my $openaddr = $param{"openaddr"})
159100TFunless -d $openaddr and -r $openaddr
253100TF@_ == 1 && !ref($_[0]) ? :
25850TFif ($$param{"ignore_words"})
262100TFif (my $scantext = $$param{"scantext"})
26350TFif length $scantext < 6
2710TFif ($region)
2750TFif (length $words[$offset] < 2)
2790TFif (exists $ignore_words{lc $words[$offset]})
2840TFif ($l = $self->geocode("location", $words[$offset]) and ref $l)
2870TFif ($offset < $count - 1)
2890TFif (length $addr == 0)
2940TFif ($addr =~ /\s+(?:\d{2,5}\s+)(?![ap]m\b)(?:(?:[a-zA-Z\s]{1,5}){1,2})?(?:[\s,.]+)?(?:(?:[a-zA-Z\s]{1,30}){1,4})(?:court|ct|street|st|drive|dr|lane|ln|road|rd|blvd)(?:[\s,.;]+)?(?:(?:[a-zA-Z\s]{1,30}){1,2})(?:[\s,.]+)?\b(?:AK|AL|AR|AZ|CA|CO|CT|DC|DE|FL|GA|GU|HI|IA|ID|IL|IN|KS|KY|LA|MA|MD|ME|MI|MN|MO|MS|MT|NC|ND|NE|NH|NJ|NM|NV|NY|OH|OK|OR|PA|RI|SC|SD|TN|TX|UT|VA|VI|VT|WA|WI|WV|WY)(?:[\s,.]+)?(?:\s+\d{5})?(?:[\s,.]+)/i) { }
0TFelsif ($addr =~ /\s+(?:\d{2,5}\s+)(?![ap]m\b)(?:(?:[a-zA-Z\s]{1,5}){1,2})?(?:[\s,.]+)?(?:(?:[a-zA-Z\s]{1,30}){1,4})(?:court|ct|street|st|drive|dr|lane|ln|road|rd|blvd)(?:[\s,.;]+)?(?:(?:[a-zA-Z\s]{1,30}){1,2})(?:[\s,.]+)?\b(?:AB|BC|MB|NB|NL|NT|NS|ON|PE|QC|SK|YT)(?:[\s,.]+)?(?:\s+\d{5})?(?:[\s,.]+)/i) { }
0TFelsif ($addr =~ /([A-Za-z]+(?:\s+[A-Za-z]+)*)([\s,.]+)?\b(AK|AL|AR|AZ|CA|CO|CT|DC|DE|FL|GA|GU|HI|IA|ID|IL|IN|KS|KY|LA|MA|MD|ME|MI|MN|MO|MS|MT|NC|ND|NE|NH|NJ|NM|NV|NY|OH|OK|OR|PA|RI|SC|SD|TN|TX|UT|VA|VI|VT|WA|WI|WV|WY)/i) { }
0TFelsif ($addr =~ /([A-Za-z]+(?:\s+[A-Za-z]+)*)([\s,.]+)?\b(AB|BC|MB|NB|NL|NT|NS|ON|PE|QC|SK|YT)/i) { }
2950TFunless ($region and $region ne "US")
2960TFif ($l = $self->geocode("location", "$addr, US") and ref $l)
3040TFunless ($region and $region ne "CA")
3050TFif ($l = $self->geocode("location", "$addr, Canada") and ref $l)
3130TFunless ($region and $region ne "US")
3140TFif ($l = $self->geocode("location", "$addr, US") and ref $l)
3240TFunless ($region and $region ne "CA")
3250TFif ($l = $self->geocode("location", "$addr, Canada") and ref $l)
3350TFif ($region and ($l = $self->geocode('location', "$addr, $region") and ref $l)) { }
0TFelsif (not $region and ($l = $self->geocode('location', $addr) and ref $l)) { }
3440TFif ($offset < $count - 2)
3460TFif ($l = $self->geocode("location", $addr) and ref $l)
366100TFunless my $location = $$param{"location"}
37150TFif ($location =~ /^,\s*(.+)/)
380100TFunless _valid_location($location)
38150TFif length $location <= 1
38350TFif ($location =~ /^(.+),?\s*Washington\s*DC$/i) { }
50TFelsif ($location =~ /^(.*),?\s*Saint Louis, (Missouri|MO)(.*)$/) { }
390100TFif (my $rc = $known_locations{$location})
415100TFunless ($location =~ /,/)
41650TFif ($location =~ /^(.+?)\s+(United States|USA|US)$/i) { }
50TFelsif ($location =~ /^(.+?)\s+(England|Scotland|Wales|Northern Ireland|UK|GB)$/i) { }
50TFelsif ($location =~ /^(.+?)\s+Canada$/i) { }
4180TFif (my $rc = $self->_get($l, "US"))
4230TFif (my $rc = $self->_get($l, "US"))
4300TFif (my $rc = $self->_get($l, "GB"))
4370TFif (my $rc = $self->_get($l, "CA"))
44450TFif ($location =~ /USA$/ or $location =~ /United States$/) { }
50TFelsif ($location =~ /(England|Scotland|Wales|Northern Ireland|UK|GB)$/i) { }
50TFelsif ($location =~ /Canada$/) { }
50TFelsif ($location =~ /Australia$/) { }
45750TFif ($ap)
4590TFif ($l =~ /(.+), (England|UK)$/i)
4620TFif ($ap->parse($l)) { }
4680TFif (my $type = $c{"street_type"})
4690TFif (my $a = _abbreviate($type)) { }
4740TFif (my $suffix = $c{"street_direction_suffix"})
4800TFif (length $c{'subcountry'} == 2) { }
4830TFif ($c{'country'} =~ /Canada/i) { }
0TFelsif ($c{'country'} =~ /^(United States|USA|US)$/i) { }
0TFelsif ($c{'country'}) { }
4850TFif (my $twoletterstate = ($_locale_ca //= "Locale::CA"->new)->{"province2code"}{uc $c{"subcountry"}})
4900TFif (my $twoletterstate = ($_locale_us //= "Locale::US"->new)->{"state2code"}{uc $c{"subcountry"}})
4950TFif ($c{"subcountry"})
5020TFif ($addr{"house_number"})
5030TFif (my $rc = $self->_search(\%addr, ("house_number", "road", "city", "state", "country")))
5070TFunless ($addr{"house_number"} and $$param{"exact"})
5080TFif (my $rc = $self->_search(\%addr, ("road", "city", "state", "country")))
51550TFif ($location =~ /^(.+?)[,\s]+(United States|USA|US)$/i)
5230TFif (not $location =~ /\sCounty,/i and my $href = 'Geo::StreetAddress::US'->parse_location($l) || 'Geo::StreetAddress::US'->parse_address($l))
5240TFif ($state = $$href{"state"})
5250TFif (length $state > 2)
5260TFif (my $twoletterstate = ($_locale_us //= "Locale::US"->new)->{"state2code"}{uc $state})
5310TFif ($$href{"city"})
5340TFif ($street = $$href{"street"})
5350TFif ($$href{"type"} and my $type = _abbreviate($$href{"type"}))
5380TFif ($$href{"suffix"})
5410TFif (my $prefix = $$href{"prefix"})
5440TFif ($$href{"number"})
5450TFif (my $rc = $self->_get($$href{"number"}, "$street$city$state", "US"))
5500TFif (my $rc = $self->_get("$street$city$state", "US"))
5600TFif (scalar @addr == 5)
5620TFif (length $state > 2)
5630TFif (my $twoletterstate = ($_locale_us //= "Locale::US"->new)->{"state2code"}{uc $state})
5670TFif (length $state == 2)
5690TFif (my $rc = $self->_get($addr[0], $addr[1], $addr[2], $state, "US"))
5750TFif (length $state == 2)
5780TFif (my $rc = $self->_get($addr[0], $addr[1], $addr[2], $state, "US"))
5820TFif (my $rc = $self->_get($addr[0], $addr[1], $state, "US"))
590100TFif ($location =~ /(.+),\s*([\s\w]+),\s*([\w\s]+)$/) { }
50TFelsif ($location =~ /([a-z\s]+),?\s*(United States|USA|US|Canada)$/i) { }
59950TFif (uc $country eq 'ENGLAND' or uc $country eq 'SCOTLAND' or uc $country eq 'WALES') { }
60750TFif ($c)
6080TFif ($c eq 'us') { }
0TFelsif ($c eq 'ca') { }
6090TFif (length $state > 2)
6100TFif (my $twoletterstate = ($_locale_us //= "Locale::US"->new)->{"state2code"}{uc $state})
6160TFif (not $city =~ /,/) { }
0TFelsif (my $href = 'Geo::StreetAddress::US'->parse_address("$city, $state")) { }
6180TFif ($city =~ /^(.+)\sCOUNTY$/) { }
6200TFif ($rc = $self->_get("$1$state", "US"))
6260TFif ($rc = $self->_get("$city$state", "US"))
6350TFif (length $state > 2)
6360TFif (my $twoletterstate = ($_locale_us //= "Locale::US"->new)->{"state2code"}{uc $state})
6400TFif ($$href{"city"})
6460TFif ($street = $fullstreet)
6490TFif (my $type = _abbreviate($$href{"type"}))
6520TFif ($$href{"suffix"})
6570TFif ($street)
6590TFif (my $prefix = $$href{"prefix"})
6630TFif ($$href{"number"})
6640TFif ($rc = $self->_get($$href{"number"}, "$street$city$state", "US"))
6680TFif ($rc = $self->_get($$href{"number"}, "$fullstreet$city$state", "US"))
6740TFif ($rc = $self->_get("$street$city$state", "US"))
6790TFif ($rc = $self->_get("$street$city$state", "US"))
6840TFif ($rc = $self->_get("$fullstreet$city$state", "US"))
6920TFif ($city =~ /^(\d.+),\s*([\w\s]+),\s*([\w\s]+)/) { }
0TFelsif ($city =~ /^(\w[\w\s]+),\s*([\w\s]+)/) { }
6940TFif (my $href = 'Geo::StreetAddress::US'->parse_address($lookup) || 'Geo::StreetAddress::US'->parse_location($lookup))
6990TFif ($$href{'state'}) { }
7040TFif (length $state > 2)
7050TFif (my $twoletterstate = ($_locale_us //= "Locale::US"->new)->{"state2code"}{uc $state})
7100TFif ($$href{"city"})
7130TFif ($$href{"number"})
7160TFif ($street = $$href{"street"})
7170TFif (my $type = _abbreviate($$href{"type"}))
7200TFif ($$href{"suffix"})
7230TFif (my $prefix = $$href{"prefix"})
7270TFif ($$href{"number"})
7280TFif ($county)
7290TFif ($rc = $self->_get($$href{"number"}, "$street$city$county$state", "US"))
7340TFif ($rc = $self->_get($$href{"number"}, "$street$city$state", "US"))
7380TFif ($county)
7390TFif ($rc = $self->_get("$street$city$county$state", "US"))
7440TFif ($rc = $self->_get("$street$city$state", "US"))
7580TFif ($second =~ /(\d+)\s+(.+)/)
7610TFif ($rc = $self->_get("$first$second$state", "US"))
7680TFif ($rc = $self->_get("$first$second$state", "US"))
7730TFif ($rc = $self->_get("$first$state", "US"))
7810TFif ($rc = $self->_get($copy, "US"))
7850TFif ($copy =~ s/(\d+)\s+/$1/)
7860TFif ($rc = $self->_get($copy, "US"))
7950TFif (length $state > 2)
7960TFif (my $twoletterstate = ($_locale_ca //= "Locale::CA"->new)->{"province2code"}{uc $state})
8010TFif (not $city =~ /,/) { }
0TFelsif (my $href = 0) { }
8040TFif ($rc = $self->_get("$city$state", "CA"))
8120TFif (length $state > 2)
8130TFif (my $twoletterstate = ($_locale_ca //= "Locale::CA"->new)->{"province2code"}{uc $state})
8180TFif ($$href{"city"})
8210TFif ($$href{"number"})
8240TFif ($street = $$href{"street"})
8250TFif (my $type = _abbreviate($$href{"type"}))
8280TFif ($$href{"suffix"})
8320TFif ($street)
8330TFif (my $prefix = $$href{"prefix"})
8400TFif ($city =~ /^(\w[\w\s]+),\s*([\w\s]+)/)
8450TFif ($rc = $self->_get("$first$second$state", "CA"))
8520TFif ($rc = $self->_get("$first$second$state", "CA"))
8570TFif ($rc = $self->_get("$first$state", "CA"))
8650TFif ($rc = $self->_get($copy, "CA"))
8690TFif ($copy =~ s/(\d+)\s+/$1/)
8700TFif ($rc = $self->_get($copy, "CA"))
8810TFif ($c eq "au" and length $state > 3)
8820TFif (my $abbrev = "Locale::SubCountry"->new("AU")->code(ucfirst lc $state))
8830TFif ($abbrev ne "unknown")
8880TFif ($city =~ /^(\w[\w\s]+),\s*([,\w\s]+)/)
8930TFif ($street =~ /^(\d+)\s+(.+)/)
8990TFif ($city eq "MINSTER, THANET")
9030TFif ($number)
9040TFif (my $rc = $self->_get("$number$street$city$state$c"))
9090TFif (my $rc = $self->_get("$street$city$state$c"))
9130TFunless ($street and $$param{"exact"})
9140TFif (my $rc = $self->_get("$city$state$c"))
9320TFif ($country =~ /Canada/i) { }
9340TFif (length $state > 2)
9350TFif (my $twoletterstate = ($_locale_ca //= "Locale::CA"->new)->{"province2code"}{uc $state})
9410TFif (length $state > 2)
9420TFif (my $twoletterstate = ($_locale_us //= "Locale::US"->new)->{"state2code"}{uc $state})
9470TFif (my $rc = $self->_get("$state$country"))
953100TFif ($country)
95550TFunless ("Geo::Address::Parser"->can("parse"))
95950TFif ($country eq "US" and "Geo::Address::Parser"->can("parse"))
9610TFif (my $fields = $addr_parser->parse($location))
9630TFunless defined $$fields{$key}
9650TFif (my $rc = $self->_search($fields, keys %{$fields;}))
97550TFif ($use_libpostal and $libpostal_is_installed == 0)
9760TFif (eval {         do {         require Geo::libpostal } }) { }
9860TFif ($use_libpostal and $libpostal_is_installed == 1 and my(%addr) = Geo::libpostal::parse_address($location))
9870TFif ($addr{"country"} and $addr{"state"} and $addr{"country"} =~ /^(Canada|United States|USA|US)$/i)
9880TFif ($street = $addr{"road"})
9920TFif ($addr{'country'} =~ /Canada/i) { }
9940TFif (length $addr{"state"} > 2)
9950TFif (my $twoletterstate = ($_locale_ca //= "Locale::CA"->new)->{"province2code"}{uc $addr{"state"}})
10010TFif (length $addr{"state"} > 2)
10020TFif (my $twoletterstate = ($_locale_us //= "Locale::US"->new)->{"state2code"}{uc $addr{"state"}})
10070TFif ($addr{"state_district"})
10090TFif (my $rc = $self->_search(\%addr, ("house_number", "road", "city", "state_district", "state", "country")))
10130TFif (my $rc = $self->_search(\%addr, ("house_number", "road", "city", "state", "country")))
10160TFif ($addr{"house_number"})
10170TFif (my $rc = $self->_search(\%addr, ("road", "city", "state", "country")))
1023100TFif ($location =~ s/,//g)
10360TFif ($$data{$column})
10400TFif ($location)
1064100TFif (length $location <= 16) { }
1079100TFif (my $cache = $$self{"cache"})
1080100TFif (my $rc = $cache->get_object($digest))
1088100TFif "Geo::Coder::Free::MissCache"->missed($miss_scope, $digest)
1098100TFif (my $geohash = $openaddr_db->geohash("md5", $digest))
1115100TFif (my $cache = $$self{"cache"})