lib/Rex/Shared/Var/Hash.pm

filter: Statementstmt 88.6% 47 / 53 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 88.2% 15 / 17 Podpod n/a totaltotal 88.5% 62 / 70 CC 1 SCAR 1.1
CC
1
Cov
89%
DELETE
2.0
__ANON__
2.0
BEGIN
1.0
CRAP 1.1
« lib/Rex/Commands/Virtualization.pm ↑ Summary lib/Rex/Interface/File.pm »
1 #
2 # (c) Jan Gehring <jan.gehring@gmail.com>
3 #
4  
5 package Rex::Shared::Var::Hash;
6  
7 20 ▶use v5.14.4;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 20 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 20 ▶use Rex::Shared::Var::Common qw/__lock __store __retrieve/;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 20 our $VERSION = '1.16.1'; # VERSION
13  
14 43 ▶sub TIEHASH {
Subroutine TIEHASH: called CC=1 SCAR=0.0
15 43 my $self = { varname => $_[1], };
16 43 bless $self, $_[0];
17 }
18  
19 45 ▶sub STORE {
Subroutine STORE: called CC=1 SCAR=0.0
20 45 my $self = shift;
21 45 my $key = shift;
22 45 my $value = shift;
23  
24 45 ▶ return __lock sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
25 45 my $ref = __retrieve;
26 45 my $ret = $ref->{ $self->{varname} }->{$key} = $value;
27 45 __store $ref;
28  
29 45 return $ret;
30 45 };
31 }
32  
33 164 ▶sub FETCH {
Subroutine FETCH: called CC=1 SCAR=0.0
34 164 my $self = shift;
35 164 my $key = shift;
36  
37 164 ▶ return __lock sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
38 164 my $ref = __retrieve;
39 164 return $ref->{ $self->{varname} }->{$key};
40 164 };
41 }
42  
43 0 ▶sub DELETE {
Subroutine DELETE: not called CC=1 SCAR=6.9
44 0 my $self = shift;
45 0 my $key = shift;
46  
47 0 ▶ __lock sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
48 0 my $ref = __retrieve;
49 0 delete $ref->{ $self->{varname} }->{$key};
50 0 __store $ref;
51 0 };
52 }
53  
54 16 ▶sub CLEAR {
Subroutine CLEAR: called CC=1 SCAR=0.0
55 16 my $self = shift;
56  
57 16 ▶ __lock sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
58 16 my $ref = __retrieve;
59 16 $ref->{ $self->{varname} } = {};
60 16 __store $ref;
61 16 };
62 }
63  
64 129 ▶sub EXISTS {
Subroutine EXISTS: called CC=1 SCAR=0.0
65 129 my $self = shift;
66 129 my $key = shift;
67  
68 129 ▶ return __lock sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
69 129 my $ref = __retrieve;
70 129 return exists $ref->{ $self->{varname} }->{$key};
71 129 };
72 }
73  
74 48 ▶sub FIRSTKEY {
Subroutine FIRSTKEY: called CC=1 SCAR=0.0
75 48 my $self = shift;
76  
77 48 ▶ return __lock sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
78 48 my $ref = __retrieve;
79 48 $self->{__iter__} = $ref->{ $self->{varname} };
80  
81 48 my $temp = keys %{ $self->{__iter__} };
82 48 return scalar each %{ $self->{__iter__} };
83 48 };
84 }
85  
86 258 ▶sub NEXTKEY {
Subroutine NEXTKEY: called CC=1 SCAR=0.0
87 258 my $self = shift;
88 258 my $prevkey = shift;
89  
90 258 return scalar each %{ $self->{__iter__} };
91 }
92  
93 20 1;
« lib/Rex/Commands/Virtualization.pm ↑ Summary lib/Rex/Interface/File.pm »