| 1 | package DTL::Fast::Filter::Yesno; | ||||||||||||||
| 2 | 2 | ▶ | use strict; use utf8; use warnings FATAL => 'all'; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 3 | 2 | ▶ | use parent 'DTL::Fast::Filter'; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | |||||||||||||||
| 5 | 2 | $DTL::Fast::FILTER_HANDLERS{'yesno'} = __PACKAGE__; | |||||||||||||
| 6 | |||||||||||||||
| 7 | #@Override | ||||||||||||||
| 8 | sub parse_parameters | ||||||||||||||
| 9 | { | ||||||||||||||
| 10 | 10 | ▶ | my $self = shift; | ||||||||||||
|
Subroutine
parse_parameters: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 11 | 5 | push @{$self->{'parameter'}}, DTL::Fast::Variable->new('"yes,no,maybe"') | |||||||||||||
| 12 | 10 | ▶ | if not scalar @{$self->{'parameter'}}; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 13 | 10 | $self->{'mappings'} = $self->{'parameter'}->[0]; | |||||||||||||
| 14 | 10 | return $self; | |||||||||||||
| 15 | } | ||||||||||||||
| 16 | |||||||||||||||
| 17 | |||||||||||||||
| 18 | #@Override | ||||||||||||||
| 19 | sub filter | ||||||||||||||
| 20 | { | ||||||||||||||
| 21 | 10 | ▶ | my $self = shift; # self | ||||||||||||
|
Subroutine
filter: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||
| 22 | 10 | shift; # filter_manager | |||||||||||||
| 23 | 10 | my $value = shift; | |||||||||||||
| 24 | 10 | my $context = shift; # context | |||||||||||||
| 25 | |||||||||||||||
| 26 | 10 | my @mappings = split /\s*,\s*/s, $self->{'mappings'}->render($context); | |||||||||||||
| 27 | |||||||||||||||
| 28 | 10 | ▶ | return $value ? | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 29 | $mappings[0] | ||||||||||||||
| 30 | : defined $value ? | ||||||||||||||
| 31 | $mappings[1] | ||||||||||||||
| 32 | : $mappings[2]; | ||||||||||||||
| 33 | } | ||||||||||||||
| 34 | |||||||||||||||
| 35 | 2 | 1; | |||||||||||||