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