Branch Coverage

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

line%coveragebranch
12750TFunless $class
129100TFif (my $openaddr = $param{"openaddr"})
130100TFunless -d $openaddr and -r $openaddr
18350TF@_ == 1 && !ref($_[0]) ? :
18850TFif ($$param{"ignore_words"})
192100TFif (my $scantext = $$param{"scantext"})
19350TFif length $scantext < 6
2010TFif ($region)
2050TFif (length $words[$offset] < 2)
2090TFif (exists $ignore_words{lc $words[$offset]})
2140TFif ($l = $self->geocode("location", $words[$offset]) and ref $l)
2170TFif ($offset < $count - 1)
2190TFif (length $addr == 0)
2240TFif ($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) { }
2250TFunless ($region and $region ne "US")
2260TFif ($l = $self->geocode("location", "$addr, US") and ref $l)
2340TFunless ($region and $region ne "CA")
2350TFif ($l = $self->geocode("location", "$addr, Canada") and ref $l)
2430TFunless ($region and $region ne "US")
2440TFif ($l = $self->geocode("location", "$addr, US") and ref $l)
2540TFunless ($region and $region ne "CA")
2550TFif ($l = $self->geocode("location", "$addr, Canada") and ref $l)
2650TFif ($region and ($l = $self->geocode('location', "$addr, $region") and ref $l)) { }
0TFelsif (not $region and ($l = $self->geocode('location', $addr) and ref $l)) { }
2740TFif ($offset < $count - 2)
2760TFif ($l = $self->geocode("location", $addr) and ref $l)
296100TFunless my $location = $$param{"location"}
30150TFif ($location =~ /^,\s*(.+)/)
306100TFunless ($location =~ /\D/)
31050TFif length $location <= 1
31250TFif ($location =~ /^(.+),?\s*Washington\s*DC$/i) { }
50TFelsif ($location =~ /^(.*),?\s*Saint Louis, (Missouri|MO)(.*)$/) { }
319100TFif (my $rc = $known_locations{$location})
33950TFunless ($location =~ /,/)
3400TFif ($location =~ /^(.+?)\s+(United States|USA|US)$/i) { }
0TFelsif ($location =~ /^(.+?)\s+(England|Scotland|Wales|Northern Ireland|UK|GB)$/i) { }
0TFelsif ($location =~ /^(.+?)\s+Canada$/i) { }
3420TFif (my $rc = $self->_get($l, "US"))
3470TFif (my $rc = $self->_get($l, "US"))
3540TFif (my $rc = $self->_get($l, "GB"))
3610TFif (my $rc = $self->_get($l, "CA"))
36850TFif ($location =~ /USA$/ or $location =~ /United States$/) { }
50TFelsif ($location =~ /(England|Scotland|Wales|Northern Ireland|UK|GB)$/i) { }
50TFelsif ($location =~ /Canada$/) { }
50TFelsif ($location =~ /Australia$/) { }
38150TFif ($ap)
3830TFif ($l =~ /(.+), (England|UK)$/i)
3860TFif ($ap->parse($l)) { }
3920TFif (my $type = $c{"street_type"})
3930TFif (my $a = _abbreviate($type)) { }
3980TFif (my $suffix = $c{"street_direction_suffix"})
4040TFif (length $c{'subcountry'} == 2) { }
4070TFif ($c{'country'} =~ /Canada/i) { }
0TFelsif ($c{'country'} =~ /^(United States|USA|US)$/i) { }
0TFelsif ($c{'country'}) { }
4090TFif (my $twoletterstate = ($_locale_ca //= "Locale::CA"->new)->{"province2code"}{uc $c{"subcountry"}})
4140TFif (my $twoletterstate = ($_locale_us //= "Locale::US"->new)->{"state2code"}{uc $c{"subcountry"}})
4190TFif ($c{"subcountry"})
4260TFif ($addr{"house_number"})
4270TFif (my $rc = $self->_search(\%addr, ("house_number", "road", "city", "state", "country")))
4310TFunless ($addr{"house_number"} and $$param{"exact"})
4320TFif (my $rc = $self->_search(\%addr, ("road", "city", "state", "country")))
43950TFif ($location =~ /^(.+?)[,\s]+(United States|USA|US)$/i)
4470TFif (not $location =~ /\sCounty,/i and my $href = 'Geo::StreetAddress::US'->parse_location($l) || 'Geo::StreetAddress::US'->parse_address($l))
4480TFif ($state = $$href{"state"})
4490TFif (length $state > 2)
4500TFif (my $twoletterstate = ($_locale_us //= "Locale::US"->new)->{"state2code"}{uc $state})
4550TFif ($$href{"city"})
4580TFif ($street = $$href{"street"})
4590TFif ($$href{"type"} and my $type = _abbreviate($$href{"type"}))
4620TFif ($$href{"suffix"})
4650TFif (my $prefix = $$href{"prefix"})
4680TFif ($$href{"number"})
4690TFif (my $rc = $self->_get($$href{"number"}, "$street$city$state", "US"))
4740TFif (my $rc = $self->_get("$street$city$state", "US"))
4840TFif (scalar @addr == 5)
4860TFif (length $state > 2)
4870TFif (my $twoletterstate = ($_locale_us //= "Locale::US"->new)->{"state2code"}{uc $state})
4910TFif (length $state == 2)
4930TFif (my $rc = $self->_get($addr[0], $addr[1], $addr[2], $state, "US"))
4990TFif (length $state == 2)
5020TFif (my $rc = $self->_get($addr[0], $addr[1], $addr[2], $state, "US"))
5060TFif (my $rc = $self->_get($addr[0], $addr[1], $state, "US"))
51450TFif ($location =~ /(.+),\s*([\s\w]+),\s*([\w\s]+)$/) { }
0TFelsif ($location =~ /([a-z\s]+),?\s*(United States|USA|US|Canada)$/i) { }
52350TFif (uc $country eq 'ENGLAND' or uc $country eq 'SCOTLAND' or uc $country eq 'WALES') { }
53150TFif ($c)
5320TFif ($c eq 'us') { }
0TFelsif ($c eq 'ca') { }
5330TFif (length $state > 2)
5340TFif (my $twoletterstate = ($_locale_us //= "Locale::US"->new)->{"state2code"}{uc $state})
5400TFif (not $city =~ /,/) { }
0TFelsif (my $href = 'Geo::StreetAddress::US'->parse_address("$city, $state")) { }
5420TFif ($city =~ /^(.+)\sCOUNTY$/) { }
5440TFif ($rc = $self->_get("$1$state", "US"))
5500TFif ($rc = $self->_get("$city$state", "US"))
5590TFif (length $state > 2)
5600TFif (my $twoletterstate = ($_locale_us //= "Locale::US"->new)->{"state2code"}{uc $state})
5640TFif ($$href{"city"})
5700TFif ($street = $fullstreet)
5730TFif (my $type = _abbreviate($$href{"type"}))
5760TFif ($$href{"suffix"})
5810TFif ($street)
5830TFif (my $prefix = $$href{"prefix"})
5870TFif ($$href{"number"})
5880TFif ($rc = $self->_get($$href{"number"}, "$street$city$state", "US"))
5920TFif ($rc = $self->_get($$href{"number"}, "$fullstreet$city$state", "US"))
5980TFif ($rc = $self->_get("$street$city$state", "US"))
6030TFif ($rc = $self->_get("$street$city$state", "US"))
6080TFif ($rc = $self->_get("$fullstreet$city$state", "US"))
6160TFif ($city =~ /^(\d.+),\s*([\w\s]+),\s*([\w\s]+)/) { }
0TFelsif ($city =~ /^(\w[\w\s]+),\s*([\w\s]+)/) { }
6180TFif (my $href = 'Geo::StreetAddress::US'->parse_address($lookup) || 'Geo::StreetAddress::US'->parse_location($lookup))
6230TFif ($$href{'state'}) { }
6280TFif (length $state > 2)
6290TFif (my $twoletterstate = ($_locale_us //= "Locale::US"->new)->{"state2code"}{uc $state})
6340TFif ($$href{"city"})
6370TFif ($$href{"number"})
6400TFif ($street = $$href{"street"})
6410TFif (my $type = _abbreviate($$href{"type"}))
6440TFif ($$href{"suffix"})
6470TFif (my $prefix = $$href{"prefix"})
6510TFif ($$href{"number"})
6520TFif ($county)
6530TFif ($rc = $self->_get($$href{"number"}, "$street$city$county$state", "US"))
6580TFif ($rc = $self->_get($$href{"number"}, "$street$city$state", "US"))
6620TFif ($county)
6630TFif ($rc = $self->_get("$street$city$county$state", "US"))
6680TFif ($rc = $self->_get("$street$city$state", "US"))
6820TFif ($second =~ /(\d+)\s+(.+)/)
6850TFif ($rc = $self->_get("$first$second$state", "US"))
6920TFif ($rc = $self->_get("$first$second$state", "US"))
6970TFif ($rc = $self->_get("$first$state", "US"))
7050TFif ($rc = $self->_get($copy, "US"))
7090TFif ($copy =~ s/(\d+)\s+/$1/)
7100TFif ($rc = $self->_get($copy, "US"))
7190TFif (length $state > 2)
7200TFif (my $twoletterstate = ($_locale_ca //= "Locale::CA"->new)->{"province2code"}{uc $state})
7250TFif (not $city =~ /,/) { }
0TFelsif (my $href = 0) { }
7280TFif ($rc = $self->_get("$city$state", "CA"))
7360TFif (length $state > 2)
7370TFif (my $twoletterstate = ($_locale_ca //= "Locale::CA"->new)->{"province2code"}{uc $state})
7420TFif ($$href{"city"})
7450TFif ($$href{"number"})
7480TFif ($street = $$href{"street"})
7490TFif (my $type = _abbreviate($$href{"type"}))
7520TFif ($$href{"suffix"})
7560TFif ($street)
7570TFif (my $prefix = $$href{"prefix"})
7640TFif ($city =~ /^(\w[\w\s]+),\s*([\w\s]+)/)
7690TFif ($rc = $self->_get("$first$second$state", "CA"))
7760TFif ($rc = $self->_get("$first$second$state", "CA"))
7810TFif ($rc = $self->_get("$first$state", "CA"))
7890TFif ($rc = $self->_get($copy, "CA"))
7930TFif ($copy =~ s/(\d+)\s+/$1/)
7940TFif ($rc = $self->_get($copy, "CA"))
8050TFif ($c eq "au" and length $state > 3)
8060TFif (my $abbrev = "Locale::SubCountry"->new("AU")->code(ucfirst lc $state))
8070TFif ($abbrev ne "unknown")
8120TFif ($city =~ /^(\w[\w\s]+),\s*([,\w\s]+)/)
8170TFif ($street =~ /^(\d+)\s+(.+)/)
8230TFif ($city eq "MINSTER, THANET")
8270TFif ($number)
8280TFif (my $rc = $self->_get("$number$street$city$state$c"))
8330TFif (my $rc = $self->_get("$street$city$state$c"))
8370TFunless ($street and $$param{"exact"})
8380TFif (my $rc = $self->_get("$city$state$c"))
8560TFif ($country =~ /Canada/i) { }
8580TFif (length $state > 2)
8590TFif (my $twoletterstate = ($_locale_ca //= "Locale::CA"->new)->{"province2code"}{uc $state})
8650TFif (length $state > 2)
8660TFif (my $twoletterstate = ($_locale_us //= "Locale::US"->new)->{"state2code"}{uc $state})
8710TFif (my $rc = $self->_get("$state$country"))
87750TFif ($country)
87850TFunless "Geo::Address::Parser"->can("parse")
8800TFif ($country eq "US")
8820TFif (my $fields = $addr_parser->parse($location))
8840TFunless defined $$fields{$key}
8860TFif (my $rc = $self->_search($fields, keys %{$fields;}))
8950TFif ($libpostal_is_installed == 0)
8960TFif (eval {         do {         require Geo::libpostal } }) { }
9060TFif ($libpostal_is_installed == 1 and my(%addr) = Geo::libpostal::parse_address($location))
9070TFif ($addr{"country"} and $addr{"state"} and $addr{"country"} =~ /^(Canada|United States|USA|US)$/i)
9080TFif ($street = $addr{"road"})
9120TFif ($addr{'country'} =~ /Canada/i) { }
9140TFif (length $addr{"state"} > 2)
9150TFif (my $twoletterstate = ($_locale_ca //= "Locale::CA"->new)->{"province2code"}{uc $addr{"state"}})
9210TFif (length $addr{"state"} > 2)
9220TFif (my $twoletterstate = ($_locale_us //= "Locale::US"->new)->{"state2code"}{uc $addr{"state"}})
9270TFif ($addr{"state_district"})
9290TFif (my $rc = $self->_search(\%addr, ("house_number", "road", "city", "state_district", "state", "country")))
9330TFif (my $rc = $self->_search(\%addr, ("house_number", "road", "city", "state", "country")))
9360TFif ($addr{"house_number"})
9370TFif (my $rc = $self->_search(\%addr, ("road", "city", "state", "country")))
9430TFif ($location =~ s/,//g)
9560TFif ($$data{$column})
9600TFif ($location)
9780TFif (length $location <= 16) { }
9900TFif (defined $unknown_locations{$digest})
9960TFif (my $cache = $$self{"cache"})
9970TFif (my $rc = $cache->get_object($digest))
10090TFif (my $geohash = $openaddr_db->geohash("md5", $digest))
10210TFif (my $cache = $$self{"cache"})