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