line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::LLHash; |
2
|
1
|
|
|
1
|
|
29405
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
35
|
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
4
|
use base 'Template::Plugin'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
892
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
174496
|
use Tie::LLHash; |
|
1
|
|
|
|
|
1610
|
|
|
1
|
|
|
|
|
979
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
0
|
|
|
0
|
1
|
|
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
|
|
|
|
|
|
|
*insert_after = \&insert; |
28
|
|
|
|
|
|
|
sub insert { |
29
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
(tied %{$self->{hash}})->insert(@_); |
|
0
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub insert_before { |
35
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my $find_name = (tied %{$self->{hash}})->key_before($_[2]); |
|
0
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
(tied %{$self->{hash}})->insert($_[0], $_[1],$find_name); |
|
0
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub first { |
46
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
(tied %{$self->{hash}})->first(@_); |
|
0
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub last { |
52
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
(tied %{$self->{hash}})->last(@_); |
|
0
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub key_before { |
59
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
(tied %{$self->{hash}})->key_before(@_); |
|
0
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub key_after { |
66
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
(tied %{$self->{hash}})->key_after(@_); |
|
0
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub current_key { |
72
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
(tied %{$self->{hash}})->key_after(@_); |
|
0
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub current_value { |
79
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
(tied %{$self->{hash}})->current_value(@_); |
|
0
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub next { |
86
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
(tied %{$self->{hash}})->next(@_); |
|
0
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub prev { |
93
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
(tied %{$self->{hash}})->prev(@_); |
|
0
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub reset { |
100
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
101
|
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
(tied %{$self->{hash}})->reset(@_); |
|
0
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub keys { |
107
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
108
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
keys %{$self->{hash}}; |
|
0
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub value_of { |
113
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
114
|
|
|
|
|
|
|
|
115
|
0
|
|
|
|
|
|
$self->{hash}->{$_[0]}; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
*add = \&push; |
120
|
|
|
|
|
|
|
*add_before = \&insert_before; |
121
|
|
|
|
|
|
|
*add_after = \&insert; |
122
|
|
|
|
|
|
|
sub push { |
123
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
124
|
|
|
|
|
|
|
|
125
|
0
|
0
|
|
|
|
|
return unless $_[0]; |
126
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
(tied %{$self->{hash}})->last(@_); |
|
0
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
129
|
0
|
|
|
|
|
|
return; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub unshift { |
134
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
135
|
|
|
|
|
|
|
|
136
|
0
|
0
|
|
|
|
|
return unless $_[0]; |
137
|
|
|
|
|
|
|
|
138
|
0
|
|
|
|
|
|
(tied %{$self->{hash}})->first(@_); |
|
0
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
sub pop { |
144
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
145
|
0
|
|
|
|
|
|
my $last = (tied %{$self->{hash}})->last(); |
|
0
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
|
147
|
0
|
|
|
|
|
|
delete $self->{hash}->{$last}; |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
sub delete { |
151
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
152
|
|
|
|
|
|
|
|
153
|
0
|
|
|
|
|
|
delete $self->{hash}->{$_[0]}; |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
1; |
158
|
|
|
|
|
|
|
# The preceding line will help the module return a true value |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
__END__ |