Branch Coverage

blib/lib/Archive/BagIt.pm
Criterion Covered Total %
branch 156 204 76.4


line true false branch
32 83 1 unless (defined $self->use_plugins)
194 540 0 if (-f $filename) { }
195 0 540 unless open my $fh, "<:raw", $filename
198 0 540 unless close $fh
215 105 0 if (defined $searchkey)
218 0 344 unless defined $entry
220 61 283 if (__case_aware_compare_for_baginfo($key, $searchkey, $lc_flag))
225 60 45 if scalar @values > 0
277 61 0 if (defined $searchkey)
278 1 60 if (index($searchkey, ":") != -1)
285 16 109 if (__case_aware_compare_for_baginfo($key, $searchkey, $lc_flag))
305 0 396 if ($res ne "")
324 140 58 if ($self->is_baginfo_key_reserved($key)) { }
332 0 197 if ($self->is_baginfo_key_reserved_as_uniq($key) and $keys{$key} > 1)
348 3 47 if (not defined $info) { }
349 0 3 if (exists $self->{'bag_info_file'})
356 3 44 if (not defined $loaded_payloadoxum) { }
360 5 39 if ("$octets.$streamcount" ne $loaded_payloadoxum)
373 8 50 if (&List::Util::any(sub { /the baginfo file .* could not be parsed correctly/; } , @{$$self{"errors"};}))
385 2 1 if (defined $idx)
404 13 42 if (defined $idx)
415 1 396 unless (defined $key)
418 1 395 if ($key =~ /[\r\n]/s)
421 2 393 if ($key =~ /:/)
424 1 392 if ($key =~ /^$/)
435 194 1 if ($res eq "")
443 1 263 unless (defined $value)
444 1 262 if ($value =~ /^$/s)
453 64 0 if ($res eq "")
461 60 0 if (_check_key_or_croak($searchkey) and defined $newvalue)
465 0 60 if (index($searchkey, ":") != -1)
466 44 16 if ($self->is_baginfo_key_reserved_as_uniq($searchkey))
467 5 39 if (defined $self->get_baginfo_values_by_key($searchkey))
482 70 0 if (_check_key_or_croak($searchkey))
483 0 70 if (index($searchkey, ":") != -1)
484 53 17 if (defined $self->{'bag_info'})
486 12 41 if (defined $idx)
614 35 3 if (-f $manifest_file)
626 35 3 if (-f $tagmanifest_file)
637 4 356 unless ($local_entry =~ /^[a-zA-Z0-9._-]+$/)
639 2 2 unless ($self->has_force_utf8)
661 88 2 if (defined $excludedir)
675 34 326 if (defined $excludedir and $path_entry eq $excludedir) { }
308 18 elsif (-f $path_entry) { }
18 0 elsif (-d $path_entry) { }
702 0 121 $reldir eq '' ? :
704 0 54 wantarray ? :
712 1 108 unless open my $BAGIT, "<:encoding(UTF-8)", $file
716 108 0 if (defined $version_string)
719 106 2 if (defined $encoding_string)
728 0 56 unless defined $version_string
729 53 3 if ($version_string =~ /^BagIt-Version: ([01]\.[0-9]+)$/) { }
741 1 51 unless defined $encoding_string
742 0 51 unless $encoding_string ne "UTF-8"
753 10 1 if ($kres != 0) { }
765 1 931 unless (defined $textblob)
772 927 4 if ($textblob =~ s/\A($rx_word)$rx_spc*:[\t ]*//m) { }
774 1 926 if ($textblob eq "")
787 1 925 unless (defined $textblob)
791 1 924 if ($textblob eq "")
808 6 918 if ($textblob =~ s/\A($rx_word_spc_word([\r\n]$rx_spc$rx_word_spc_word)+)[\r\n]*//ms) { }
913 5 elsif ($textblob =~ s/\A($rx_word_spc_word)[\r\n]*//s) { }
845 1 763 unless defined $textblob
847 755 920 if $textblob eq ""
850 3 917 unless defined $key
851 0 917 unless defined $textblob
853 5 912 unless defined $value
854 912 0 if (defined $key)
869 44 15 if (-e $file)
870 0 44 unless open my $BAGINFO, "<:encoding(UTF-8)", $file
890 161 0 $reldir eq '' ? :
892 0 33 wantarray ? :
897 0 44 if ($self->use_plugins) { }
900 28 16 if ($self->bag_version >= 1.0) { }
915 83 168 if (defined $loaded_plugins)
918 0 251 if @plugins == 0
919 251 0 if (exists $ENV{'TEST_ACTIVE'})
923 245 6 if ($dirs[-1] eq "t")
928 0 334 unless load_class($plugin)
968 7 44 if (-f $fetch_file)
972 44 0 if ($self->has_forced_fixity_algorithm)
975 1 43 unless -f $manifest_file
977 0 43 unless -d $payload_dir
979 0 43 unless ($version > "0.95")
989 0 63 if (defined $res and $res ne 1)
994 0 49 if (defined $res and $res ne 1)
999 8 16 if (scalar @err > 0)
1013 189 0 if (-e $file) { }
1015 2 187 unless $filesize = -s $file
1026 17 0 if ($octets < 1024) { }
0 0 elsif ($octets < 1048576) { }
0 0 elsif ($octets < 1073741824) { }
0 0 elsif ($octets < 1099511627776) { }
1038 0 17 unless open my $BAGIT, ">:encoding(UTF-8)", $bagit_path
1055 1 16 if (exists $self->{'errors'} and scalar @{$self->{'errors'};} > 0)
1061 0 16 unless open my $BAGINFO, ">:encoding(UTF-8)", $bag_info_path
1067 0 64 if (index($key, ":") != -1)
1097 0 17 unless (-d $bag_path)
1099 2 15 unless -d $self->payload_path
1100 2 15 unless (-d $self->payload_path)
1105 0 17 unless (-d $self->metadata_path)
1117 0 17 if ($isa eq "Archive::BagIt")