| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package DTL::Fast::Filter::Last; |
|
2
|
2
|
|
|
2
|
|
718
|
use strict; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
46
|
|
|
3
|
2
|
|
|
2
|
|
11
|
use utf8; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
8
|
|
|
4
|
2
|
|
|
2
|
|
39
|
use warnings FATAL => 'all'; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
57
|
|
|
5
|
2
|
|
|
2
|
|
8
|
use parent 'DTL::Fast::Filter'; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$DTL::Fast::FILTER_HANDLERS{last} = __PACKAGE__; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#@Override |
|
10
|
|
|
|
|
|
|
sub filter |
|
11
|
|
|
|
|
|
|
{ |
|
12
|
2
|
|
|
2
|
0
|
6
|
my ( $self, $filter_manager, $value, $context ) = @_; |
|
13
|
|
|
|
|
|
|
|
|
14
|
2
|
50
|
|
|
|
5
|
if (ref $value eq 'ARRAY') |
|
15
|
|
|
|
|
|
|
{ |
|
16
|
2
|
|
|
|
|
4
|
$value = $value->[- 1]; |
|
17
|
|
|
|
|
|
|
} |
|
18
|
|
|
|
|
|
|
else |
|
19
|
|
|
|
|
|
|
{ |
|
20
|
0
|
|
0
|
|
|
0
|
die $self->get_render_error( |
|
|
|
|
0
|
|
|
|
|
|
21
|
|
|
|
|
|
|
$context, |
|
22
|
|
|
|
|
|
|
sprintf( |
|
23
|
|
|
|
|
|
|
"last 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; |