Branch Coverage

lib/Geo/Address/Formatter.pm
Criterion Covered Total %
branch 187 238 78.5


line true false branch
34 1 0 if (defined $params{'no_warnings'} and $params{'no_warnings'})
45 0 17 if $debug
47 16 1 if ($self->_read_configuration($conf_path))
57 0 17 unless -e $path
60 1 16 unless -e $compyaml
71 0 16 if $debug
73 0 16 unless -e $wwfile
85 0 16 if $loaded == 0
89 0 16 if $debug
92 0 16 if ($debug)
97 244 0 if (defined $rh_c->{'name'})
98 148 96 if (defined $rh_c->{'aliases'}) { }
110 148 96 if (defined $rh_c->{'aliases'})
117 0 16 if ($debug)
134 42 6 if (-e $yfile)
145 12 4 if (-d $abbrvdir)
146 0 12 unless opendir my $dh, $abbrvdir
151 236 24 if ($file =~ /^(\w\w)\.yaml$/)
172 5 1 if (defined $self->{'final_components'})
175 1 0 if $show_warnings
188 0 454 if ($debug)
203 450 4 if ($cc)
213 2 452 if (defined $rh_options->{'only_address'})
217 0 454 if ($debug)
235 2840 734 if defined $self->{'component_aliases'}{$c}
239 500 234 if (defined $self->{'component2type'}{$c})
242 396 104 unless (defined $rh_components->{$ptype})
254 319 38 if (scalar @aliases == 1)
262 38 6 if (defined $rh_components->{$c})
269 0 454 if ($debug)
276 0 454 if ($debug)
285 2 452 if (defined $rh_options->{'address_template'}) { }
290 450 2 if (defined $rh_config->{'address_template'}) { }
2 0 elsif (defined $self->{'templates'}{'default'}{'address_template'}) { }
298 49 403 unless ($self->_minimal_components($rh_components))
299 0 49 if $debug
300 34 15 if (defined $rh_config->{'fallback_template'}) { }
14 1 elsif (defined $self->{'templates'}{'default'}{'fallback_template'}) { }
310 0 454 if $debug
314 0 454 if ($debug)
320 0 454 if ($debug)
326 0 454 if ($debug)
332 0 454 if ($debug)
337 3 451 if ($oa) { }
338 0 3 if ($debug)
345 0 451 if ($debug)
349 224 227 if (scalar @$ra_unknown)
352 0 224 if ($debug)
359 5 449 if ($abbrv)
370 0 454 if ($debug)
379 0 454 if ($debug)
402 0 456 if ($debug)
413 561 4 if (lc $piece ne "new york")
414 1 560 if $seen{$piece} > 1
430 46 466 if ($replacement =~ /\$\d/)
431 19 27 if ($text =~ /$regexp/)
453 313 142 if (defined $rh_components->{'postcode'})
454 1 312 if (length $rh_components->{'postcode'} > 20) { }
1 311 elsif ($rh_components->{'postcode'} =~ /\d+;\d+/) { }
1 310 elsif ($rh_components->{'postcode'} =~ /^(\d{5}),\d{5}/) { }
467 0 3931 if (not defined $rh_components->{$c}) { }
1 3930 elsif (not $rh_components->{$c} =~ /\w/) { }
1 3929 elsif ($rh_components->{$c} =~ m[https?://]) { }
490 208 696 unless defined $rh_components->{$c}
491 49 855 if $missing == $minimal_threshold
506 4 451 unless defined $rh_components->{'country_code'}
508 451 0 if (my $cc = lc $rh_components->{'country_code'})
511 0 451 unless $cc =~ /^[a-z][a-z]$/
512 0 451 if $cc eq "uk"
520 49 402 if (defined $self->{'templates'}{$cc} and defined $self->{'templates'}{$cc}{'use_country'})
525 36 13 if (defined $self->{'templates'}{$old_cc}{'change_country'})
528 2 34 if ($new_country =~ /\$(\w*)/)
530 2 0 if (defined $rh_components->{$component}) { }
538 12 37 if (defined $self->{'templates'}{$old_cc}{'add_component'})
542 11 1 if (defined $valid_replacement_components{$k})
548 5 446 if ($cc eq "NL")
549 5 0 if (defined $rh_components->{'state'})
550 1 4 if ($rh_components->{'state'} eq "Cura\347ao") { }
0 4 elsif ($rh_components->{'state'} =~ /^sint maarten/i) { }
1 3 elsif ($rh_components->{'state'} =~ /^Aruba/i) { }
574 451 3 if (defined $rh_components->{'country'})
575 1 450 if (&looks_like_number($rh_components->{'country'}))
576 1 0 if (defined $rh_components->{'state'})
603 9 905 unless $rh_components->{'country_code'}
604 339 566 unless $rh_components->{$keyname}
608 26 540 if (defined $rh_components->{$code})
612 25 1 if ($rh_components->{$code} ne $rh_components->{$keyname})
621 283 258 if (my $mapping = $$self{$code . "s"}{$cc})
631 839 5832 if (XXX) { }
638 180 7407 if ($uc_name eq uc $confname)
648 6 7401 if ($uc_name eq $abbrv)
658 254 29 if ($keyname eq "state")
659 81 173 unless (defined $rh_components->{'state_code'})
660 2 79 if ($cc eq "US")
661 0 2 if ($rh_components->{'state'} =~ /^united states/i)
665 0 0 if (uc $state eq uc $k)
671 2 0 if ($rh_components->{'state'} =~ /^washington,? d\.?c\.?/i)
688 0 457 if ($debug)
698 82 7928 if ($ra_fromto->[0] =~ /^$component=/) { }
701 5 77 if ($rh_components->{$component} eq $from) { }
709 8005 5 if (defined $regexp)
727 2 5 unless (defined $rh_comp->{'country_code'})
728 1 1 if ($show_warnings)
730 1 0 if (defined $rh_comp->{'country'})
742 5 0 if (defined $self->{'country2lang'}{$cc})
748 6 3 if (defined $self->{'abbreviations'}{$lang}) { }
752 0 10 unless defined $rh_comp->{$comp_name}
771 0 913 if ($debug)
800 18 3511 if $seen_lines{$line} > 1
808 3708 10 if (lc $w ne "new york")
811 2 3716 if defined $seen_words{$w} and $seen_words{$w} > 1
833 0 455 if $debug
838 0 455 if $debug
843 2 453 unless ($output =~ /\w/)
845 0 2 if (scalar @comps == 1)
879 681 102 scalar @a_parts ? :
903 450 0 if (defined $cc)
905 226 224 if defined $self->{'set_district_alias'}{$ucc}
910 0 224 if (defined $small_district{$cc}) { }