Mail-Digest-Tools
view release on metacpan or search on metacpan
$pbml_tp[1] => [ 1, [ 7 ] ],
$pbml_tp[2] => [ 4, [ 3, 4, 2, 18 ] ],
$pbml_tp[3] => [ 2, [ 3, 6 ] ],
$pbml_tp[4] => [ 3, [ 6, 5, 4 ] ],
$pbml_tp[5] => [ 4, [ 5, 15, 5, 8 ] ],
$pbml_tp[6] => [ 6, [ 3, 12, 5, 8, 4, 3 ] ],
$pbml_tp[7] => [ 3, [ 5, 2, 2 ] ],
);
# predict message numbers found within each thread file created
# (by observation)
my %pbml_messp = (
$pbml_tp[0] => [ qw|
00001_0009
00001_0010
00001_0011
| ],
$pbml_tp[1] => [ qw|
00001_0001
| ],
$pbml_tp[2] => [ qw|
00002_0005
00002_0006
00002_0008
00003_0004
| ],
$pbml_tp[3] => [ qw|
00002_0007
00003_0001
| ],
$pbml_tp[4] => [ qw|
00002_0001
00002_0002
00002_0003
| ],
$pbml_tp[5] => [ qw|
00001_0002
00001_0003
00001_0004
00001_0006
| ],
$pbml_tp[6] => [ qw|
00001_0005
00001_0007
00001_0008
00002_0004
00003_0002
00003_0007
| ],
$pbml_tp[7] => [ qw|
00003_0003
00003_0005
00003_0006
| ],
);
# determine number of digests needing processing
opendir DIG, $pbml_digdir or die "Couldn't open directory $pbml_digdir: $!";
$log{'digs'} = scalar(
grep { /$pbml_config_in{'grep_formula'}/ } readdir DIG);
closedir DIG or die "Couldn't close directory $pbml_digdir: $!";
ok($log{'digs'} == 3, '3 pbml digests found before processing'); # 3
# verify log files are empty or do not yet exist
my $dl = $pbml_config_out{'digests_log'};
my $dr = $pbml_config_out{'digests_read'};
my $drf = $pbml_config_out{'digests_read_flag'};
my $tt = $pbml_config_out{'todays_topics'};
$log{'log'}{'size'}[0] = (-f $dl) ? (-s $dl) : 0;
$log{'read'}{'size'}[0] = ( (-f $dr) and $drf) ? (-s $dr) : undef;
$log{'topics'}{'size'}[0] = (-f $tt) ? (-s $tt) : 0;
$log{'log'}{'records'}[0] = (-f $dl) ? count_records($dl, "\n") : 0;
$log{'read'}{'records'}[0] = ((-f $dr) and $drf) ? count_records($dr, "\n\n") : 0;
$log{'topics'}{'records'}[0] = (-f $tt) ? count_records($tt, "\n\n") : 0;
ok($log{'log'}{'records'}[0] == 0, 'digests_log currently empty'); # 4
ok($log{'read'}{'records'}[0] == 0, 'digests_read currently empty'); # 5
ok($log{'topics'}{'records'}[0] == 0, 'todays_topics currently empty'); # 6
# run Mail::Digest::tools function
process_new_digests(\%pbml_config_in, \%pbml_config_out);
# test whether log files have grown in size
$log{'log'}{'size'}[1] = (-s $dl);
$log{'read'}{'size'}[1] = ( (-f $dr) and $drf) ? (-s $dr) : undef;
$log{'topics'}{'size'}[1] = (-s $tt);
ok($log{'log'}{'size'}[1] > $log{'log'}{'size'}[0], # 7
'digests_log for pbml has grown');
ok( # 8
(
(
! defined $log{'read'}{'size'}[0]
and
! defined $log{'read'}{'size'}[1]
)
or
(
(
defined $log{'read'}{'size'}[0]
and
defined $log{'read'}{'size'}[1]
)
and
(
$log{'read'}{'size'}[1] > $log{'read'}{'size'}[0]
)
)
), 'digests_read for pbml has grown'
);
ok($log{'topics'}{'size'}[1] > $log{'topics'}{'size'}[0],# 9
'todays_topics for pbml has grown');
# test whether log files have grown by correct number of records
( run in 0.636 second using v1.01-cache-2.11-cpan-39bf76dae61 )