Branch Coverage

blib/lib/Datafile/Array.pm
Criterion Covered Total %
branch 65 134 48.5


line true false branch
14 0 27 unless $do_trim and defined $value
27 13 18 if (substr($line, $pos, 1) eq '"') { }
32 1 13 if ($qpos == -1)
39 1 12 if ($pos < $len and substr($line, $pos, 1) eq '"') { }
51 5 13 if $spos == -1
56 19 12 if $pos < $len and substr($line, $pos, 1) eq $sep
77 3 0 if (ref $pafields eq 'ARRAY') { }
0 0 elsif (defined $pafields) { }
83 3 0 if (ref $data eq 'ARRAY') { }
0 0 elsif (ref $data eq 'HASH') { }
97 0 3 if $verbose
101 0 0 if (defined $search and ref $search || length $search)
102 0 0 ref $search eq 'ARRAY' ? :
104 0 0 unless defined $pat
105 0 0 ref $pat eq 'Regexp' ? :
110 0 3 unless open my $fh, "<:encoding(UTF-8)", $filename
114 1 2 $prefix ? :
119 0 3 if $prefix and $has_headers == 0
120 0 3 if $has_headers == 0 and @field_names
123 3 11 if $line =~ /^\s*\Q$comment\E/u
127 5 6 if ($csv) { }
128 1 4 if $csvline ne ""
132 1 4 unless $count % 2 == 0 and $count == 0 || $csvline =~ /"[^"]*$/u
141 0 10 if $skip_empty and $line eq ""
143 3 7 unless ($header_done)
144 3 0 if ($has_headers > 0) { }
145 3 0 if ($has_headers == 1 or $prefix and substr($line, 0, 1) eq "H")
147 3 0 unless (@field_names)
150 0 3 if $verbose
154 3 0 if @field_names
160 0 0 unless @field_names
166 0 7 if @fields < $start_idx + @field_names
168 0 7 if (@compiled_patterns)
171 0 0 unless $line =~ /$regex/u
172 0 0 unless $all_matched
174 0 0 unless $all_matched
183 0 7 if (ref $data eq 'HASH') { }
196 0 3 unless @field_names
200 3 0 if (defined $pafields and @field_names and not @$pafields)
202 0 3 if $verbose
205 0 3 if $verbose
223 2 0 ref $pafields eq 'ARRAY' ? :
224 0 2 unless (@field_names)
225 0 0 if (@$data) { }
226 0 0 ref $data eq 'HASH' ? :
234 0 0 if (ref $data ne "ARRAY" and ref $data ne "HASH" and not @field_names)
235 0 0 if (-f $filename)
236 0 0 unless unlink $filename
248 0 2 if $verbose
252 0 2 unless open my $fh, ">:encoding(UTF-8):crlf", $tmp
255 1 1 if (my $comment = $opts->{'comment'})
256 0 1 ref $comment eq 'ARRAY' ? :
258 0 1 if ($verbose)
261 1 1 $prefix ? :
262 1 1 $prefix ? :
264 2 0 if ($header and @field_names)
266 0 2 if $verbose
272 0 2 ref $data eq 'HASH' ? :
276 0 4 ref $data eq 'HASH' ? :
277 10 0 defined $rec->{$_} ? :
279 0 4 unless print $fh $line . "\n"
283 2 0 if $comment_char eq "#"
284 0 2 unless close $fh
287 0 2 if ($backup and -f $filename)
288 0 0 unless rename $filename, $filename . '.bak'
292 0 2 unless rename $tmp, $filename
296 0 2 if $verbose