| 1 | package DTL::Fast::Filter::Split; | ||||||||||||
| 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{'split'} = __PACKAGE__; | |||||||||||
| 6 | |||||||||||||
| 7 | #@Override | ||||||||||||
| 8 | sub parse_parameters | ||||||||||||
| 9 | { | ||||||||||||
| 10 | 1 | ▶ | my $self = shift; | ||||||||||
|
Subroutine
parse_parameters: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||
| 11 | die $self->get_parse_error("no split pattern specified") | ||||||||||||
| 12 | 1 | ▶ | if not scalar @{$self->{'parameter'}}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 13 | 1 | $self->{'pattern'} = $self->{'parameter'}->[0]; | |||||||||||
| 14 | 1 | return $self; | |||||||||||
| 15 | } | ||||||||||||
| 16 | |||||||||||||
| 17 | #@Override | ||||||||||||
| 18 | sub filter | ||||||||||||
| 19 | { | ||||||||||||
| 20 | 1 | ▶ | my($self, $filter_manager, $value, $context ) = @_; | ||||||||||
|
Subroutine
filter: called CC=3 SCAR=11.3
Pod
undocumented
| |||||||||||||
| 21 | |||||||||||||
| 22 | 1 | my $pattern = $self->{'pattern'}->render($context); | |||||||||||
| 23 | |||||||||||||
| 24 | 1 | ▶ | die $self->get_render_error("splitting pattern must be defined and not empty") | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 25 | if not $pattern; | ||||||||||||
| 26 | |||||||||||||
| 27 | 1 | ▶ | $value = [split /$pattern/si, $value // '']; | ||||||||||
|
Condition50%1/2
$value // ""
MC/DC0%0/1
$value // ""
$value
Truth table50%1/2
A
A= $value
| |||||||||||||
| 28 | |||||||||||||
| 29 | 1 | return $value; | |||||||||||
| 30 | } | ||||||||||||
| 31 | |||||||||||||
| 32 | 2 | 1; | |||||||||||