line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Filter::First; |
2
|
2
|
|
|
2
|
|
737
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
46
|
|
3
|
2
|
|
|
2
|
|
9
|
use utf8; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
11
|
|
4
|
2
|
|
|
2
|
|
39
|
use warnings FATAL => 'all'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
112
|
|
5
|
2
|
|
|
2
|
|
10
|
use parent 'DTL::Fast::Filter'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
10
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$DTL::Fast::FILTER_HANDLERS{first} = __PACKAGE__; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#@Override |
10
|
|
|
|
|
|
|
sub filter |
11
|
|
|
|
|
|
|
{ |
12
|
2
|
|
|
2
|
0
|
4
|
my ($self, $filter_manager, $value, $context) = @_; |
13
|
|
|
|
|
|
|
|
14
|
2
|
50
|
|
|
|
12
|
if (ref $value eq 'ARRAY') |
15
|
|
|
|
|
|
|
{ |
16
|
2
|
|
|
|
|
5
|
$value = $value->[0]; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
else |
19
|
|
|
|
|
|
|
{ |
20
|
0
|
|
0
|
|
|
0
|
die $self->get_render_error( |
|
|
|
0
|
|
|
|
|
21
|
|
|
|
|
|
|
$context, |
22
|
|
|
|
|
|
|
sprintf( |
23
|
|
|
|
|
|
|
"first filter may be applied only to an ARRAY reference, not %s (%s)" |
24
|
|
|
|
|
|
|
, $value // 'undef' |
25
|
|
|
|
|
|
|
, ref $value || 'SCALAR' |
26
|
|
|
|
|
|
|
) |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
2
|
|
|
|
|
6
|
return $value; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |