Branch Coverage

blib/lib/Catmandu/BagIt.pm
Criterion Covered Total %
branch 160 202 79.2


line true false branch
169 1 22 unless $filename
172 21 11 if $_->filename eq $filename
180 1 2 unless $filename
183 1 1 if $_->filename eq $filename
217 1 118 unless $file
232 1 194 unless $file
241 1 10 unless $path
245 1 9 unless (-d $path)
267 0 9 if (wantarray) { }
268 0 0 $ok == 7 ? :
271 8 1 $ok == 7 ? :
281 1 24 unless $path
284 0 24 if ($self->locked($path))
290 1 23 if (defined $self->path and $path ne $self->path) { }
13 10 elsif (defined $self->path and $path eq $self->path) { }
4 11 elsif ($opts{'overwrite'} and -d $path) { }
310 14 10 if (-f $self->_bagit_file($path)) { }
311 13 1 if ($opts{'overwrite'}) { }
326 0 23 unless ($self->touch($self->_lock_file($path)))
342 0 23 unless $ok == 6
420 0 26 unless defined $path
428 0 24 unless defined $path
439 0 22 unless defined $filename and defined $data
444 2 20 unless ($self->_is_legal_file_name($filename))
452 7 13 if ($opts{'overwrite'})
456 1 19 if ($self->get_checksum("$filename"))
467 1 18 if (is_string($opts{'md5'}) and not $opts{'md5'} =~ /^[0-9a-f]{32}$/) { }
1 17 elsif (is_string($opts{'md5'})) { }
508 0 14 unless defined $filename
512 5 9 unless ($self->get_checksum($filename))
522 0 9 unless ($idx != -1)
544 0 4 unless defined $url and $size =~ /^[0-9]+$/ and defined $filename
547 0 4 unless $self->_is_legal_file_name($filename)
569 0 2 unless defined $filename
586 0 1 unless defined $fetch and ref $fetch and ref($fetch) =~ /^Catmandu::BagIt::Fetch/
599 1 0 if ($response->is_success) { }
615 0 188 unless defined $name and defined $values
618 178 10 if ($name =~ /^(Bag-Size|Bagging-Date|Payload-Oxum)$/)
620 100 177 if ($part->[0] eq $name)
631 0 10 if (ref $values eq 'ARRAY') { }
650 0 5 unless defined $name
653 1 4 if ($name =~ /^(Bag-Size|Bagging-Date|Payload-Oxum)$/)
680 0 447 unless $field
684 438 9 wantarray ? :
692 0 62 if ($total > 100000000000) { }
0 62 elsif ($total > 104857600) { }
2 60 elsif ($total > 102400) { }
730 0 10 unless ($self->version and $self->version =~ /^[0-9]+\.[0-9]+$/)
735 0 10 unless ($self->encoding and $self->encoding eq 'UTF-8')
743 19 4 unless (grep {(my $filename = $_->{'filename'} || '') =~ /^$file$/;} $self->list_files)
749 0 31 unless (grep {/^$file$/;} $self->list_tags)
755 19 0 unless (grep {$_->filename =~ /^$file$/;} $self->list_fetch)
761 2 8 $self->list_fetch > 0 ? :
763 9 1 if $self->errors == 0 and @missing == 0
777 0 74 unless (defined $path and -d $path)
782 43 31 $tag == 0 ? :
783 43 31 $tag == 0 ? :
787 38 36 unless ($fh)
798 2 34 unless ($md5 eq $md5_check)
808 1 10 if ($self->dirty)
817 38 5 if ($code == 0)
825 2 29 if ($code == 0)
894 8 88 if ($self->list_fetch) { }
898 4 4 unless (grep {/fetch.txt/;} $self->list_tags)
914 27 5 unless -f $self->_fetch_file($path)
937 1 31 unless (-f $self->_tagmanifest_md5_file($path))
960 1 31 unless (-f $self->_manifest_md5_file($path))
991 31 98 if $file =~ /^tagmanifest-\w+.txt$/
1006 3 29 unless (-d "$path/data")
1033 31 1 -f $self->_bag_info_file($path) ? :
1037 1 31 unless (-f $info_file)
1047 12 115 if ($line =~ /^\s+/)
1066 1 31 unless (-f $self->_bagit_file($path))
1077 31 31 if ($n eq 'BagIt-Version') { }
31 0 elsif ($n eq 'Tag-File-Character-Encoding') { }
1091 13 10 unless $self->dirty & 1
1117 0 23 unless $self->dirty & 2
1139 427 427 $cnt == 0 ? :
1140 427 0 $cnt == 0 ? :
1154 1 22 unless $self->dirty & 8
1159 10 12 unless (-d "$path/data")
1160 0 10 unless (mkdir "$path/data")
1177 10 14 unless $item->flag & 100
1184 0 14 unless -d "$path/$dir"
1189 14 0 if ($item->is_new) { }
1208 4 24 unless (grep {$filename eq $_;} @all_names_in_bag)
1222 0 23 unless $self->dirty & 4
1226 20 3 unless (defined $fetch_str and length $fetch_str)
1228 1 19 if -f $self->_fetch_file($path)
1234 0 3 if ($self->_fetch == 0)
1235 0 0 if -r $self->_fetch_file($path)
1262 0 23 unless $self->dirty & 50
1277 52 67 unless defined $path
1282 12 75 unless -f $self->_payload_file($path, $file)
1293 0 23 unless $self->dirty & 22
1325 52 297 if (not defined $data) { }
244 53 elsif (not ref $data) { }
0 53 elsif (ref $data eq 'SCALAR') { }
53 0 elsif (ref($data) =~ /^IO/) { }
1345 2 24 unless $filename =~ /^[[:alnum:]._%-]+$/
1346 0 24 if $filename =~ m[(^\.|\/\.+\/)]