blib/lib/DTL/Fast/Filter/Cut.pm

filter: Statementstmt 100% 26 / 26 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 2 totaltotal 91.8% 34 / 37 SCAR 6.9
CC
2
Cov
96%
parse_parameters
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
« blib/lib/DTL/Fast/Filter/Removetags.pm ↑ Summary blib/lib/DTL/Fast/Filter/Numberformat.pm »
1 package DTL::Fast::Filter::Cut;
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{'cut'} = __PACKAGE__;
6  
7 2 ▶use DTL::Fast::Variable;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9  
10 #@Override
11 sub parse_parameters
12 {
13 4 ▶ my $self = shift;
Subroutine parse_parameters: called CC=2 SCAR=7.0
Pod undocumented
14 die $self->get_parse_error("no substitute specified for removing")
15 4 ▶ if not scalar @{$self->{'parameter'}};
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @{$self->{"parameter"};} 0 4 4
16 4 $self->{'remove'} = $self->{'parameter'}->[0];
17 4 return $self;
18 }
19  
20 #@Override
21 sub filter
22 {
23 4 ▶ my ($self, $filter_manager, $value, $context) = @_;
Subroutine filter: called CC=1 SCAR=0.0
Pod undocumented
24
25 4 my $remove = $self->{'remove'}->render($context);
26 4 $value =~ s/\Q$remove\E//gs;
27
28 4 return $value;
29 }
30  
31 2 1;
« blib/lib/DTL/Fast/Filter/Removetags.pm ↑ Summary blib/lib/DTL/Fast/Filter/Numberformat.pm »