Stats.pm

filter: Statementstmt 46.5% 20 / 43 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 1 totaltotal 38.8% 26 / 67 CC 8 SCAR 37.3
CC
8
Cov
36%
newmail
72.0
BEGIN
1.0
BEGIN
1.0
CRAP 41.6
« Stats/Parser.pm ↑ Summary Stats/Config.pm »
1 package Mail::Stats;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Mail::Stats::Record;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Mail::Stats::Parser;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Mail::Stats::Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 $VERSION = '0.02';
12  
13 0 ▶sub newmail {
Subroutine newmail: not called CC=8 SCAR=42.8
Pod undocumented
14 0 my $cfg = shift;
15 0 my $c = new Mail::Stats::Config($cfg);
16
17 0 ▶ if(!defined($c->{sort}) or scalar(@{$c->{mboxen}}) < 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $c->{"sort"} or scalar @{$c->{"mboxen"};} < 1) 0 0 0
Condition0%0/3
not defined $c->{"sort"} or scalar @{$c->{"mboxen"};} < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $c->{"sort"} or scalar @{$c->{"mboxen"};} < 1
not defined $c->{"sort"} scalar @{$c->{"mboxen"};} < 1
Truth table0%0/3
not(A) or B
A= not defined $c->{"sort"}B= scalar @{$c->{"mboxen"};} < 1
ABresult
1X1
011
000
18 0 return undef;
19 }
20  
21 0 my $hash;
22
23 0 for my $mbox (@{$c->{mboxen}}) {
24 0 ▶ open(IN,$mbox) or croak("$0: could not open file $mbox - $!\n");
Branch: 1 branch
BranchTrueFalseTotal
open IN, $mbox or croak("$0: could not open file $mbox - $!\n") 0 0 0
25 0 $hash->{$mbox} = Mail::Stats::Parser::parse(\*IN);
26 0 close(IN);
27 }
28
29 0 for my $mbox (sort {&{$c->{sort}}($hash)} keys %$hash) {
30 0 my $short = $mbox;
31 0 my $count = $hash->{$mbox}->num_unread();
32 0 ▶ if($c->{showall} or $count) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c->{"showall"} or $count) 0 0 0
Condition0%0/3
$c->{"showall"} or $count
l!l&&r!l&&!r
000
MC/DC0%0/2
$c->{"showall"} or $count
$c->{"showall"} $count
Truth table0%0/3
A or B
A= $c->{"showall"}B= $count
ABresult
1X1
011
000
33 0 $short =~ s/.*\///;
34 0 my $message = $c->{message};
35 0 $message =~ s/%% mbox %%/$short/;
36 0 $message =~ s/%% count %%/$count/;
37 0 print $message;
38 }
39 }
40  
41 0 return 1;
42 # print STDERR Dumper($hash);
43 }
44  
45 1 1;
46 __END__
« Stats/Parser.pm ↑ Summary Stats/Config.pm »