KDBX/Tie/Protected.pm

filter: Statementstmt 73.9% 34 / 46 Branchbran 55.0% 11 / 20 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 11 / 22 Podpod 0.0% 0 / 5 totaltotal 60.2% 56 / 93 SCAR 27.0
CC
11
Cov
68%
__ANON__
6.0
__ANON__
6.0
__ANON__
6.0
CRAP 14.9
« KDBX/Tie/Header.pm ↑ Summary KDBX/Tie/Hash.pm »
1 package File::KeePass::KDBX::Tie::Protected;
2 # ABSTRACT: Entry memory protection flags
3  
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 ▶use boolean;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 ▶use parent 'File::KeePass::KDBX::Tie::Hash';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 2 our $VERSION = '0.901'; # VERSION
13  
14 my %GET = (
15 0 ▶ comment => sub { $_[0]->string('Notes') ->{protect} ? 1 : 0 },
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->string('Notes')->{'protect'} ? : 0 0 0
16 2 ▶ password => sub { $_[0]->string('Password') ->{protect} ? 1 : 0 },
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->string('Password')->{'protect'} ? : 2 0 2
17 0 ▶ title => sub { $_[0]->string('Title') ->{protect} ? 1 : 0 },
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->string('Title')->{'protect'} ? : 0 0 0
18 0 ▶ url => sub { $_[0]->string('URL') ->{protect} ? 1 : 0 },
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->string('URL')->{'protect'} ? : 0 0 0
19 2 ▶ username => sub { $_[0]->string('UserName') ->{protect} ? 1 : 0 },
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->string('UserName')->{'protect'} ? : 2 0 2
20 2 );
21 my %SET = (
22 0 ▶ comment => sub { $_[0]->string('Notes') ->{protect} = boolean($_) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
23 0 ▶ password => sub { $_[0]->string('Password') ->{protect} = boolean($_) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
24 0 ▶ title => sub { $_[0]->string('Title') ->{protect} = boolean($_) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
25 0 ▶ url => sub { $_[0]->string('URL') ->{protect} = boolean($_) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
26 0 ▶ username => sub { $_[0]->string('UserName') ->{protect} = boolean($_) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
27 2 );
28  
29 6 ▶sub getters { \%GET }
Subroutine getters: called CC=1 SCAR=0.0
Pod undocumented
30 0 ▶sub setters { \%SET }
Subroutine setters: not called CC=1 SCAR=6.9
Pod undocumented
31 2 ▶sub default_getter { my $key = $_[1]; sub { $_[0]->string($key)->{protect} ? 1 : 0 } }
Subroutine __ANON__: called CC=2 SCAR=7.1
Subroutine default_getter: called CC=1 SCAR=0.1
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->string($key)->{'protect'} ? : 2 0 2
32 0 ▶sub default_setter { my $key = $_[1]; sub { $_[0]->string($key)->{protect} = boolean($_) } }
Subroutine __ANON__: not called CC=1 SCAR=6.9
Subroutine default_setter: not called CC=1 SCAR=6.9
Pod undocumented
33  
34 sub keys {
35 22 ▶ my $self = shift;
Subroutine keys: called CC=5 SCAR=16.1
Pod undocumented
36 22 my ($entry) = @$self;
37 22 my @keys;
38 22 ▶ while (my ($key, $string) = each %{$entry->strings}) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %{$entry->strings;}) 154 22 176
39 154 ▶ $key = 'comment' if $key eq 'Notes';
Branch: 1 branch
BranchTrueFalseTotal
if $key eq "Notes" 22 132 154
40 154 ▶ $key = lc($key) if $key =~ /^(?:Password|Title|URL|UserName)$/;
Branch: 1 branch
BranchTrueFalseTotal
if $key =~ /^(?:Password|Title|URL|UserName)$/ 88 66 154
41 154 ▶ push @keys, $key if $string->{protect};
Branch: 1 branch
BranchTrueFalseTotal
if $string->{"protect"} 66 88 154
42 }
43 22 return \@keys;
44 }
45  
46 2 1;
47  
48 __END__
« KDBX/Tie/Header.pm ↑ Summary KDBX/Tie/Hash.pm »