Branch Coverage

blib/lib/File/KDBX/Key/File.pm
Criterion Covered Total %
branch 56 82 68.2


line true false branch
20 0 21 unless &Scalar::Util::blessed($_[0])
21 0 9 unless &Scalar::Util::blessed($_[0])
22 0 7 unless &Scalar::Util::blessed($_[0])
37 1 35 if (&openhandle($primitive)) { }
20 15 elsif (XXX) { }
14 1 elsif (defined $primitive and not XXX) { }
47 1 13 unless open my $fh, "<:raw", $primitive
59 6 28 if (substr($$data, 0, 120) =~ // and my($type, $version) = $self->_load_xml($data, \$raw_key)) { }
4 24 elsif (length $$data == 32) { }
2 22 elsif ($$data =~ /^[A-Fa-f0-9]{64}$/) { }
84 2 0 if defined $self->{'filepath'}
96 0 7 unless length $raw_key == 32
105 6 1 unless (&openhandle($fh))
106 0 6 unless $filepath
108 6 0 if ($atomic) { }
111 0 6 if (not $fh or my $err = $@)
119 0 0 unless open $fh, ">:raw", $filepath
123 3 4 if ($type == 4) { }
2 2 elsif ($type == 1) { }
1 1 elsif ($type == 2) { }
140 5 1 if ($filepath_temp)
143 0 0 defined $m ? :
146 5 0 if defined $mode
148 0 5 unless rename $filepath_temp, $filepath
166 12 12 if $reader->nodeType != 1
168 6 6 if ($name eq 'Version') { }
6 0 elsif ($name eq 'Data') { }
169 6 0 unless $reader->isEmptyElement
170 0 6 unless $reader->nodeType == 3
173 0 6 if defined $version
178 4 2 if $reader->hasAttributes
179 6 0 unless $reader->isEmptyElement
180 0 6 unless $reader->nodeType == 3
183 6 0 if defined $data
187 0 6 unless defined $version and defined $data
189 2 4 if ($version =~ /^1\.0/ and $data =~ m[^[A-Za-z0-9+/=]+$]) { }
4 0 elsif ($version =~ /^2\.0/ and $data =~ /^[A-Fa-f0-9]+$/ and defined $hash and $hash =~ /^[A-Fa-f0-9]+$/) { }
191 0 2 if (my $err = $@)
200 0 4 unless $hash eq substr($got_hash, 0, length $hash)
229 1 2 if (int $version == 1) { }
2 0 elsif (int $version == 2) { }