Branch Coverage

blib/lib/Astro/App/Satpass2/FormatValue.pm
Criterion Covered Total %
branch 238 338 70.4


line true false branch
39 731 18 if ref $class
50 0 1498 unless ref $self->{$name} and "HASH" eq &reftype($self->{$name})
58 282 467 exists $args{'fixed_width'} ? :
63 18 731 unless defined($self->{'local_coordinates'} = $args{'local_coordinates'})
68 0 749 unless ref $self->{'local_coordinates'} or $self->{'local_coordinates'} = $self->can("__local_coord_$self->{'local_coordinates'}")
71 0 749 unless "CODE" eq ref $self->{'local_coordinates'}
76 18 731 unless defined($self->{'list_formatter'} = $args{'list_formatter'})
79 0 749 unless "CODE" eq ref $self->{'list_formatter'}
91 13 736 unless ref $self->{'time_formatter'}
95 0 749 unless instance($self->{'time_formatter'}, "Astro::App::Satpass2::FormatTime")
99 18 731 unless defined $self->{'date_format'}
102 18 731 unless defined $self->{'time_format'}
103 731 18 if (exists $args{'round_time'}) { }
121 0 282 if (@args == 1 and 'HASH' eq ref $args[0]) { }
128 4101 282 unless defined $arg{$name}
151 14 0 if (@args) { }
161 786 60 if (@args) { }
164 0 786 unless is_valid_title_gravity($args[0])
182 0 9 unless my $bodies = $self->_get("data", "bodies")
189 5 4 unless defined $twilight
194 0 20 unless embodies($body, "Astro::Coord::ECI")
216 6 0 if defined $time
223 14 6 unless embodies($arg{'body'}, "Astro::Coord::ECI::TLE")
227 0 6 unless defined $arg{'time'}
230 6 0 unless embodies($arg{'sun'}, "Astro::Coord::ECI")
232 0 6 unless embodies($arg{'sun'}, "Astro::Coord::ECI")
236 0 6 unless defined $arg{'twilight'}
241 0 6 unless defined $arg{'time'} and embodies($arg{'station'}, "Astro::Coord::ECI")
246 0 6 unless $arg{'body'}->illuminated($arg{'time'})
249 0 6 if _elevation($arg{'station'}, $arg{'sun'}, $arg{'time'}) > $arg{'twilight'} and _elevation($arg{'station'}, $arg{'body'}, $arg{'time'}) >= 0
277 2 8 unless embodies($evt->{'body'}, "Astro::Coord::ECI::TLE")
287 0 36 unless my $events = $self->_get("data", "events")
290 0 36 unless "ARRAY" eq ref $events
299 14 6 unless my $body = $self->_get_tle("body")
302 0 6 unless my $sta = $self->_get_eci("station")
306 0 6 unless defined $time
308 0 6 unless defined $time
311 0 6 unless defined $illum
318 6 0 unless $illum and 2 == $illum || 3 == $illum and $body->can_flare($self->_get("data", "questionable"))
351 2 1 ($body = $self->body) ? :
355 0 3 if $code = $self->can("__list_formatter_$type")
1495 356 1512 unless ($self->{'internal'}{'time_set'})
1496 329 27 if (defined(my $time = $self->_get("data", "time")))
1498 52 606 unless my $obj = $self->_get_eci($key)
1514 11 0 unless defined $name
1542 0 3 unless instance($fmtr_obj, $fmtr_class)
1547 0 3 if $self->can($name) and not $defined_here{$name}
1550 0 3 if $self->{'formatter_method'}{$name}
1552 1 2 unless ($defined_here{$name})
1558 0 1 unless my $obj = $self->{'formatter_method'}{$name}
1570 0 540 unless "HASH" eq ref $fmtr
1573 0 540 unless defined(my $fmtr_name = $fmtr->{'name'})
1577 0 540 unless $fmtr->{'dimension'}
1580 0 540 unless defined(my $dim_name = $fmtr->{'dimension'}{'dimension'})
1582 0 540 unless $dimensions{$dim_name}
1584 0 540 if (defined(my $dflt = $fmtr->{'dimension'}{'default'}))
1585 0 0 unless defined $dimensions{$dim_name}{'define'}{$dflt}
1591 44 496 if ("time_units" eq $dim_name)
1592 44 0 if ('ARRAY' eq ref $fmtr->{'dimension'}{'format'}) { }
1594 0 66 unless $class->_valid_time_format_name($entry)
1618 0 540 unless "CODE" eq ref $fmtr->{'fetch'}
1626 658 1868 $self->{'title'} || defined $arg{'literal'} ? :
1631 188 2338 $fmtr->{'chain'} ? :
1636 0 2662 defined $arg{'literal'} ? :
1651 0 539 if $class->can($fmtr_name)
1675 37 79 unless exists $self->{'internal'}{'_title_info'}
1677 42 37 if ($more = delete $self->{'internal'}{'_title_info'}{'more'}) { }
1705 120 2100 unless defined $arg->{'width'} or $self->{'fixed_width'}
1707 5 2521 if (defined $arg->{'format'} and not defined $arg->{'width'})
1716 935 12625 if defined $arg->{$key}
1719 19 25212 if defined($arg->{$key} = $self->_get($source, $fmtr_name, $key))
1727 2483 10123 if defined($arg->{$key} = __localize("text", [$fmtr_name, $key], "locale", $fmtr->{'locale'}))
1731 1188 8935 'CODE' eq ref $default ? :
1737 8 2518 unless defined $arg->{'width'}
1739 0 2526 if $arg->{'width'} =~ / \D /msx
1741 2145 381 if ($self->{'report'})
1744 4269 2166 unless defined $arg->{$key}
1765 0 2662 unless defined(my $dim_name = $fmtr->{'dimension'}{'dimension'})
1771 0 2662 unless $dim = $dimensions{$dim_name} and defined(my $unit_name = _dor($arg->{'units'}, $fmtr->{'dimension'}{'units'}, $self->_get("default", $fmtr_name, "units"), $dim->{'default'}))
1776 0 2662 unless my $unit = $dim->{'define'}{$unit_name}
1778 13 2649 if (defined $unit->{'alias'})
1780 0 13 unless my $alias = $dim->{'define'}{$unit->{'alias'}}
1787 2438 224 unless defined $arg->{'align_left'}
1790 658 2004 if $self->{'title'}
1792 158 1846 unless defined $value
1796 8 1838 if (defined $unit->{'method'})
1798 1 7 unless defined($value = $self->$method($value))
1803 554 1291 if defined $unit->{'factor'}
1807 6 1839 if defined $unit->{'gmt'} and not defined $arg->{'gmt'}
1820 0 1845 unless defined(my $formatter = _dor($unit->{'formatter'}, $fmtr->{'dimension'}{'formatter'}, $dim->{'formatter'}))
1830 452 2312 'HASH' eq ref $arg[-1] ? :
1834 637 541 if (has_method($item, 'dereference')) { }
1841 9 2755 if @clean % 2
1917 0 658 unless defined $arg->{'title'}
1928 0 786 unless defined(my $value = pop @args)
1930 786 0 $do_title{$value} ? :
1938 64 277 if $arg->{'width'} eq ""
1941 0 277 unless $arg->{'width'}
1953 3 185 unless $arg->{'bearing'} and $arg->{'bearing'} =~ / \A [0-9]+ \z /msx
1955 3 185 unless $arg->{'bearing'}
1957 136 49 if (defined $value) { }
1959 128 8 if $ab->{'width'}
1964 49 0 if $arg->{'width'}
1971 6594 14329 if defined $_
1980 26643 65220 unless ref $hash
1981 0 65220 unless defined $key
1984 65220 0 if ('HASH' eq $ref) { }
0 0 elsif ('ARRAY' eq $ref) { }
0 0 elsif ('CODE' eq $ref) { }
2000 2040 85 if embodies($eci, "Astro::Coord::ECI")
2018 0 82 unless embodies($thing, "Astro::Coord::ECI")
2025 0 41 if (my $equinox = $self->{'desired_equinox_dynamical'})
2037 6 14 if embodies($tle, "Astro::Coord::ECI::TLE")
2046 54 78 unless embodies($tle, "Astro::Coord::ECI::TLE") and $tle->attribute($attr)
2064 0 139 unless defined $value
2070 1 138 if $table = $self->_get($source, "bearing", "table")
2081 2 137 unless $arg->{'bearing'}
2084 0 139 if $arg->{'width'} and $arg->{'bearing'} > $arg->{'width'}
2098 5 7 unless defined $arg->{'align_left'}
2100 0 12 unless defined $value
2112 1 11 if ($days > 0) { }
2119 2 10 if "" eq $arg->{'width'}
2123 0 0 unless length $buffer <= $arg->{'width'} or $self->{'overflow'}
2125 0 10 unless $arg->{'width'} - length($buffer)
2135 0 380 unless defined $value
2138 12 368 unless &isdual($value) or not $value =~ / \D /msx
2143 367 1 if ("string" ne $arg->{'units'})
2145 1 366 if $table = $self->_get($source, "event", "table")
2160 0 5 unless defined $value
2164 1 4 unless $arg->{'width'} and $arg->{'width'} =~ / \A [0-9]+ \z /msx
2171 0 0 unless length $buffer <= $arg->{'width'} or $self->{'overflow'}
2179 0 0 unless defined $value
2188 0 813 unless defined $value and $value ne ""
2193 767 46 $arg->{'width'} && $arg->{'width'} =~ / \A [0-9]+ \z /msx ? :
2196 813 0 if defined $arg->{'places'} and $arg->{'places'} =~ / \A [0-9]+ \z /msx
2199 0 813 if "%" eq $tplt
2209 46 767 unless $width
2211 6 761 if ($width and length $buffer > $width and $width >= 7)
2218 0 0 unless length $buffer <= $width or $self->{'overflow'}
2225 0 15 unless defined $value and $value ne ""
2230 9 6 $arg->{'width'} && $arg->{'width'} =~ / \A [0-9]+ \z /msx ? :
2233 15 0 if defined $arg->{'places'} and $arg->{'places'} =~ / \A [0-9]+ \z /msx
2238 0 0 if $buffer =~ s/ e ( [-+]? ) 0 ( [0-9]{2} ) \z /e$1$2/msx and $width and $width > length $buffer
2243 6 9 unless $width
2248 0 0 unless length $buffer <= $width or $self->{'overflow'}
2256 0 5 unless defined $value
2262 1 4 if $table = $self->_get($source, "phase", "table")
2271 15 5 unless $entry->[0] > $angle
2280 0 25 unless defined $value
2288 25 0 if (defined $arg->{'places'} and $arg->{'places'} =~ / \A [0-9]+ \z /msx) { }
2291 2 23 $arg->{'places'} ? :
2297 0 25 unless defined $arg->{'align_left'}
2306 0 1613 unless defined $value
2310 224 1389 unless defined $arg->{'width'} and $arg->{'width'} =~ / \A [0-9]+ \z /msx
2313 633 756 defined $arg->{'align_left'} ? :
2314 913 476 $left ? :
2320 83 0 unless length $buffer <= $arg->{'width'} or $self->{'overflow'}
2328 0 285 unless defined $value
2334 0 285 unless defined $fmt
2345 0 0 unless defined $value
2359 0 159 if $self->{'title'} and defined $arg->{'title'}
2362 3 156 if defined $arg->{'missing'}
2367 31 125 unless defined $arg->{'width'} and $arg->{'width'} =~ / \A [0-9]+ \z /msx and $arg->{'width'}
2375 0 0 unless defined $value
2396 405 0 if defined $_
2443 1 3 unless defined $epoch
2452 105 44 if (defined $variant) { }
2454 36 49 unless $self->_get("data", $variant)
20 85 'HASH' eq ref $variant ? :