blib/lib/Template/Plugin/LLHash.pm

filter: Statementstmt 19.7% 15 / 76 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 14.2% 3 / 21 Podpod 100% 18 / 18 totaltotal 30.2% 36 / 119 CC 3 SCAR 9.4
CC
3
Cov
19%
push
6.0
unshift
6.0
new
2.0
CRAP 2.6
↑ Summary
1 package Template::Plugin::LLHash;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 1 ▶use base 'Template::Plugin';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $VERSION = '0.01';
7  
8 1 ▶use Tie::LLHash;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
11 0 my $class = shift;
12  
13 0 my %hash;
14  
15 0 tie (%hash, "Tie::LLHash", @_);
16  
17 0 my $self = {
18 hash => \%hash,
19 };
20  
21 0 bless $self, $class;
22 0 return $self;
23  
24 }
25  
26  
27 1 *insert_after = \&insert;
28 0 ▶sub insert {
Subroutine insert: not called CC=1 SCAR=6.9
Pod documented
29 0 my $self = shift;
30  
31 0 (tied %{$self->{hash}})->insert(@_);
32 }
33  
34 0 ▶sub insert_before {
Subroutine insert_before: not called CC=1 SCAR=6.9
Pod documented
35 0 my $self = shift;
36  
37  
38 0 my $find_name = (tied %{$self->{hash}})->key_before($_[2]);
39 0 (tied %{$self->{hash}})->insert($_[0], $_[1],$find_name);
40  
41 }
42  
43  
44  
45 0 ▶sub first {
Subroutine first: not called CC=1 SCAR=6.9
Pod documented
46 0 my $self = shift;
47  
48 0 (tied %{$self->{hash}})->first(@_);
49 }
50  
51 0 ▶sub last {
Subroutine last: not called CC=1 SCAR=6.9
Pod documented
52 0 my $self = shift;
53  
54 0 (tied %{$self->{hash}})->last(@_);
55  
56 }
57  
58 0 ▶sub key_before {
Subroutine key_before: not called CC=1 SCAR=6.9
Pod documented
59 0 my $self = shift;
60  
61 0 (tied %{$self->{hash}})->key_before(@_);
62  
63 }
64  
65 0 ▶sub key_after {
Subroutine key_after: not called CC=1 SCAR=6.9
Pod documented
66 0 my $self = shift;
67  
68 0 (tied %{$self->{hash}})->key_after(@_);
69 }
70  
71 0 ▶sub current_key {
Subroutine current_key: not called CC=1 SCAR=6.9
Pod documented
72 0 my $self = shift;
73  
74 0 (tied %{$self->{hash}})->key_after(@_);
75  
76 }
77  
78 0 ▶sub current_value {
Subroutine current_value: not called CC=1 SCAR=6.9
Pod documented
79 0 my $self = shift;
80  
81 0 (tied %{$self->{hash}})->current_value(@_);
82  
83 }
84  
85 0 ▶sub next {
Subroutine next: not called CC=1 SCAR=6.9
Pod documented
86 0 my $self = shift;
87  
88 0 (tied %{$self->{hash}})->next(@_);
89  
90 }
91  
92 0 ▶sub prev {
Subroutine prev: not called CC=1 SCAR=6.9
Pod documented
93 0 my $self = shift;
94  
95 0 (tied %{$self->{hash}})->prev(@_);
96  
97 }
98  
99 0 ▶sub reset {
Subroutine reset: not called CC=1 SCAR=6.9
Pod documented
100 0 my $self = shift;
101  
102 0 (tied %{$self->{hash}})->reset(@_);
103  
104 }
105  
106 0 ▶sub keys {
Subroutine keys: not called CC=1 SCAR=6.9
Pod documented
107 0 my $self = shift;
108  
109 0 keys %{$self->{hash}};
110 }
111  
112 0 ▶sub value_of {
Subroutine value_of: not called CC=1 SCAR=6.9
Pod documented
113 0 my $self = shift;
114  
115 0 $self->{hash}->{$_[0]};
116 }
117  
118  
119 1 *add = \&push;
120 1 *add_before = \&insert_before;
121 1 *add_after = \&insert;
122 0 ▶sub push {
Subroutine push: not called CC=2 SCAR=17.9
Pod documented
123 0 my $self = shift;
124  
125 0 ▶ return unless $_[0];
Branch: 1 branch
BranchTrueFalseTotal
unless $_[0] 0 0 0
126  
127 0 (tied %{$self->{hash}})->last(@_);
128  
129 0 return;
130 }
131  
132  
133 0 ▶sub unshift {
Subroutine unshift: not called CC=2 SCAR=17.9
Pod documented
134 0 my $self = shift;
135  
136 0 ▶ return unless $_[0];
Branch: 1 branch
BranchTrueFalseTotal
unless $_[0] 0 0 0
137  
138 0 (tied %{$self->{hash}})->first(@_);
139  
140 }
141  
142  
143 0 ▶sub pop {
Subroutine pop: not called CC=1 SCAR=6.9
Pod documented
144 0 my $self = shift;
145 0 my $last = (tied %{$self->{hash}})->last();
146  
147 0 delete $self->{hash}->{$last};
148 }
149  
150 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
Pod documented
151 0 my $self = shift;
152  
153 0 delete $self->{hash}->{$_[0]};
154  
155 }
156  
157 1 1;
158 # The preceding line will help the module return a true value
159  
160 __END__
↑ Summary