Karmasphere/Parser/Simple/List.pm

filter: Statementstmt 93.3% 28 / 30 Branchbran 57.1% 8 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 80.3% 41 / 51 CC 8 SCAR 13.3
CC
8
Cov
82%
new
5.6
_parse
4.0
_type
2.0
CRAP 3.8
« Karmasphere/Parser/RBL/Base.pm ↑ Summary Karmasphere/Parser/Score/Base.pm »
1 package Mail::Karmasphere::Parser::Simple::List;
2  
3 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 5 ▶use base 'Mail::Karmasphere::Parser::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 ▶sub new {
Subroutine new: called CC=5 SCAR=17.3
Pod undocumented
8 4 my $class = shift;
9 # print STDERR "new: \$class = $class\n";
10 # print STDERR "new: \$class->_streams() = @{[$class->_streams()]}\n";;
11 0 ▶ my $self = ($#_ == 0) ? { %{ (shift) } } : { @_ };
Branch: 1 branch
BranchTrueFalseTotal
$#_ == 0 ? : 0 4 4
12 4 ▶ unless (exists $self->{Streams}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Streams"}) 4 0 4
13 4 ▶ $self->{Type} = $class->_type() unless $self->{Type};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"Type"} 4 0 4
14 4 $self->{Streams} = [ $class->_streams() ];
15 }
16 4 $self = $class->SUPER::new($self);
17 4 ▶ $self->{Value} = 1000 unless exists $self->{Value};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"Value"} 0 4 4
18 4 return $self;
19 }
20  
21 35 ▶sub _parse {
Subroutine _parse: called CC=4 SCAR=13.9
22 35 my $self = shift;
23 35 for (;;) {
24 35 my $line = $self->fh->getline;
25 35 ▶ return undef unless $line;
Branch: 1 branch
BranchTrueFalseTotal
unless $line 4 31 35
26 31 ▶ next if $line =~ /^#/;
Branch: 1 branch
BranchTrueFalseTotal
if $line =~ /^#/ 0 31 31
27 31 ▶ next unless $line =~ /\S/;
Branch: 1 branch
BranchTrueFalseTotal
unless $line =~ /\S/ 0 31 31
28 31 chomp($line); $line =~ s/\r$//g; # strip trailing CRLF
29 31 $line =~ s/[\s;].+$//;
30 return new Mail::Karmasphere::Parser::Record(
31 s => 0,
32 i => $line,
33 v => $self->{Value},
34 31 );
35 }
36 }
37  
38 0 ▶sub _type { "Parser::Simple::* subclass must define _type()" }
Subroutine _type: not called CC=1 SCAR=6.9
39  
40 5 1;
« Karmasphere/Parser/RBL/Base.pm ↑ Summary Karmasphere/Parser/Score/Base.pm »