KDBX/Tie/EntryList.pm

filter: Statementstmt 61.9% 26 / 42 Branchbran 33.3% 2 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 63.6% 7 / 11 Podpod n/a totaltotal 59.3% 35 / 59 SCAR 16.4
CC
4
Cov
58%
STORE
6.0
TIEARRAY
2.0
FETCH
2.0
CRAP 5.2
« KDBX/Tie/Hash.pm ↑ Summary KDBX/Tie/GroupList.pm »
1 package File::KeePass::KDBX::Tie::EntryList;
2 # ABSTRACT: Database entry list
3  
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶use File::KDBX::Loader::KDB;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 3 ▶use parent 'Tie::Array';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 3 our $VERSION = '0.901'; # VERSION
12  
13 sub TIEARRAY {
14 171 ▶ my $class = shift;
Subroutine TIEARRAY: called CC=2 SCAR=7.0
15 171 my $self = bless [@_], $class;
16 171 ▶ splice(@$self, 1, 0, 'entries') if @$self == 2;
Branch: 1 branch
BranchTrueFalseTotal
if @$self == 2 0 171 171
17 171 return $self;
18 }
19  
20 sub FETCH {
21 48 ▶ my ($self, $index) = @_;
Subroutine FETCH: called CC=2 SCAR=7.0
22 48 my ($thing, $method, $k) = @$self;
23 48 ▶ my $entry = $thing->$method->[$index] or return;
Branch: 1 branch
BranchTrueFalseTotal
my $entry = $thing->$method->[$index] or return 0 48 48
24 48 return $k->_tie({}, 'Entry', $k->kdbx->_wrap_entry($entry));
25 }
26  
27 sub FETCHSIZE {
28 217 ▶ my ($self) = @_;
Subroutine FETCHSIZE: called CC=1 SCAR=0.0
29 217 my ($thing, $method) = @$self;
30 217 return scalar @{$thing->$method};
31 }
32  
33 sub STORE {
34 0 ▶ my ($self, $index, $value) = @_;
Subroutine STORE: not called CC=2 SCAR=17.9
35 0 ▶ return if !$value;
Branch: 1 branch
BranchTrueFalseTotal
unless $value 0 0 0
36 0 my ($thing, $method, $k) = @$self;
37 0 my $entry_info = File::KDBX::Loader::KDB::_convert_keepass_to_kdbx_entry($value);
38 0 %$value = ();
39 0 return $k->_tie($value, 'Entry', $thing->$method->[$index] = $k->kdbx->_wrap_entry($entry_info));
40 }
41  
42 sub STORESIZE {
43 0 ▶ my ($self, $count) = @_;
Subroutine STORESIZE: not called CC=1 SCAR=6.9
44 0 my ($thing, $method) = @$self;
45 0 splice @{$thing->$method}, $count;
46 }
47  
48 sub EXISTS {
49 0 ▶ my ($self, $index) = @_;
Subroutine EXISTS: not called CC=1 SCAR=6.9
50 0 my ($thing, $method) = @$self;
51 0 return exists $thing->$method->[$index];
52 }
53  
54 sub DELETE {
55 0 ▶ my ($self, $index) = @_;
Subroutine DELETE: not called CC=1 SCAR=6.9
56 0 my ($thing, $method) = @$self;
57 0 delete $thing->$method->[$index];
58 }
59  
60 3 1;
61  
62 __END__
« KDBX/Tie/Hash.pm ↑ Summary KDBX/Tie/GroupList.pm »