line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Filter::First; |
2
|
2
|
|
|
2
|
|
1258
|
use strict; use utf8; use warnings FATAL => 'all'; |
|
2
|
|
|
2
|
|
3
|
|
|
2
|
|
|
2
|
|
49
|
|
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
48
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
71
|
|
3
|
2
|
|
|
2
|
|
10
|
use parent 'DTL::Fast::Filter'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
11
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$DTL::Fast::FILTER_HANDLERS{'first'} = __PACKAGE__; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
#@Override |
8
|
|
|
|
|
|
|
sub filter |
9
|
|
|
|
|
|
|
{ |
10
|
2
|
|
|
2
|
0
|
9
|
my ($self, $filter_manager, $value, $context) = @_; |
11
|
|
|
|
|
|
|
|
12
|
2
|
50
|
|
|
|
6
|
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
|
|
|
|
|
8
|
return $value; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |