Stats/Parser.pm

filter: Statementstmt 51.8% 14 / 27 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 75.0% 3 / 4 Podpod 0.0% 0 / 1 totaltotal 28.8% 17 / 59 CC 10 SCAR 44.4
CC
10
Cov
29%
parse
110.0
BEGIN
1.0
BEGIN
1.0
CRAP 84.8
↑ Summary Stats.pm »
1 package Mail::Stats::Parser;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Mail::Stats::Record;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use vars qw($Start_Header $Status_Header $Ignore_Header $End_Header);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 $Start_Header = 'From \S+\s+\w\w\w \w\w\w\s+\d+ \d+:\d+:\d+ \d+';
9 1 $Status_Header = '(X-)?Status:';
10 1 $Ignore_Header = 'Subject: DON\'T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA';
11 1 $End_Header = '\s*';
12  
13 0 ▶sub parse {
Subroutine parse: not called CC=10 SCAR=47.0
Pod undocumented
14 0 my $fh = shift;
15  
16 0 my $mail = new Mail::Stats::Record();
17
18 0 my $header = 0;
19  
20 0 ▶ while(<$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 0 0 0
21 0 ▶ if(/^From \S+\s+\w+ \w+\s+\d+ \d+:\d+:\d+ \d+/) {
Branch: 4 branches
BranchTrueFalseTotal
if (/^From \S+\s+\w+ \w+\s+\d+ \d+:\d+:\d+ \d+/) { } 0 0 0
elsif ($header and /^$Mail::Stats::Parser::Status_Header/go) { } 0 0 0
elsif ($header and /^$Mail::Stats::Parser::Ignore_Header/o) { } 0 0 0
elsif ($header and /^$Mail::Stats::Parser::End_Header$/o) { } 0 0 0
22 0 $header = 1;
23 0 $mail->{MESSAGES}++;
24 ▶ } elsif ($header && /^$Status_Header/og) {
Condition0%0/3
$header and /^$Mail::Stats::Parser::Status_Header/go
!ll&&!rl&&r
000
MC/DC0%0/2
$header and /^$Mail::Stats::Parser::Status_Header/go
$header /^$Mail::Stats::Parser::Status_Header/go
Truth table0%0/3
A and B
A= $headerB= /^$Mail::Stats::Parser::Status_Header/go
ABresult
0X0
100
111
25 0 ▶ while(/(\w)/g) {
Branch: 1 branch
BranchTrueFalseTotal
if (/(\w)/g) 0 0 0
26 0 $mail->{STATUS}->{$1}++;
27 }
28 ▶ } elsif ($header && /^$Ignore_Header/o) {
Condition0%0/3
$header and /^$Mail::Stats::Parser::Ignore_Header/o
!ll&&!rl&&r
000
MC/DC0%0/2
$header and /^$Mail::Stats::Parser::Ignore_Header/o
$header /^$Mail::Stats::Parser::Ignore_Header/o
Truth table0%0/3
A and B
A= $headerB= /^$Mail::Stats::Parser::Ignore_Header/o
ABresult
0X0
100
111
29 0 $mail->{MESSAGES}--;
30 0 $header = 0;
31 ▶ } elsif ($header && /^$End_Header$/o) {
Condition0%0/3
$header and /^$Mail::Stats::Parser::End_Header$/o
!ll&&!rl&&r
000
MC/DC0%0/2
$header and /^$Mail::Stats::Parser::End_Header$/o
$header /^$Mail::Stats::Parser::End_Header$/o
Truth table0%0/3
A and B
A= $headerB= /^$Mail::Stats::Parser::End_Header$/o
ABresult
0X0
100
111
32 0 $header = 0;
33 }
34 }
35  
36 0 return $mail;
37 }
38  
39 1 1;
↑ Summary Stats.pm »