line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Filter::Reverse; |
2
|
3
|
|
|
3
|
|
1299
|
use strict; use utf8; use warnings FATAL => 'all'; |
|
3
|
|
|
3
|
|
5
|
|
|
3
|
|
|
3
|
|
76
|
|
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
66
|
|
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
98
|
|
3
|
3
|
|
|
3
|
|
12
|
use parent 'DTL::Fast::Filter'; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
13
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$DTL::Fast::FILTER_HANDLERS{'reverse'} = __PACKAGE__; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
#@Overrde |
8
|
|
|
|
|
|
|
sub filter |
9
|
|
|
|
|
|
|
{ |
10
|
3
|
|
|
3
|
0
|
5
|
my( $self, $filter_manager, $value, $context ) = @_; |
11
|
3
|
|
|
|
|
1
|
my $result; |
12
|
|
|
|
|
|
|
|
13
|
3
|
|
|
|
|
5
|
my $value_type = ref $value; |
14
|
|
|
|
|
|
|
|
15
|
3
|
100
|
|
|
|
8
|
if( $value_type eq 'ARRAY' ) |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
16
|
|
|
|
|
|
|
{ |
17
|
2
|
|
|
|
|
3
|
$result = [reverse @$value]; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
elsif( $value_type eq 'HASH' ) |
20
|
|
|
|
|
|
|
{ |
21
|
0
|
|
|
|
|
0
|
$result = {reverse %$value}; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
elsif( UNIVERSAL::can($value_type, 'reverse') ) |
24
|
|
|
|
|
|
|
{ |
25
|
0
|
|
|
|
|
0
|
$result = $value->reverse($context); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
elsif( not $value_type ) |
28
|
|
|
|
|
|
|
{ |
29
|
1
|
|
|
|
|
8
|
$result = join '', reverse ($value =~ /(.)/gs); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
else |
32
|
|
|
|
|
|
|
{ |
33
|
0
|
|
|
|
|
0
|
die $self->get_render_error( $context, "don't know how to reverse $value ($value_type)"); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
3
|
|
|
|
|
9
|
return $result; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |