Branch Coverage

blib/lib/Data/SeaBASS.pm
Criterion Covered Total %
branch 471 592 79.5


line true false branch
535 4 137 if (ref $file eq 'HASH') { }
127 10 elsif (ref $_[0] eq 'HASH') { }
10 0 elsif (not ref $_[0]) { }
541 9 1 if ($#_ % 2 == 1) { }
553 0 136 if (ref $file eq 'GLOB') { }
130 6 elsif (ref $file eq 'SCALAR') { }
2 4 elsif ($file) { }
559 1 1 if (not ref $file) { }
560 1 0 if (-r $file) { }
0 0 elsif ($self->{'options'}{'strict'} & STRICT_READ()) { }
573 131 4 if ($file) { }
574 0 127 unless ($self->read_headers)
575 0 0 unless ($self->{'options'}{'strict'} & STRICT_READ())
610 265 141 if (ref $_[0] eq 'HASH') { }
140 1 elsif (ref $_[0] eq 'ARRAY') { }
1 0 elsif (not ref $_[0]) { }
617 11 2583 if ($_ =~ /^\s*!/) { }
2 2581 elsif ($strict and not $_ =~ m[^/]) { }
630 0 1 if ($_ =~ /^\s*!/) { }
0 1 elsif ($strict and not $_ =~ m[^/]) { }
684 21 4 if (not @_) { }
1 3 elsif (ref $_[0] eq 'HASH') { }
1 2 elsif (ref $_[0] eq 'ARRAY') { }
693 1 0 if (wantarray) { }
701 4 0 if (not ref $_) { }
703 4 0 defined $value ? :
708 1 1 if (wantarray) { }
0 1 elsif ($#ret == 0) { }
766 81 52 if (defined $index) { }
767 12 69 if ($index < 0)
771 63 6 if ($self->{'options'}{'cache'}) { }
772 39 24 if ($index > $self->{'max_dataidx'})
775 4 69 unless ($self->next)
783 0 59 if (wantarray) { }
789 3 3 if ($index <= $self->{'dataidx'})
794 0 7 unless ($self->next)
801 45 7 if ($self->{'options'}{'cache'}) { }
805 7 38 if (wantarray) { }
816 6 1 if (wantarray) { }
852 0 429 if (@_)
856 73 356 if ($self->{'options'}{'cache'} and $self->{'dataidx'} < $self->{'max_dataidx'}) { }
344 12 elsif ($self->{'handle'}) { }
859 0 73 if (wantarray) { }
871 266 0 if ($line)
874 204 62 if ($self->{'options'}{'cache'})
878 238 28 if ($self->{'dataidx'} > $self->{'max_dataidx'})
881 0 266 if (wantarray) { }
904 31 30 if ($self->{'dataidx'} != -1)
905 9 22 unless ($self->{'options'}{'cache'})
942 1 11 if (not $self->{'options'}{'cache'}) { }
1 10 elsif ($self->{'dataidx'} == -1) { }
948 2 8 unless (defined $new_row)
974 0 3 unless ($self->{'options'}{'cache'})
977 1 2 if ($index < 0)
981 0 2 unless (defined $new_row)
985 2 0 if ($index > $self->{'max_dataidx'})
990 1 1 if ($index > $self->{'max_dataidx'})
1032 0 16 unless ($self->{'options'}{'cache'})
1035 1 15 if ($index < INSERT_END())
1039 0 15 unless (defined $new_row)
1043 10 5 if ($index == INSERT_END()) { }
2 3 elsif ($index > $self->{'max_dataidx'}) { }
1052 0 2 if ($index == $self->{'max_dataidx'} + 1) { }
1 1 elsif ($index > $self->{'max_dataidx'}) { }
1059 3 11 if ($index <= $self->{'dataidx'} and $index != INSERT_END())
1065 2 12 if ($index == INSERT_BEGINNING()) { }
10 2 elsif ($index == INSERT_END()) { }
1106 1 5 if (not $self->{'options'}{'cache'}) { }
0 8 elsif (not defined $index and $self->{'dataidx'} < 0) { }
1112 2 3 unless (defined $index)
1116 0 5 if ($index < 0) { }
2 3 elsif ($index > $self->{'max_dataidx'}) { }
1123 1 1 if ($index > $self->{'max_dataidx'})
1128 3 1 if ($index <= $self->{'dataidx'})
1181 1 6 if (ref $function ne 'CODE')
1192 12 7 if (defined $ret and defined wantarray)
1195 2 17 unless (defined $row)
1196 1 1 if ($self->{'dataidx'} <= $currentidx)
1231 5 8 if (ref $_[$#_] eq 'HASH')
1234 0 13 unless (@_)
1238 3 10 $self->{'options'}{'missing_data_to_undef'} ? :
1246 4 17 if (&firstidx(sub { $_ eq $field; } , @{$$self{'actual_fields'};}) < 0)
1247 3 1 if (not $self->{'options'}{'fill_ancillary_data'} or &firstidx(sub { $_ eq $field; } , keys %{$$self{'ancillary'};}) < 0)
1256 20 20 if ($options{'delete_missing'})
1259 4 32 unless (defined $row->{$field} and !defined($missing) || $row->{$field} != $missing)
1264 4 16 unless ($has_all)
1276 3 7 if ($#_ == 0) { }
4 3 elsif (wantarray) { }
1277 1 2 if (wantarray) { }
1299 1 7 unless (@_)
1307 1 8 if ($field_idx < 0) { }
1331 0 25 if (not $self->{'options'}{'cache'}) { }
1 24 elsif (not $field) { }
1339 3 21 if ($field_idx >= 0)
1342 15 6 unless (defined $position)
1348 17 4 if ($position == INSERT_END()) { }
2 2 elsif ($position == INSERT_BEGINNING()) { }
1381 0 10 if ($#_ < 0)
1389 13 0 if (defined $find)
1390 7 6 if (not ref $find) { }
6 0 elsif (ref $find eq 'Regexp') { }
1399 23 69 if ($field =~ /$regex/)
1407 7 3 if ($#_ == 0) { }
1410 2 1 if (wantarray) { }
1430 1 2 if ($c =~ /^!/) { }
1448 2 4 if (@_) { }
1453 0 6 if (wantarray) { }
1473 1 1 if ($c =~ /^!/) { }
1501 1 14 $self->{'options'}{'keep_slashes'} ? :
1504 3 12 if ($strict_write)
1507 0 65 if (&firstidx(sub { $_ eq $header_no_slash; } , @ALL_HEADERS) < 0 and &firstidx(sub { $_ eq $header_no_slash; } , @HIDDEN_HEADERS) < 0)
1514 20 46 unless (exists $self->{'headers'}{$header})
1521 14 1 if (not $error) { }
1525 0 14 if (not $write_to_h and exists $self->{'default_write_to'})
1529 0 14 if (defined $write_to_h)
1530 0 0 if (ref $write_to_h eq 'GLOB') { }
0 0 elsif (not ref $write_to_h) { }
1535 0 0 unless open $write_to_h, '>', $write_to
1545 2 12 if ($actual_delim eq 'comma') { }
12 0 elsif ($actual_delim eq 'space') { }
0 0 elsif ($actual_delim eq 'tab') { }
0 0 elsif ($actual_delim eq 'semicolon') { }
1558 14 0 exists $self->{'missing'} ? :
1559 14 0 exists $self->{'below_detection_limit'} ? :
1560 14 0 exists $self->{'above_detection_limit'} ? :
1562 1 13 if ($self->{'options'}{'preserve_header'}) { }
1565 3 10 unless (exists $self->{'headers'}{"${slash}begin_header"})
1570 1 12 if ($add_missing_headers and $add_missing_headers eq '1')
1573 1 12 unless ($self->{'options'}{'preserve_case'})
1580 12 1 if ($missing eq $adl or $self->{'options'}{'missing_data_to_undef'} and not $self->{'options'}{'preserve_detection_limits'})
1583 12 1 if ($missing eq $bdl or $self->{'options'}{'missing_data_to_undef'} and not $self->{'options'}{'preserve_detection_limits'})
1587 6 7 unless (grep(($_ ne 'unitless'), @{$$self{'actual_units'};}))
1592 13 399 if ($header eq 'missing') { }
13 386 elsif ($header eq 'fields') { }
7 379 elsif ($header eq 'units') { }
111 268 elsif (exists $self->{'headers'}{"$slash$header"}) { }
0 268 elsif ($add_missing_headers) { }
1595 0 153 if (&firstidx(sub { $_ eq $header_no_slash; } , @ALL_HEADERS) < 0)
1603 1 12 if (not @{$self->{'comments'};} and $add_missing_headers)
1606 3 10 if (not exists $self->{'headers'}{"$slash$header"}) { }
1616 20 91 if ($header =~ /_header/) { }
65 26 elsif (length $self->{'headers'}{"$slash$header"}) { }
26 0 elsif ($add_missing_headers) { }
1620 8 57 if ($header =~ /_latitude|_longitude/) { }
4 53 elsif ($header =~ /_time/) { }
1629 1 25 if $OMIT_EMPTY_HEADERS{$header}
1632 4 21 if ($header =~ /_latitude|_longitude/) { }
2 19 elsif ($header =~ /_time/) { }
1641 0 0 if $OMIT_EMPTY_HEADERS{$header}
1644 0 0 if ($header =~ /_latitude|_longitude/) { }
0 0 elsif ($header =~ /_time/) { }
1654 3 10 unless (exists $self->{'headers'}{"${slash}end_header"})
1664 102 16 defined $row->{$field} ? :
1670 0 14 if ($close_write_to)
1689 131 10 if ($self->{'handle'}) { }
1722 0 31 unless ($self->{'delim'} or $self->guess_delim($line))
1729 0 266 if ($num_expected != $num_got)
1737 958 911 if ($self->{'options'}{'missing_data_to_undef'}) { }
1738 68 890 if ($self->{'missing_is_number'} and &looks_like_number($v) and $v == $self->{'missing'}) { }
1 889 elsif (not $self->{'options'}{'preserve_detection_limits'} and $self->{'adl_is_number'} and &looks_like_number($v) and $v == $self->{'above_detection_limit'}) { }
1 888 elsif (not $self->{'options'}{'preserve_detection_limits'} and $self->{'bdl_is_number'} and &looks_like_number($v) and $v == $self->{'below_detection_limit'}) { }
8 880 elsif ($v eq $self->{'missing'} or not $self->{'options'}{'preserve_detection_limits'} and $v eq $self->{'below_detection_limit'} || $v eq $self->{'above_detection_limit'}) { }
1754 0 266 if (wantarray) { }
1813 0 130 unless (ref $self)
1818 130 0 if ($name)
1821 1 129 unless (defined $value)
1824 125 4 if (ref $value eq 'ARRAY' and wantarray) { }
0 8 elsif (ref $value eq 'HASH' and wantarray) { }
1855 2 1939 if (not exists $DEFAULT_OPTIONS{$k}) { }
2 1937 elsif (&firstidx(sub { $_ eq ref $v; } , @{$OPTION_TYPES{$k};}) < 0) { }
1859 1 1 $expected_ref ? :
1862 1 135 if ($self->{'options'}{'add_empty_headers'})
1905 1 3 $self->{'options'}{'keep_slashes'} ? :
1906 1 3 if ($self->{'options'}{'add_empty_headers'})
1908 34 0 unless (exists $self->{'headers'}{"$slash$_"})
1910 1 33 if ($_ eq 'missing')
1918 4 0 if ($self->{'options'}{'default_headers'})
1921 4 0 if ($self->{'options'}{'headers'})
1924 0 4 unless ($success)
1941 0 131 if ($self->{'headers'})
1945 7 124 $self->{'options'}{'keep_slashes'} ? :
1952 131 0 if ($self->{'options'}{'default_headers'})
1965 3287 0 if ($line)
1966 116 3171 if ($line =~ m[^(/end_header)\@?$]i) { }
2460 711 elsif ($line =~ m[^/]) { }
696 15 elsif ($line =~ /^!/) { }
1974 10 686 if ($self->{'options'}{'preserve_header'})
1979 0 15 if ($strict & STRICT_READ())
1989 5 126 if ($strict & STRICT_READ()) { }
1995 1 130 if ($self->{'options'}{'preserve_header'})
2004 131 0 if ($self->{'options'}{'headers'})
2010 130 1 if ($self->{'options'}{'preserve_comments'})
2015 1 130 if ($self->{'options'}{'delete_missing_headers'})
2017 3 28 if ($k =~ m[/?(?:end|begin)_header$|^/?missing$])
2020 7 21 if (not defined $v or $v =~ m(^n/?a(?:\[.*?\])?$)i or lc $v eq lc $missing)
2026 5 126 if ($strict & STRICT_READ())
2028 58 52 unless (exists $headers{"$slash$_"})
2034 0 72 if ($slash)
2037 0 72 if (&firstidx(sub { $_ eq $header; } , @ALL_HEADERS) < 0 and &firstidx(sub { $_ eq $header; } , @HIDDEN_HEADERS) < 0)
2042 0 5 if ($headers{"${slash}begin_header"} or $headers{"${slash}end_header"})
2048 1 130 unless (exists $headers{"$slash$_"})
2050 1 0 if ($strict & STRICT_READ())
2059 79 52 if ($headers{"${slash}units"}) { }
2073 1 130 if (@{$self->{'fields'};} != @{$self->{'units'};})
2074 1 0 if ($strict & STRICT_READ()) { }
2087 4 127 unless ($success)
2088 4 0 if ($strict & STRICT_READ()) { }
2102 117 10 if ($self->{'options'}{'cache'})
2110 16 111 if ($self->{'options'}{'fill_ancillary_data'})
2124 77 66 if ($idx >= 0)
2128 29 114 if (ref $value) { }
2148 145 6 if ($idx >= 0)
2157 0 143 if ($field ne $new_field)
2167 1 125 if ($self->{'options'}{'optional_warnings'} and $headers{"${slash}optical_depth_warning"} and $headers{"${slash}optical_depth_warning"} =~ /true/)
2199 207 2383 if (not defined $v) { }
2209 0 2590 if (length $v == 0 and not $k =~ /_header/)
2210 0 0 if ($strict) { }
2218 1311 1279 if (not $self->{'options'}{'preserve_case'} or $k =~ /fields|units/)
2222 139 2451 if ($self->{'options'}{'keep_slashes'}) { }
2223 2 137 if ($k =~ m[^[^/]])
2227 0 6 if ($strict and &firstidx(sub { "/$_" eq $k; } , @ALL_HEADERS) < 0 and &firstidx(sub { "/$_" eq $k; } , @HIDDEN_HEADERS) < 0)
2232 2449 2 if ($k =~ m[^/])
2236 0 80 if ($strict and &firstidx(sub { $_ eq $k; } , @ALL_HEADERS) < 0 and &firstidx(sub { $_ eq $k; } , @HIDDEN_HEADERS) < 0)
2242 308 2282 if ($k =~ /_latitude|_longitude/) { }
158 2124 elsif ($k =~ /_time/) { }
93 2031 elsif ($k =~ m[^/?delimiter$]) { }
114 1917 elsif ($k =~ m[^/?missing$]) { }
7 1910 elsif ($k =~ m[^/?above_detection_limit]) { }
7 1903 elsif ($k =~ m[^/?below_detection_limit]) { }
2247 1 92 unless ($self->set_delim($strict, $v))
2248 0 1 if ($strict)
2253 114 0 length $v ? :
2256 7 0 length $v ? :
2259 7 0 length $v ? :
2280 0 93 if ($delim eq 'comma') { }
0 93 elsif ($delim eq 'semicolon') { }
91 2 elsif ($delim eq 'space') { }
0 2 elsif ($delim eq 'tab') { }
1 1 elsif ($strict) { }
2291 0 1 $self->{'options'}{'keep_slashes'} ? :
2296 92 1 $delim ? :
2309 4 24 if ($self->{'options'}{'cache'} and $self->{'max_dataidx'} >= 0)
2315 2 26 $self->{'options'}{'keep_slashes'} ? :
2337 21 1895 if (&firstidx(sub { $_ eq $field; } , @{$$self{'actual_fields'};}) < 0)
2338 21 0 unless ($self->{'options'}{'fill_ancillary_data'} and &firstidx(sub { $_ eq $field; } , keys %{$$self{'ancillary'};}) >= 0)
2344 140 137 $self->{'options'}{'missing_data_to_undef'} ? :
2347 57 0 if (defined $hash->{$case_var} and !defined($missing) || $hash->{$case_var} != $missing)
2352 19 258 if (defined $self->{'ancillary'})
2355 173 74 if (defined $self->{'ancillary'}{$variable})
2357 173 0 if (defined $value)
2365 61 1911 unless (exists $hash->{$field})
2385 2 33 if ($line =~ /,/) { }
0 33 elsif ($line =~ /\t/) { }
33 0 elsif ($line =~ /\s+/) { }
0 0 elsif ($line =~ /;/) { }
2405 1 34 $self->{'options'}{'keep_slashes'} ? :
2432 1 26 if ($#_ < 0)
2437 14 12 if (ref $_[0] eq 'HASH') { }
3 9 elsif (ref $_[0] eq 'ARRAY') { }
9 0 elsif (not ref $_[0]) { }
2442 7 2 if ($#_ == 0) { }
1 1 elsif ($#_ % 2 == 1) { }
2443 0 4 unless ($self->{'delim'} or $self->guess_delim($_[0]))
2458 10 15 if ($arrayref)
2460 8 2 if (scalar @{$self->{'actual_fields'};} == scalar @{$arrayref;}) { }
2 0 elsif (scalar @{$self->{'fields'};} == scalar @{$arrayref;}) { }
2468 0 0 if ($actual_fields == $fields) { }
2482 0 25 if (wantarray) { }
2520 99 307 if ($self->{'ancillary'}{$field})
2524 77 230 if ($idx >= 0)
2529 0 230 $self->{'options'}{'keep_slashes'} ? :
2530 12 218 unless $ANCILLARY{$field}
2531 284 132 if (ref $attempt eq 'HASH') { }
89 43 elsif (ref $attempt eq 'ARRAY') { }
43 0 elsif (not ref $attempt) { }
2534 122 162 if ($where =~ /^\$/) { }
12 150 elsif (defined $self->{'headers'}{"$slash$where"} and $self->{'headers'}{"$slash$where"} =~ /$regex/ and lc $1 ne 'na') { }
2535 15 107 if (&firstidx(sub { "\$$_" eq $where; } , $self->fields) >= 0)
2548 41 48 if (ref $attempt[0] eq 'Regexp')
2558 40 75 if ($success) { }
2559 0 40 if (ref $self->{'ancillary'}{$variable}) { }
2572 14 75 if ($success)
2573 8 6 if ($regex)
2585 65 18 if ($success) { }
2586 6 59 if (ref $self->{'ancillary'}{$variable}) { }
2597 25 18 if ($success)
2622 47 173 if (ref $expression) { }
2629 123 98 if ($self->{'ancillary_tmp'}{$variable}) { }
98 0 elsif (defined $row->{$variable} and !defined($missing) || $row->{$variable} != $missing) { }
0 0 elsif (ref $self->{'ancillary'}{$variable}) { }
2636 0 0 unless (defined $value)
2665 41 6 if (ref $args[0] eq 'Regexp')
2670 0 47 unless (defined $_)
2675 41 6 if ($regex)
2676 41 0 if ($value =~ /$regex/)
2722 14 0 if ($yyyyjjj =~ /^(\d{4})(\d{3})$/)