line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Filter::Reverse; |
2
|
3
|
|
|
3
|
|
2263
|
use strict; use utf8; use warnings FATAL => 'all'; |
|
3
|
|
|
3
|
|
6
|
|
|
3
|
|
|
3
|
|
83
|
|
|
3
|
|
|
|
|
15
|
|
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
19
|
|
|
3
|
|
|
|
|
84
|
|
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
121
|
|
3
|
3
|
|
|
3
|
|
14
|
use parent 'DTL::Fast::Filter'; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
15
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$DTL::Fast::FILTER_HANDLERS{'reverse'} = __PACKAGE__; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
#@Overrde |
8
|
|
|
|
|
|
|
sub filter |
9
|
|
|
|
|
|
|
{ |
10
|
3
|
|
|
3
|
0
|
6
|
my( $self, $filter_manager, $value, $context ) = @_; |
11
|
3
|
|
|
|
|
5
|
my $result; |
12
|
|
|
|
|
|
|
|
13
|
3
|
|
|
|
|
5
|
my $value_type = ref $value; |
14
|
|
|
|
|
|
|
|
15
|
3
|
100
|
|
|
|
14
|
if( $value_type eq 'ARRAY' ) |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
16
|
|
|
|
|
|
|
{ |
17
|
2
|
|
|
|
|
7
|
$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
|
|
|
|
|
10
|
$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
|
|
|
|
|
12
|
return $result; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |