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