line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Filter::Lengthis; |
2
|
2
|
|
|
2
|
|
766
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
46
|
|
3
|
2
|
|
|
2
|
|
7
|
use utf8; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
8
|
|
4
|
2
|
|
|
2
|
|
39
|
use warnings FATAL => 'all'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
54
|
|
5
|
2
|
|
|
2
|
|
8
|
use parent 'DTL::Fast::Filter::Length'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
9
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$DTL::Fast::FILTER_HANDLERS{length_is} = __PACKAGE__; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#@Override |
11
|
|
|
|
|
|
|
sub parse_parameters |
12
|
|
|
|
|
|
|
{ |
13
|
4
|
|
|
4
|
0
|
7
|
my $self = shift; |
14
|
|
|
|
|
|
|
die $self->get_parse_error("no length value specified") |
15
|
4
|
50
|
|
|
|
5
|
if (not scalar @{$self->{parameter}}); |
|
4
|
|
|
|
|
11
|
|
16
|
4
|
|
|
|
|
7
|
$self->{length} = $self->{parameter}->[0]; |
17
|
4
|
|
|
|
|
12
|
return $self; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#@Override |
21
|
|
|
|
|
|
|
sub filter |
22
|
|
|
|
|
|
|
{ |
23
|
4
|
|
|
4
|
0
|
8
|
my ( $self, $filter_manager, $value, $context ) = @_; |
24
|
|
|
|
|
|
|
|
25
|
4
|
|
|
|
|
17
|
my $length = $self->SUPER::filter($filter_manager, $value, $context); |
26
|
4
|
100
|
|
|
|
13
|
return $length == $self->{length}->render($context) ? |
27
|
|
|
|
|
|
|
1 |
28
|
|
|
|
|
|
|
: 0; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |