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