line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# This file is part of Template-Plugin-Map |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# This software is copyright (c) 2017 by Michael Schout . |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# This is free software; you can redistribute it and/or modify it under |
7
|
|
|
|
|
|
|
# the same terms as the Perl 5 programming language system itself. |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
package Template::Plugin::Map; |
10
|
|
|
|
|
|
|
$Template::Plugin::Map::VERSION = '0.03'; |
11
|
|
|
|
|
|
|
# ABSTRACT: map VMethod for Template::Tookit |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
54004
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
26
|
|
14
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
15
|
1
|
|
|
1
|
|
5
|
use base 'Template::Plugin::VMethods'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
314
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our @LIST_OPS = (map => \&map_list); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub map_list { |
20
|
2
|
|
|
2
|
0
|
2946
|
my ($list, $method) = @_; |
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
|
|
4
|
[map { $_->$method } @$list]; |
|
4
|
|
|
|
|
21
|
|
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
1; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
__END__ |