line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::Stats; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
537
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
4
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
47
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
100
|
|
7
|
1
|
|
|
1
|
|
467
|
use Mail::Stats::Record; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
8
|
1
|
|
|
1
|
|
476
|
use Mail::Stats::Parser; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
9
|
1
|
|
|
1
|
|
439
|
use Mail::Stats::Config; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
342
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
$VERSION = '0.02'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub newmail { |
14
|
0
|
|
|
0
|
0
|
|
my $cfg = shift; |
15
|
0
|
|
|
|
|
|
my $c = new Mail::Stats::Config($cfg); |
16
|
|
|
|
|
|
|
|
17
|
0
|
0
|
0
|
|
|
|
if(!defined($c->{sort}) or scalar(@{$c->{mboxen}}) < 1) { |
|
0
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
return undef; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
my $hash; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
for my $mbox (@{$c->{mboxen}}) { |
|
0
|
|
|
|
|
|
|
24
|
0
|
0
|
|
|
|
|
open(IN,$mbox) or croak("$0: could not open file $mbox - $!\n"); |
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) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
my $short = $mbox; |
31
|
0
|
|
|
|
|
|
my $count = $hash->{$mbox}->num_unread(); |
32
|
0
|
0
|
0
|
|
|
|
if($c->{showall} or $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; |
46
|
|
|
|
|
|
|
__END__ |