line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Filter::Default; |
2
|
5
|
|
|
5
|
|
1945
|
use strict; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
117
|
|
3
|
5
|
|
|
5
|
|
21
|
use utf8; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
25
|
|
4
|
5
|
|
|
5
|
|
102
|
use warnings FATAL => 'all'; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
150
|
|
5
|
5
|
|
|
5
|
|
21
|
use parent 'DTL::Fast::Filter'; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
27
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$DTL::Fast::FILTER_HANDLERS{default} = __PACKAGE__; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#@Override |
10
|
|
|
|
|
|
|
sub parse_parameters |
11
|
|
|
|
|
|
|
{ |
12
|
27
|
|
|
27
|
0
|
44
|
my $self = shift; |
13
|
|
|
|
|
|
|
die $self->get_parse_error("no default value specified") |
14
|
27
|
50
|
|
|
|
42
|
if (not scalar @{$self->{parameter}}); |
|
27
|
|
|
|
|
75
|
|
15
|
27
|
|
|
|
|
53
|
$self->{default} = $self->{parameter}->[0]; |
16
|
27
|
|
|
|
|
74
|
return $self; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
#@Override |
20
|
|
|
|
|
|
|
sub filter |
21
|
|
|
|
|
|
|
{ |
22
|
16
|
|
|
16
|
0
|
33
|
my ($self, $filter_manager, $value, $context) = @_; |
23
|
|
|
|
|
|
|
|
24
|
16
|
|
66
|
|
|
65
|
return $value || $self->{default}->render($context); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |