| 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
Condition0%0/3
not defined $c->{"sort"} or scalar @{$c->{"mboxen"};} < 1
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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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
Condition0%0/3
$c->{"showall"} or $count
MC/DC0%0/2
$c->{"showall"} or $count
$c->{"showall"}
$count
Truth table0%0/3
A or B
A= $c->{"showall"}B= $count
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||