line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Filter::Yesno; |
2
|
2
|
|
|
2
|
|
743
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
45
|
|
3
|
2
|
|
|
2
|
|
8
|
use utf8; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
11
|
|
4
|
2
|
|
|
2
|
|
39
|
use warnings FATAL => 'all'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
60
|
|
5
|
2
|
|
|
2
|
|
8
|
use parent 'DTL::Fast::Filter'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
10
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$DTL::Fast::FILTER_HANDLERS{yesno} = __PACKAGE__; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#@Override |
10
|
|
|
|
|
|
|
sub parse_parameters |
11
|
|
|
|
|
|
|
{ |
12
|
10
|
|
|
10
|
0
|
15
|
my $self = shift; |
13
|
5
|
|
|
|
|
18
|
push @{$self->{parameter}}, DTL::Fast::Variable->new('"yes,no,maybe"') |
14
|
10
|
100
|
|
|
|
15
|
if (not scalar @{$self->{parameter}}); |
|
10
|
|
|
|
|
26
|
|
15
|
10
|
|
|
|
|
20
|
$self->{mappings} = $self->{parameter}->[0]; |
16
|
10
|
|
|
|
|
26
|
return $self; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#@Override |
21
|
|
|
|
|
|
|
sub filter |
22
|
|
|
|
|
|
|
{ |
23
|
10
|
|
|
10
|
0
|
16
|
my $self = shift; # self |
24
|
10
|
|
|
|
|
21
|
shift; # filter_manager |
25
|
10
|
|
|
|
|
16
|
my $value = shift; |
26
|
10
|
|
|
|
|
12
|
my $context = shift; # context |
27
|
|
|
|
|
|
|
|
28
|
10
|
|
|
|
|
29
|
my @mappings = split /\s*,\s*/s, $self->{mappings}->render($context); |
29
|
|
|
|
|
|
|
|
30
|
10
|
100
|
|
|
|
50
|
return $value ? |
|
|
100
|
|
|
|
|
|
31
|
|
|
|
|
|
|
$mappings[0] |
32
|
|
|
|
|
|
|
: defined $value ? |
33
|
|
|
|
|
|
|
$mappings[1] |
34
|
|
|
|
|
|
|
: $mappings[2]; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |