Branch Coverage

blib/lib/Data/Embed/Writer.pm
Criterion Covered Total %
branch 68 106 64.1


line true false branch
26 24 31 if (not defined $output && length $output or $output eq '-')
28 0 24 unless open my $fh, '>&', \*STDOUT
30 0 24 unless binmode $fh
39 9 22 unless ($oref)
45 3 6 if ($$self{'input_type'} eq 'file' and $output eq $$self{'input'})
46 0 3 unless open my $fh, '+<', $output
48 0 3 unless binmode $fh
55 0 6 unless open my $fh, '>', $output
57 0 6 unless binmode $fh
63 16 6 if ($oref eq 'SCALAR')
69 1 15 if ($$self{'input_type'} eq 'scalar-ref' and refaddr $output eq refaddr($$self{'input'}))
70 0 1 unless open my $fh, '+<', $output
72 0 1 unless binmode $fh
79 0 15 unless open my $fh, '>', $output
81 0 15 unless binmode $fh
102 23 32 unless (defined $input)
111 7 25 if ($input eq '-')
113 0 7 unless open my $fh, '<&', \*STDIN
115 0 7 unless binmode $fh
124 10 15 unless ($iref)
126 0 10 unless open my $fh, '<', $input
128 0 10 unless binmode $fh
136 8 7 if ($iref eq 'SCALAR')
138 0 8 unless open my $fh, '<', $input
140 0 8 unless binmode $fh
157 0 55 scalar @_ && ref $_[0] ? :
169 32 23 if ($$self{'input_fh'})
170 4 28 if ($$self{'output_same_as_input'}) { }
188 28 0 if (not @index) { }
0 0 elsif (not $index_completed) { }
189 0 28 if ($_ eq $starter) { }
198 0 0 if (/\A \s* (\d+) \s+ (\S*) \s*\z/msx) { }
0 0 elsif ($_ eq $terminator) { }
231 0 99 scalar @_ && ref $_[0] ? :
234 4 95 if (defined $args{'input'})
235 1 3 if ($args{'input'} eq '-') { }
236 0 1 unless open my $fh, '<&', \*STDIN
238 0 1 unless binmode $fh
244 2 1 if (not $ref or $ref eq 'SCALAR') { }
253 3 96 if (defined $args{'fh'}) { }
4 92 elsif (defined $args{'filename'}) { }
92 0 elsif (defined $args{'data'}) { }
269 0 103 unless defined $name
270 99 4 ref $filename eq 'SCALAR' ? :
276 0 103 unless open my $fh, '<', $filename
278 0 103 unless binmode $fh
298 0 108 unless defined(my $nread = read($input_fh, $buffer, 4096))
300 0 108 unless $nread
301 0 108 unless print {$output_fh;} $buffer
308 0 108 unless print {$output_fh;} "\n\n"
311 0 108 unless defined $name
321 0 55 unless print {$output_fh;} "Data::Embed/index/begin\n", @$index, "Data::Embed/index/end\n"
329 3 52 if exists $$self{'output_fh'}