line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Filter::Split; |
2
|
2
|
|
|
2
|
|
2196
|
use strict; use utf8; use warnings FATAL => 'all'; |
|
2
|
|
|
2
|
|
3
|
|
|
2
|
|
|
2
|
|
49
|
|
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
49
|
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
74
|
|
3
|
2
|
|
|
2
|
|
9
|
use parent 'DTL::Fast::Filter'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
13
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$DTL::Fast::FILTER_HANDLERS{'split'} = __PACKAGE__; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
#@Override |
8
|
|
|
|
|
|
|
sub parse_parameters |
9
|
|
|
|
|
|
|
{ |
10
|
1
|
|
|
1
|
0
|
2
|
my $self = shift; |
11
|
|
|
|
|
|
|
die $self->get_parse_error("no split pattern specified") |
12
|
1
|
50
|
|
|
|
2
|
if not scalar @{$self->{'parameter'}}; |
|
1
|
|
|
|
|
4
|
|
13
|
1
|
|
|
|
|
2
|
$self->{'pattern'} = $self->{'parameter'}->[0]; |
14
|
1
|
|
|
|
|
4
|
return $self; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
#@Override |
18
|
|
|
|
|
|
|
sub filter |
19
|
|
|
|
|
|
|
{ |
20
|
1
|
|
|
1
|
0
|
3
|
my($self, $filter_manager, $value, $context ) = @_; |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
10
|
my $pattern = $self->{'pattern'}->render($context); |
23
|
|
|
|
|
|
|
|
24
|
1
|
50
|
|
|
|
5
|
die $self->get_render_error("splitting pattern must be defined and not empty") |
25
|
|
|
|
|
|
|
if not $pattern; |
26
|
|
|
|
|
|
|
|
27
|
1
|
|
50
|
|
|
17
|
$value = [split /$pattern/si, $value // '']; |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
4
|
return $value; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |