Branch Coverage

blib/lib/Net/BitTorrent/Torrent/File.pm
Criterion Covered Total %
branch 77 132 58.3


line true false branch
20 2 138 if (not $args or ref $args ne 'HASH')
25 1 137 unless ($$args{'Path'})
30 0 135 unless ($$args{'Torrent'} and blessed($$args{'Torrent'}) and $$args{'Torrent'}->isa('Net::BitTorrent::Torrent'))
37 4 131 unless (defined $$args{'Size'} and $$args{'Size'} =~ /^\d+$/)
42 5 126 unless (defined $$args{'Index'} and $$args{'Index'} =~ /^\d+$/)
63 1 11 unless (defined $newval)
68 2 9 unless ($newval =~ /^\d+$/)
99 0 0 $return > 100 ? :
105 2 327 unless ($mode and $mode =~ /^[rw]$/)
110 36 291 if (defined $handle{refaddr $self} and defined $mode{refaddr $self})
111 25 11 if ($mode{refaddr $self} eq $mode)
114 9 2 if ($mode{refaddr $self} eq 'w')
115 0 9 unless flock $handle{refaddr $self}, 8
120 291 11 $mode eq 'r' ? :
121 291 11 $mode eq 'r' ? :
274 28 unless ($self->_sysopen($mode eq 'r' ? 0 : 1))
122 0 0 $mode eq 'r' ? :
0 274 if $mode eq 'w'
133 17 11 $mode{refaddr $self} eq 'r' ? :
0 28 unless (flock $handle{refaddr $self}, $mode{refaddr $self} eq 'r' ? 1 : 2)
137 0 0 $mode eq 'r' ? :
145 0 0 $mode eq 'r' ? :
160 1 12 unless (defined $data)
161 2 10 if (not $handle{refaddr $self}) { }
1 9 elsif ($mode{refaddr $self} ne 'w') { }
2 7 elsif ($self->_systell + length($data) > $size{refaddr $self}) { }
218 7 0 if -s $handle{refaddr $self} != $size{refaddr $self}
223 7 0 if (defined $actual_length) { }
224 0 7 if ($actual_length != $expected_length)
268 2 39 unless (defined $length and $length =~ /^\d+$/)
274 1 38 if (not $handle{refaddr $self}) { }
1 37 elsif ($mode{refaddr $self} ne 'r') { }
1 36 elsif ($self->_systell + $length > $size{refaddr $self}) { }
315 0 36 if -s $handle{refaddr $self} != $size{refaddr $self}
318 0 36 if ($real_length != $length)
344 2 110 unless ($handle{refaddr $self})
363 0 50 defined $wence ? :
364 1 49 if (not defined $handle{refaddr $self}) { }
1 48 elsif (not defined $position) { }
0 48 elsif ($position < 0 and $wence == 0 or $position + $self->_systell < 0 and $wence == 1 or $position > 0 and $wence == 2) { }
3 45 elsif (abs $position > $size{refaddr $self}) { }
416 3 0 $position > 0 ? :
427 3 0 $position > 0 ? :
443 11 291 if $mode &= 1
444 0 0 if ($^O eq 'MSWin32' and utf8::is_utf8($path{refaddr $self}) and require Win32API::File and require Encode)
453 0 0 ($mode &= 1) ? :
0 0 ($mode &= 1) ? :
0 0 if $win32_handle{refaddr $self} = CreateFileW(encode('UTF-16LE', $path{refaddr $self} . $null), ($mode &= 1) ? GENERIC_WRITE() : GENERIC_READ(), FILE_SHARE_READ(), [], ($mode &= 1) ? OPEN_ALWAYS() : OPEN_EXISTING(), FILE_ATTRIBUTE_NORMAL(), 0)
470 0 0 unless $win32_handle{refaddr $self}
472 0 0 if $fd < 0
474 0 0 ($mode &= 1) ? :
483 11 291 ($mode &= 1) ? :
494 52 27 unless defined $mode{refaddr $self}
495 0 27 if (defined $win32_handle{refaddr $self} and require Win32API::File)
500 27 0 if ($return)
518 19 297 unless (-d 'File::Spec'->catpath($vol, $dir, ''))
519 0 19 if ($^O eq 'MSWin32' and utf8::is_utf8($path{refaddr $self}) and require Win32 and require Win32API::File and require Encode) { }
19 0 elsif (require File::Path) { }
529 0 0 unless length $this_dir
532 0 0 if -d $path
568 0 0 $mode{refaddr $self} eq 'rw' ? :
0 0 $mode{refaddr $self} eq 'wo' ? :
0 0 $mode{refaddr $self} eq 'ro' ? :
0 0 !$mode{refaddr $self} ? :
0 0 !$advanced ? :
569 0 0 defined wantarray ? :