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