line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Like::VMethods; |
2
|
|
|
|
|
|
|
|
3
|
13
|
|
|
13
|
|
66
|
use strict; |
|
13
|
|
|
|
|
25
|
|
|
13
|
|
|
|
|
31851
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub can { |
6
|
5
|
|
|
5
|
0
|
7
|
my $class = shift; |
7
|
5
|
|
|
|
|
7
|
my $name = shift; |
8
|
5
|
|
|
|
|
6
|
my $val = shift; |
9
|
5
|
|
|
|
|
16
|
my $type = $class->getTypeByVal($val); |
10
|
5
|
|
|
|
|
11
|
my $method = $type . '_' . $name; |
11
|
|
|
|
|
|
|
|
12
|
5
|
|
|
|
|
44
|
return $class->SUPER::can($method); |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub exec { |
16
|
4
|
|
|
4
|
0
|
5
|
my $class = shift; |
17
|
4
|
|
|
|
|
6
|
my $name = shift; |
18
|
4
|
|
|
|
|
5
|
my $val = shift; |
19
|
4
|
|
|
|
|
10
|
my $type = $class->getTypeByVal($val); |
20
|
4
|
|
|
|
|
9
|
my $method = $type . '_' . $name; |
21
|
|
|
|
|
|
|
|
22
|
4
|
|
|
|
|
11
|
return $class->$method($val, @_); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub getTypeByVal { |
26
|
9
|
50
|
|
9
|
0
|
40
|
return !ref $_[1] ? 'scalar' : |
|
|
50
|
|
|
|
|
|
27
|
|
|
|
|
|
|
ref $_[1] ne 'SCALAR' ? lc(ref $_[1]) : ''; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub scalar_defined { |
31
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
32
|
0
|
|
|
|
|
0
|
my $val = shift; |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
0
|
return defined $val; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub scalar_length { |
38
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
39
|
0
|
|
|
|
|
0
|
my $val = shift; |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
0
|
return length $val; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub scalar_repeat { |
45
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
46
|
0
|
|
|
|
|
0
|
my $val = shift; |
47
|
0
|
|
|
|
|
0
|
my $arg = shift; |
48
|
|
|
|
|
|
|
|
49
|
0
|
0
|
0
|
|
|
0
|
die q{VMethod USAGE [% scalar.repeat(\d+) %]} unless defined $arg && $arg=~/^\d+$/; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
0
|
return $val x $arg; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub scalar_replace { |
55
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
56
|
0
|
|
|
|
|
0
|
my $val = shift; |
57
|
0
|
|
|
|
|
0
|
my $search = shift; |
58
|
0
|
|
|
|
|
0
|
my $replace = shift; |
59
|
|
|
|
|
|
|
|
60
|
0
|
0
|
0
|
|
|
0
|
die q{VMethod USAGE [% scalar.replace('hogge', 'hoge') %]} unless defined $search && defined $replace; |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
0
|
$val=~s/$search/$replace/g; |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
0
|
return $val; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub scalar_match { |
68
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
69
|
0
|
|
|
|
|
0
|
my $val = shift; |
70
|
0
|
|
|
|
|
0
|
my $pattern = shift; |
71
|
|
|
|
|
|
|
|
72
|
0
|
0
|
|
|
|
0
|
die q{VMethod USAGE [% FOREACH matchstr = scalar.match('(\w)oge') %]} unless defined $pattern; |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
0
|
my @maches = $val=~/$pattern/g; |
75
|
|
|
|
|
|
|
|
76
|
0
|
0
|
|
|
|
0
|
return undef unless scalar(@maches); |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
0
|
return \@maches; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub scalar_search { |
82
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
83
|
0
|
|
|
|
|
0
|
my $val = shift; |
84
|
0
|
|
|
|
|
0
|
my $pattern = shift; |
85
|
|
|
|
|
|
|
|
86
|
0
|
0
|
|
|
|
0
|
die q{VMethod USAGE [% IF scalar.search('(\w)oge') %]} unless defined $pattern; |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
0
|
return $val=~/$pattern/; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub scalar_split { |
92
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
93
|
0
|
|
|
|
|
0
|
my $val = shift; |
94
|
0
|
|
|
|
|
0
|
my $pattern = shift; |
95
|
|
|
|
|
|
|
|
96
|
0
|
0
|
|
|
|
0
|
die q{VMethod USAGE [% FOREACH scalar.split(':') %]} unless defined $pattern; |
97
|
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
0
|
return [ split($pattern, $val) ]; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub scalar_list { |
102
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
103
|
0
|
|
|
|
|
0
|
my $val = shift; |
104
|
|
|
|
|
|
|
|
105
|
0
|
|
|
|
|
0
|
return [ $val ]; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub scalar_hash { |
109
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
110
|
0
|
|
|
|
|
0
|
my $val = shift; |
111
|
|
|
|
|
|
|
|
112
|
0
|
|
|
|
|
0
|
return { value => $val }; |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub scalar_size { |
116
|
0
|
|
|
0
|
0
|
0
|
return 1; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub scalar_substr { |
120
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
121
|
0
|
|
|
|
|
0
|
my $val = shift; |
122
|
0
|
|
|
|
|
0
|
my $offset = shift; |
123
|
0
|
|
|
|
|
0
|
my $size = shift; |
124
|
0
|
|
|
|
|
0
|
my $str = substr $val, $offset, $size; |
125
|
|
|
|
|
|
|
|
126
|
0
|
|
|
|
|
0
|
return $str; |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
sub scalar_html { |
130
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
131
|
0
|
|
|
|
|
0
|
my $val = shift; |
132
|
|
|
|
|
|
|
|
133
|
0
|
0
|
|
|
|
0
|
return unless length $val; |
134
|
|
|
|
|
|
|
|
135
|
0
|
|
|
|
|
0
|
$val =~ s{&}{&}gso; |
136
|
0
|
|
|
|
|
0
|
$val =~ s{<}{<}gso; |
137
|
0
|
|
|
|
|
0
|
$val =~ s{>}{>}gso; |
138
|
0
|
|
|
|
|
0
|
$val =~ s{"}{"}gso; |
139
|
|
|
|
|
|
|
|
140
|
0
|
|
|
|
|
0
|
return $val; |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
sub scalar_uri { |
144
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
145
|
0
|
|
|
|
|
0
|
my $val = shift; |
146
|
|
|
|
|
|
|
|
147
|
0
|
|
|
|
|
0
|
$val =~ s/(\W)/'%' . unpack('H2', $1)/eg; |
|
0
|
|
|
|
|
0
|
|
148
|
|
|
|
|
|
|
|
149
|
0
|
|
|
|
|
0
|
return $val; |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub scalar_comma { |
153
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
154
|
0
|
|
|
|
|
0
|
my $num = shift; |
155
|
0
|
|
|
|
|
0
|
my $len = shift; |
156
|
|
|
|
|
|
|
|
157
|
0
|
|
0
|
|
|
0
|
$len ||= 3; |
158
|
|
|
|
|
|
|
|
159
|
0
|
|
|
|
|
0
|
my ( $i, $j ); |
160
|
0
|
0
|
|
|
|
0
|
if ($num =~ /^[-+]?\d\d\d\d+/g) { |
161
|
0
|
|
|
|
|
0
|
for ($i = pos($num) - $len, $j = $num =~ /^[-+]/; $i > $j; $i -= $len) { |
162
|
0
|
|
|
|
|
0
|
substr($num, $i, 0) = ','; |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
|
166
|
0
|
|
|
|
|
0
|
return $num; |
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
sub array_first { |
170
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
171
|
0
|
|
|
|
|
0
|
my $val = shift; |
172
|
0
|
|
|
|
|
0
|
return $val->[0]; |
173
|
|
|
|
|
|
|
} |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
sub array_last { |
176
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
177
|
0
|
|
|
|
|
0
|
my $val = shift; |
178
|
0
|
|
|
|
|
0
|
return $val->[ $#{ $val } ]; |
|
0
|
|
|
|
|
0
|
|
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
sub array_size { |
182
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
183
|
0
|
|
|
|
|
0
|
my $val = shift; |
184
|
0
|
|
|
|
|
0
|
return scalar( @{ $val } ); |
|
0
|
|
|
|
|
0
|
|
185
|
|
|
|
|
|
|
} |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
sub array_max { |
188
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
189
|
0
|
|
|
|
|
0
|
my $val = shift; |
190
|
0
|
|
|
|
|
0
|
return $#{ $val }; |
|
0
|
|
|
|
|
0
|
|
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
sub array_reverse { |
194
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
195
|
0
|
|
|
|
|
0
|
my $val = shift; |
196
|
0
|
|
|
|
|
0
|
return [ reverse @{ $val } ]; |
|
0
|
|
|
|
|
0
|
|
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
sub array_join { |
200
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
201
|
0
|
|
|
|
|
0
|
my $val = shift; |
202
|
0
|
|
0
|
|
|
0
|
my $sep = shift || " "; |
203
|
0
|
|
|
|
|
0
|
return join $sep, @{ $val }; |
|
0
|
|
|
|
|
0
|
|
204
|
|
|
|
|
|
|
} |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
sub array_grep { |
207
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
208
|
0
|
|
|
|
|
0
|
my $val = shift; |
209
|
0
|
|
|
|
|
0
|
my $pattern = shift; |
210
|
0
|
|
|
|
|
0
|
return [ grep /$pattern/, @{ $val } ]; |
|
0
|
|
|
|
|
0
|
|
211
|
|
|
|
|
|
|
} |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
sub array_sort { |
214
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
215
|
0
|
|
|
|
|
0
|
my $val = shift; |
216
|
0
|
|
|
|
|
0
|
my $key = shift; |
217
|
0
|
0
|
|
|
|
0
|
if ( defined $key ) { |
218
|
0
|
|
|
|
|
0
|
return [ sort { $a->{$key} cmp $b->{$key} } @{ $val } ]; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
219
|
|
|
|
|
|
|
} |
220
|
0
|
|
|
|
|
0
|
return [ sort { $a cmp $b } @{ $val } ]; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
221
|
|
|
|
|
|
|
} |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
sub array_nsort { |
224
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
225
|
0
|
|
|
|
|
0
|
my $val = shift; |
226
|
0
|
|
|
|
|
0
|
my $key = shift; |
227
|
0
|
0
|
|
|
|
0
|
if ( defined $key ) { |
228
|
0
|
|
|
|
|
0
|
return [ sort { $a->{$key} <=> $b->{$key} } @{ $val } ]; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
229
|
|
|
|
|
|
|
} |
230
|
0
|
|
|
|
|
0
|
return [ sort { $a <=> $b } @{ $val } ]; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
sub array_unshift { |
234
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
235
|
0
|
|
|
|
|
0
|
my $val = shift; |
236
|
0
|
|
|
|
|
0
|
my $item = shift; |
237
|
0
|
|
|
|
|
0
|
unshift @{ $val }, $item; |
|
0
|
|
|
|
|
0
|
|
238
|
0
|
|
|
|
|
0
|
return ; |
239
|
|
|
|
|
|
|
} |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
sub array_push { |
242
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
243
|
0
|
|
|
|
|
0
|
my $val = shift; |
244
|
0
|
|
|
|
|
0
|
my $item = shift; |
245
|
0
|
|
|
|
|
0
|
push @{ $val }, $item; |
|
0
|
|
|
|
|
0
|
|
246
|
0
|
|
|
|
|
0
|
return ; |
247
|
|
|
|
|
|
|
} |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
sub array_shift { |
250
|
4
|
|
|
4
|
0
|
5
|
my $class = shift; |
251
|
4
|
|
|
|
|
4
|
my $val = shift; |
252
|
4
|
|
|
|
|
5
|
shift @{ $val }; |
|
4
|
|
|
|
|
17
|
|
253
|
|
|
|
|
|
|
} |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
sub array_pop { |
256
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
257
|
0
|
|
|
|
|
|
my $val = shift; |
258
|
0
|
|
|
|
|
|
pop @{ $val }; |
|
0
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
} |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
sub array_unique { |
262
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
263
|
0
|
|
|
|
|
|
my $val = shift; |
264
|
0
|
|
|
|
|
|
my $hash_ref = {}; |
265
|
|
|
|
|
|
|
|
266
|
0
|
|
|
|
|
|
@{ $hash_ref }{ @{ $val } } = ('1') x scalar( @{ $val } ); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
267
|
0
|
|
|
|
|
|
return [ keys %{ $hash_ref } ]; |
|
0
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
} |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
sub array_merge { |
271
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
272
|
0
|
|
|
|
|
|
my $val = shift; |
273
|
0
|
|
|
|
|
|
my @arrays = @_; |
274
|
|
|
|
|
|
|
|
275
|
0
|
|
|
|
|
|
my @result = @{ $val }; |
|
0
|
|
|
|
|
|
|
276
|
0
|
|
|
|
|
|
push @result, @{ $_ } for ( @arrays ); |
|
0
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
|
278
|
0
|
|
|
|
|
|
return \@result; |
279
|
|
|
|
|
|
|
} |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
sub array_slice { |
282
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
283
|
0
|
|
|
|
|
|
my $val = shift; |
284
|
0
|
|
|
|
|
|
my $from = shift; |
285
|
0
|
|
|
|
|
|
my $to = shift; |
286
|
|
|
|
|
|
|
|
287
|
0
|
|
|
|
|
|
return [ @{ $val }[ $from .. $to ] ]; |
|
0
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
} |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
sub array_splice { |
291
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
292
|
0
|
|
|
|
|
|
my $val = shift; |
293
|
0
|
|
|
|
|
|
my $offset = shift; |
294
|
0
|
|
|
|
|
|
my $length = shift; |
295
|
0
|
0
|
|
|
|
|
my @list = ref $_[0] ? @{ $_[0] } : @_ ; |
|
0
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
|
297
|
0
|
|
|
|
|
|
return [ splice @{ $val }, $offset, $length, @list ]; |
|
0
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
} |
299
|
|
|
|
|
|
|
|
300
|
0
|
|
|
0
|
0
|
|
sub array_list { $_[1] } |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
sub hash_keys { |
303
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
304
|
0
|
|
|
|
|
|
my $val = shift; |
305
|
0
|
|
|
|
|
|
return [ keys %{ $val } ]; |
|
0
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
} |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
sub hash_values { |
309
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
310
|
0
|
|
|
|
|
|
my $val = shift; |
311
|
0
|
|
|
|
|
|
return [ values %{ $val } ]; |
|
0
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
} |
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
sub hash_each { |
315
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
316
|
0
|
|
|
|
|
|
my $val = shift; |
317
|
0
|
|
|
|
|
|
my @list; |
318
|
0
|
|
|
|
|
|
while ( my ( $key, $val ) = each %{ $val } ) { push @list, $key, $val; } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
319
|
0
|
|
|
|
|
|
return \@list; |
320
|
|
|
|
|
|
|
} |
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
sub hash_defined { |
323
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
324
|
0
|
|
|
|
|
|
my $val = shift; |
325
|
0
|
|
|
|
|
|
my $key = shift; |
326
|
0
|
|
|
|
|
|
return defined $val->{$key}; |
327
|
|
|
|
|
|
|
} |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
sub hash_exists { |
330
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
331
|
0
|
|
|
|
|
|
my $val = shift; |
332
|
0
|
|
|
|
|
|
my $key = shift; |
333
|
0
|
|
|
|
|
|
return exists $val->{$key}; |
334
|
|
|
|
|
|
|
} |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
sub hash_size { |
337
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
338
|
0
|
|
|
|
|
|
my $val = shift; |
339
|
|
|
|
|
|
|
|
340
|
0
|
|
|
|
|
|
return scalar( keys %{ $val } ); |
|
0
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
} |
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
sub hash_item { |
344
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
345
|
0
|
|
|
|
|
|
my $val = shift; |
346
|
0
|
|
|
|
|
|
my $key = shift; |
347
|
0
|
|
|
|
|
|
return $val->{$key}; |
348
|
|
|
|
|
|
|
} |
349
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
sub hash_list { |
351
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
352
|
0
|
|
|
|
|
|
my $val = shift; |
353
|
0
|
|
|
|
|
|
my $type = shift; |
354
|
|
|
|
|
|
|
|
355
|
0
|
0
|
0
|
|
|
|
if ( defined $type && $type eq 'keys' ) { |
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
356
|
0
|
|
|
|
|
|
return $class->keys( $val ); |
357
|
|
|
|
|
|
|
} elsif ( defined $type && $type eq 'values' ) { |
358
|
0
|
|
|
|
|
|
return $class->values( $val ); |
359
|
|
|
|
|
|
|
} elsif ( defined $type && $type eq 'each' ) { |
360
|
0
|
|
|
|
|
|
return $class->each( $val ); |
361
|
|
|
|
|
|
|
} else { |
362
|
0
|
|
|
|
|
|
my @list; |
363
|
0
|
|
|
|
|
|
while ( my ( $key, $val ) = CORE::each(%{ $val }) ) { push @list, { key => $key, value => $val }; } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
364
|
0
|
|
|
|
|
|
return \@list; |
365
|
|
|
|
|
|
|
} |
366
|
|
|
|
|
|
|
} |
367
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
1; |