line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::ListMoreUtils; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
65203
|
use strict; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
105
|
|
4
|
3
|
|
|
3
|
|
17
|
use warnings; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
76
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
10
|
no strict 'refs'; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
77
|
|
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
11
|
use vars qw($VERSION @ISA); |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
158
|
|
9
|
|
|
|
|
|
|
|
10
|
3
|
|
|
3
|
|
1528
|
use List::MoreUtils; |
|
3
|
|
|
|
|
27160
|
|
|
3
|
|
|
|
|
26
|
|
11
|
3
|
|
|
3
|
|
3033
|
use Template::Plugin::Procedural; |
|
3
|
|
|
|
|
8164
|
|
|
3
|
|
|
|
|
109
|
|
12
|
3
|
|
|
3
|
|
20
|
use vars qw(@ISA $VERSION); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
4593
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
$VERSION = '0.03'; |
15
|
|
|
|
|
|
|
@ISA = qw(Template::Plugin::Procedural); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 NAME |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Template::Plugin::ListMoreUtils - TT2 plugin to use List::MoreUtils |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
[% my1to9even = [ 2, 4, 6, 8 ]; |
24
|
|
|
|
|
|
|
my1to9prim = [ 2, 3, 5, 7 ]; |
25
|
|
|
|
|
|
|
my1to9odd = [ 1, 3, 5, 7, 9 ]; %] |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
[% USE ListMoreUtils %] |
28
|
|
|
|
|
|
|
[% my1to9all = ListMoreUtils.uniq( my1to9even.merge( my1to9prim, my1to9odd ) ); %] |
29
|
|
|
|
|
|
|
1 .. 9 are [% my1to9all.size() %] |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 DESCRIPTION |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
This module provides an Template::Toolkit interface to Tassilo von Parseval's |
34
|
|
|
|
|
|
|
L. It extends the built-in functions dealing with lists as |
35
|
|
|
|
|
|
|
well as L. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 USAGE |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
To use this module from templates, you can choose between class interface |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
[% my1to9even = [ 2, 4, 6, 8 ]; |
42
|
|
|
|
|
|
|
my1to9prim = [ 2, 3, 5, 7 ]; |
43
|
|
|
|
|
|
|
my1to9odd = [ 1, 3, 5, 7, 9 ]; %] |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
[% USE ListMoreUtils %] |
46
|
|
|
|
|
|
|
[% my1to9all = ListMoreUtils.uniq( my1to9even.merge( my1to9prim, my1to9odd ) ); %] |
47
|
|
|
|
|
|
|
1 .. 9 are [% my1to9all.size() %] |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
or the virtual method interface, which is described in |
50
|
|
|
|
|
|
|
L. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 FUNCTIONS PROVIDED |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
All functions behave as documented in L. I don't plan to |
55
|
|
|
|
|
|
|
copy the entire POD from there. |
56
|
|
|
|
|
|
|
L provides lists as list reference, so they were expanded |
57
|
|
|
|
|
|
|
before the appropriate function in C is called. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 any BLOCK LIST |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
62
|
|
|
|
|
|
|
|
63
|
2
|
|
|
2
|
1
|
23988
|
sub any(&\@) { List::MoreUtils::any( \&{ $_[0] }, @{ $_[1] } ); } |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
16
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 all BLOCK LIST |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
68
|
|
|
|
|
|
|
|
69
|
2
|
|
|
2
|
1
|
16814
|
sub all(&\@) { List::MoreUtils::all( \&{ $_[0] }, @{ $_[1] } ); } |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
19
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 none BLOCK LIST |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
74
|
|
|
|
|
|
|
|
75
|
2
|
|
|
2
|
1
|
16957
|
sub none(&\@) { List::MoreUtils::none( \&{ $_[0] }, @{ $_[1] } ); } |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
11
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 notall BLOCK LIST |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
80
|
|
|
|
|
|
|
|
81
|
2
|
|
|
2
|
1
|
16826
|
sub notall(&\@) { List::MoreUtils::notall( \&{ $_[0] }, @{ $_[1] } ); } |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
9
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 any_u BLOCK LIST |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
0
|
1
|
0
|
sub any_u(&\@) { List::MoreUtils::any_u( \&{ $_[0] }, @{ $_[1] } ); } |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 all_u BLOCK LIST |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
0
|
1
|
0
|
sub all_u(&\@) { List::MoreUtils::all_u( \&{ $_[0] }, @{ $_[1] } ); } |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head2 none_u BLOCK LIST |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=cut |
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
0
|
1
|
0
|
sub none_u(&\@) { List::MoreUtils::none_u( \&{ $_[0] }, @{ $_[1] } ); } |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head2 notall_u BLOCK LIST |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |
104
|
|
|
|
|
|
|
|
105
|
0
|
|
|
0
|
1
|
0
|
sub notall_u(&\@) { List::MoreUtils::notall_u( \&{ $_[0] }, @{ $_[1] } ); } |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head2 true BLOCK LIST |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=cut |
110
|
|
|
|
|
|
|
|
111
|
3
|
|
|
3
|
1
|
25346
|
sub true(&\@) { List::MoreUtils::true( \&{ $_[0] }, @{ $_[1] } ); } |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
21
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head2 false BLOCK LIST |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |
116
|
|
|
|
|
|
|
|
117
|
3
|
|
|
3
|
1
|
25182
|
sub false(&\@) { List::MoreUtils::false( \&{ $_[0] }, @{ $_[1] } ); } |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
22
|
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head2 firstidx BLOCK LIST |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head2 first_index BLOCK LIST |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=cut |
124
|
|
|
|
|
|
|
|
125
|
3
|
|
|
3
|
1
|
24377
|
sub firstidx(&\@) { List::MoreUtils::firstidx( \&{ $_[0] }, @{ $_[1] } ); } |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
22
|
|
126
|
|
|
|
|
|
|
*first_index = *{'firstidx'}{CODE}; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head2 lastidx BLOCK LIST |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 last_index BLOCK LIST |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=cut |
133
|
|
|
|
|
|
|
|
134
|
3
|
|
|
3
|
1
|
24400
|
sub lastidx(&\@) { List::MoreUtils::lastidx( \&{ $_[0] }, @{ $_[1] } ); } |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
12
|
|
135
|
|
|
|
|
|
|
*last_index = *{'lastidx'}{CODE}; |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head2 onlyidx BLOCK LIST |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head2 only_index BLOCK LIST |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=cut |
142
|
|
|
|
|
|
|
|
143
|
0
|
|
|
0
|
1
|
0
|
sub onlyidx(&\@) { List::MoreUtils::onlyidx( \&{ $_[0] }, @{ $_[1] } ); } |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
144
|
|
|
|
|
|
|
*only_index = *{'onlyidx'}{CODE}; |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head2 firstres BLOCK LIST |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head2 first_result BLOCK LIST |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=cut |
151
|
|
|
|
|
|
|
|
152
|
0
|
|
|
0
|
1
|
0
|
sub firstres(&\@) { List::MoreUtils::firstres( \&{ $_[0] }, @{ $_[1] } ); } |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
153
|
|
|
|
|
|
|
*first_result = *{'firstres'}{CODE}; |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head2 lastres BLOCK LIST |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head2 last_result BLOCK LIST |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=cut |
160
|
|
|
|
|
|
|
|
161
|
0
|
|
|
0
|
1
|
0
|
sub lastres(&\@) { List::MoreUtils::lastres( \&{ $_[0] }, @{ $_[1] } ); } |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
162
|
|
|
|
|
|
|
*last_result = *{'lastres'}{CODE}; |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head2 onlyres BLOCK LIST |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head2 only_result BLOCK LIST |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=cut |
169
|
|
|
|
|
|
|
|
170
|
0
|
|
|
0
|
1
|
0
|
sub onlyres(&\@) { List::MoreUtils::onlyres( \&{ $_[0] }, @{ $_[1] } ); } |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
171
|
|
|
|
|
|
|
*only_result = *{'onlyres'}{CODE}; |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head2 firstval BLOCK LIST |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head2 first_value BLOCK LIST |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=cut |
178
|
|
|
|
|
|
|
|
179
|
3
|
|
|
3
|
1
|
24147
|
sub firstval(&\@) { List::MoreUtils::firstval( \&{ $_[0] }, @{ $_[1] } ); } |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
14
|
|
180
|
|
|
|
|
|
|
*first_value = *{'firstval'}{CODE}; |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head2 lastval BLOCK LIST |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head2 last_value BLOCK LIST |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=cut |
187
|
|
|
|
|
|
|
|
188
|
3
|
|
|
3
|
1
|
23834
|
sub lastval(&\@) { List::MoreUtils::lastval( \&{ $_[0] }, @{ $_[1] } ); } |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
18
|
|
189
|
|
|
|
|
|
|
*last_value = *{'lastval'}{CODE}; |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=head2 onlyval BLOCK LIST |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head2 only_value BLOCK LIST |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=cut |
196
|
|
|
|
|
|
|
|
197
|
0
|
|
|
0
|
1
|
0
|
sub onlyval(&\@) { List::MoreUtils::onlyval( \&{ $_[0] }, @{ $_[1] } ); } |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
198
|
|
|
|
|
|
|
*only_value = *{'onlyval'}{CODE}; |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=head2 insert_after BLOCK VALUE LIST |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=cut |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
*insert_after = *{'List::MoreUtils::insert_after'}{CODE} if ( defined( *{'List::MoreUtils::insert_after'}{CODE} ) ); |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=head2 insert_after_string STRING VALUE LIST |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=cut |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
*insert_after_string = *{'List::MoreUtils::insert_after_string'}{CODE} |
211
|
|
|
|
|
|
|
if ( defined( *{'List::MoreUtils::insert_after_string'}{CODE} ) ); |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=head2 apply BLOCK LIST |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=cut |
216
|
|
|
|
|
|
|
|
217
|
1
|
|
|
1
|
1
|
28633
|
sub apply(&\@) { List::MoreUtils::apply( \&{ $_[0] }, @{ $_[1] } ); } |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
14
|
|
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=head2 after BLOCK LIST |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=cut |
222
|
|
|
|
|
|
|
|
223
|
1
|
|
|
1
|
1
|
9987
|
sub after(&\@) { List::MoreUtils::after( \&{ $_[0] }, @{ $_[1] } ); } |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
7
|
|
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=head2 after_incl BLOCK LIST |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=cut |
228
|
|
|
|
|
|
|
|
229
|
1
|
|
|
1
|
1
|
9386
|
sub after_incl(&\@) { List::MoreUtils::after_incl( \&{ $_[0] }, @{ $_[1] } ); } |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
13
|
|
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
=head2 before BLOCK LIST |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=cut |
234
|
|
|
|
|
|
|
|
235
|
1
|
|
|
1
|
1
|
9242
|
sub before(&\@) { List::MoreUtils::before( \&{ $_[0] }, @{ $_[1] } ); } |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
13
|
|
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=head2 before_incl BLOCK LIST |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=cut |
240
|
|
|
|
|
|
|
|
241
|
1
|
|
|
1
|
1
|
9114
|
sub before_incl(&\@) { List::MoreUtils::before_incl( \&{ $_[0] }, @{ $_[1] } ); } |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=head2 indexes BLOCK LIST |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
=cut |
246
|
|
|
|
|
|
|
|
247
|
1
|
|
|
1
|
1
|
8740
|
sub indexes(&\@) { List::MoreUtils::indexes( \&{ $_[0] }, @{ $_[1] } ); } |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
12
|
|
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
=head2 pairwise BLOCK LIST LIST |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
Unlike the original C, both variables are given through C<@_>. |
252
|
|
|
|
|
|
|
Template::Toolkit uses eval to evaluate the perl code declared there and |
253
|
|
|
|
|
|
|
passes neither C<$a> nor C<$b> (which sounds reasonable to me). |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
=cut |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
sub pairwise(&\@\@) |
258
|
|
|
|
|
|
|
{ |
259
|
2
|
|
|
2
|
1
|
17063
|
my $userfn = $_[0]; |
260
|
2
|
|
|
8
|
|
7
|
List::MoreUtils::pairwise( sub { &{$userfn}( $a, $b ); }, @{ $_[1] }, @{ $_[2] } ); |
|
8
|
|
|
|
|
190
|
|
|
8
|
|
|
|
|
15
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
12
|
|
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=head2 minmax LIST |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=cut |
266
|
|
|
|
|
|
|
|
267
|
4
|
|
|
4
|
1
|
36114
|
sub minmax(\@) { List::MoreUtils::minmax( @{ $_[0] } ); } |
|
4
|
|
|
|
|
44
|
|
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
=head2 uniq LIST |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=head2 distinct LIST |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
=cut |
274
|
|
|
|
|
|
|
|
275
|
4
|
|
|
4
|
1
|
24328
|
sub uniq(\@) { List::MoreUtils::uniq( @{ $_[0] } ); } |
|
4
|
|
|
|
|
74
|
|
276
|
|
|
|
|
|
|
*distinct = *{'uniq'}{CODE}; |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
=head2 singleton LIST |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
=cut |
281
|
|
|
|
|
|
|
|
282
|
4
|
|
|
4
|
1
|
38315
|
sub singleton(\@) { List::MoreUtils::singleton( @{ $_[0] } ); } |
|
4
|
|
|
|
|
66
|
|
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
=head2 mesh |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
=head2 zip |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
=cut |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
*mesh = *{'List::MoreUtils::mesh'}{CODE} if ( defined( *{'List::MoreUtils::mesh'}{CODE} ) ); |
291
|
|
|
|
|
|
|
*zip = *{'List::MoreUtils::zip'}{CODE} if ( defined( *{'List::MoreUtils::zip'}{CODE} ) ); |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
=head2 part BLOCK LIST |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
=cut |
296
|
|
|
|
|
|
|
|
297
|
1
|
|
|
1
|
1
|
10669
|
sub part(&\@) { List::MoreUtils::part( \&{ $_[0] }, @{ $_[1] } ) } |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
=head2 bsearch BLOCK LIST |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=cut |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
sub bsearch(&\@) |
304
|
|
|
|
|
|
|
{ |
305
|
4
|
|
|
4
|
1
|
34015
|
my $user_fn = $_[0]; |
306
|
4
|
|
|
8
|
|
18
|
List::MoreUtils::bsearch( sub { $user_fn->($_) }, @{ $_[1] } ); |
|
8
|
|
|
|
|
164
|
|
|
4
|
|
|
|
|
25
|
|
307
|
|
|
|
|
|
|
} |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
=head2 bsearchidx BLOCK LIST |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
=head2 bsearch_index BLOCK LIST |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
=cut |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
sub bsearchidx(&\@) |
316
|
|
|
|
|
|
|
{ |
317
|
4
|
|
|
4
|
1
|
32154
|
my $user_fn = $_[0]; |
318
|
4
|
|
|
8
|
|
36
|
List::MoreUtils::bsearchidx( sub { $user_fn->($_) }, @{ $_[1] } ); |
|
8
|
|
|
|
|
163
|
|
|
4
|
|
|
|
|
18
|
|
319
|
|
|
|
|
|
|
} |
320
|
|
|
|
|
|
|
*bsearch_index = *{'bsearchidx'}{CODE}; |
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
=head1 LIMITATION |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
Except the typical limitations known from perl functions embedded in |
325
|
|
|
|
|
|
|
L, the only limitation I currently miss is being |
326
|
|
|
|
|
|
|
able to use TT2 defined macros as callback. |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
=head1 BUGS |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
331
|
|
|
|
|
|
|
C, or through the web interface at |
332
|
|
|
|
|
|
|
L. |
333
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress |
334
|
|
|
|
|
|
|
on your bug as I make changes. |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
=head1 SUPPORT |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
perldoc Template::Plugin::ListMoreUtils |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
You can also look for information at: |
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
=over 4 |
345
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
347
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
L |
349
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
L |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
=item * CPAN Ratings |
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
L |
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
=item * Search CPAN |
359
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
L |
361
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
=back |
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
Business and commercial support should be acquired via preferred freelancer |
365
|
|
|
|
|
|
|
agencies. |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
Copyright 2009-2015 Jens Rehsack. |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
372
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
373
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
376
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
=head1 SEE ALSO |
378
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
perl(1), L, |
380
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
=cut |
382
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
1; |