KDBX/Tie/AssociationList.pm

filter: Statementstmt 56.7% 21 / 37 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 6 / 10 Podpod n/a totaltotal 56.8% 29 / 51 SCAR 13.2
CC
3
Cov
56%
FETCH
2.0
FETCHSIZE
2.0
STORE
2.0
CRAP 3.8
« KDBX/Tie/Group.pm ↑ Summary KDBX/Tie/CustomData.pm »
1 package File::KeePass::KDBX::Tie::AssociationList;
2 # ABSTRACT: Auto-type window association 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 parent 'Tie::Array';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 3 our $VERSION = '0.901'; # VERSION
10  
11 sub TIEARRAY {
12 7 ▶ my $class = shift;
Subroutine TIEARRAY: called CC=1 SCAR=0.0
13 7 return bless [@_], $class;
14 }
15  
16 sub FETCH {
17 20 ▶ my ($self, $index) = @_;
Subroutine FETCH: called CC=2 SCAR=7.0
18 20 my ($entry, $k) = @$self;
19 20 ▶ my $association = $entry->auto_type->{associations}[$index] or return;
Branch: 1 branch
BranchTrueFalseTotal
my $association = $entry->auto_type->{"associations"}[$index] or return 0 20 20
20 20 return $k->_tie({}, 'Association', $association);
21 }
22  
23 sub FETCHSIZE {
24 15 ▶ my ($self) = @_;
Subroutine FETCHSIZE: called CC=2 SCAR=7.0
25 15 my ($entry) = @$self;
26 15 ▶ return scalar @{$entry->auto_type->{associations} || []};
Branch: 1 branch
BranchTrueFalseTotal
$entry->auto_type->{"associations"} or [] 0 15 15
27 }
28  
29 sub STORE {
30 0 ▶ my ($self, $index, $value) = @_;
Subroutine STORE: not called CC=1 SCAR=6.9
31 0 my ($entry, $k) = @$self;
32 0 my %info = %$value;
33 0 %$value = ();
34 my $association = $entry->auto_type->{associations}[$index] = {
35 window => $info{window},
36 keystroke_sequence => $info{keys},
37 0 };
38 0 return $k->_tie($value, 'Association', $association);
39 }
40  
41 sub STORESIZE {
42 0 ▶ my ($self, $count) = @_;
Subroutine STORESIZE: not called CC=1 SCAR=6.9
43 0 my ($entry) = @$self;
44 0 splice @{$entry->auto_type->{associations}}, $count;
45 }
46  
47 sub EXISTS {
48 0 ▶ my ($self, $index) = @_;
Subroutine EXISTS: not called CC=1 SCAR=6.9
49 0 my ($entry) = @$self;
50 0 return exists $entry->auto_type->{associations}[$index];
51 }
52  
53 sub DELETE {
54 0 ▶ my ($self, $index) = @_;
Subroutine DELETE: not called CC=1 SCAR=6.9
55 0 my ($entry) = @$self;
56 0 delete $entry->auto_type->{associations}[$index];
57 }
58  
59 3 1;
60  
61 __END__
« KDBX/Tie/Group.pm ↑ Summary KDBX/Tie/CustomData.pm »