Branch Coverage

blib/lib/Mail/Digest/Tools.pm
Criterion Covered Total %
branch 166 422 39.3


line true false branch
32 0 6 unless -d ${$config_out_ref;}{'dir_digest'}
34 0 6 unless -d ${$config_out_ref;}{'dir_threads'}
36 0 6 if ${$config_out_ref;}{'thread_msg_delimiter'} =~ /\\[^n]|\\$/
92 0 2 unless chdir $dir_threads
93 0 2 unless opendir DIR, $dir_threads
95 0 2 unless closedir DIR
100 4 0 if ($date_threshold < $mtime)
106 16 16 if ($ln =~ /^Message: ([\d_]+)$/)
115 4 2 if ($msgids[$el] lt $msgids[$el - 1])
120 4 0 if ($need_resort_flag)
122 0 4 unless open OUT, ">$out"
126 0 4 unless close OUT
127 0 4 unless rename $out, $in
132 2 0 if (@resorted_threadfiles)
142 0 0 defined $_[0] ? :
147 0 0 unless chdir $dir_threads
148 0 0 unless opendir DIR, $dir_threads
150 0 0 unless closedir DIR
157 0 0 if (@{$v;} > 1)
167 0 0 if ($selection eq 'YES') { }
177 0 0 unless ($consolcount)
196 4 0 unless ($in =~ /^$dir_threads/)
204 9 9 if ($ln =~ /^Message: ([\d_]+)$/)
205 0 9 if exists $messages{$1}
217 0 2 unless open OUT, ">$out"
221 0 2 unless close OUT
223 0 4 unless rename $_, $_ . '.DELETABLE'
225 0 2 unless rename $out, $first_in_thread
234 0 2 unless chdir $dir_threads
235 0 2 unless opendir DIR, $dir_threads
237 0 2 unless closedir DIR
240 0 4 unless unlink $_
285 0 0 if ($choice eq 'ALL') { }
295 0 0 if ($choice eq $confirm) { }
343 2 0 defined ${$config_out_ref;}{'archive_kill_days'} ? :
346 0 2 unless chdir $dir_threads
347 0 2 unless opendir THR, $dir_threads
349 6 0 unless $thr =~ /\.thr\.txt$/ and -f $thr
350 0 0 if ($trigger == 0) { }
353 0 0 -M $thr <= $threshold ? :
358 0 2 unless closedir THR
359 0 2 if $trigger == 0
360 2 0 if ($trigger == 1) { }
0 0 elsif ($trigger == -1) { }
374 2 0 defined ${$config_out_ref;}{'archived_today'} ? :
377 0 2 unless -d $dir_archive_top
379 0 52 unless -d "$dir_archive_top/$_"
381 0 2 unless -d "$dir_archive_top/other"
383 0 2 unless open ARCH, ">$archfile"
393 0 0 if ($initial =~ /[a-zA-Z]/) { }
394 0 0 unless rename $thr, "$dir_archive_top/$initial/$thr"
396 0 0 unless rename $thr, "$dir_archive_top/other/$thr"
399 0 0 if $toarchive % 100 == 0
402 0 2 $toarchive ? :
403 0 2 unless close ARCH
410 0 0 defined ${$config_out_ref;}{'deleted_today'} ? :
412 0 0 unless open KILL, ">$killfile"
421 0 0 unless unlink $thr
423 0 0 if $tokill % 100 == 0
426 0 0 $tokill ? :
427 0 0 unless close KILL
432 0 4 unless opendir DIR, ${$config_out_ref;}{'dir_digest'}
437 0 4 unless closedir DIR
460 2 3 if (defined $2) { }
3 0 elsif (defined $1 and not defined $2) { }
461 1 1 unless $2 == $dig_number
465 2 1 unless $1 == $dig_number
472 2 0 if (defined $hit) { }
487 2 0 defined ${$config_out_ref;}{'digests_read'} ? :
493 0 2 unless open LOG, $logfile
499 0 2 unless close LOG
503 5 0 if (not exists $hashlog{$_}) { }
510 0 0 if ($choice eq 'ALL') { }
511 0 0 unless chdir $dir_threads
513 0 0 unless opendir THREADS, $dir_threads
515 0 0 unless $thrfile =~ /\.thr\.txt$/
518 0 0 unless closedir THREADS
519 0 0 unless chdir $dir_digest
533 2 0 if ${$config_out_ref;}{'digests_read_flag'}
546 0 2 unless open LOG, ">$logfile"
548 0 2 unless close LOG
562 0 2 unless open READ, ">$readfile"
564 0 2 unless close READ
574 0 2 if defined ${$config_in_ref;}{'subject_constant'}
580 0 2 if defined ${$config_out_ref;}{'optional_fields'}
582 2 0 if defined ${$config_out_ref;}{'MIME_cleanup_log_flag'}
585 2 0 defined $recentref ? :
586 0 2 if (defined $optional_fields_ref)
590 0 0 if (defined ${$config_in_ref;}{$longkey}) { }
591 0 0 unless ${$config_in_ref;}{$longkey} =~ /\^(.*?):/
608 1 1 if ($MIME_cleanup_flag)
610 1 0 defined ${$config_out_ref;}{'mimelog'} ? :
612 1 0 if ($MIME_cleanup_log_flag)
613 0 1 unless open MIME, ">$mimelog"
620 0 2 unless chdir $dir_digest
625 0 5 unless open IN, $file
630 0 5 unless close IN
632 5 0 if ($bigstr =~ /(.*?)$post_topics_delimiter(.*)/s) { }
692 1 1 if ($MIME_cleanup_log_flag)
693 0 1 unless close MIME, ">$mimelog"
699 2 0 if ($archive_kill_trigger == 0 or $archive_kill_trigger = -1) { }
0 0 elsif ($archive_kill_trigger == 1) { }
701 0 11 unless open NOARCH, ">>$_"
703 0 11 unless close NOARCH
708 0 0 defined ${$config_out_ref;}{'de_archived_today'} ? :
712 0 0 unless open DEARCH, ">$dearchfile"
728 0 0 if ($_ =~ m([/\\]([^/\\]*)$)) { }
733 0 0 if ($recent{$stub}) { }
734 0 0 unless open OUT2, ">>$_"
739 0 0 if ($initial =~ /[a-zA-Z]/ and -f "$dir_archive_top/$initial/$stub") { }
0 0 elsif (-f "$dir_archive_top/other/$stub") { }
741 0 0 unless rename "$dir_archive_top/$initial/$stub", $newstub
746 0 0 unless open OUT2, ">>$newstub"
749 0 0 unless rename "$dir_archive_top/other/$stub", $newstub
754 0 0 unless open OUT2, ">>$newstub"
757 0 0 unless open OUT2, ">$_"
761 0 0 unless close OUT2
764 0 0 $fromarchive ? :
765 0 0 unless close DEARCH
779 0 2 if defined ${$config_in_ref;}{'subject_constant'}
782 0 2 unless chdir $dir_digest
787 0 2 unless open IN, $digest_verified
793 0 2 unless close IN
795 2 0 if ($bigstr =~ /(.*?)$post_topics_delimiter(.*)/s) { }
810 15 2 unless ${$header_ref;}{'message_no'} == $dig_entry
829 0 2 unless open REPLY, ">$replyfile"
830 0 2 if (defined ${$header_ref;}{'reply_to'}) { }
1 1 elsif (defined ${$header_ref;}{'to'}) { }
837 2 0 if (defined ${$header_ref;}{'subject'})
839 2 0 if (${$header_ref;}{'subject'} =~ /^(?:(Re2?|RE2?|re2?|FWD?|Fwd?|AW):?\s+)*(.*)$/) { }
851 0 2 unless close REPLY
864 5 133 if (/^$topics_intro/)
867 79 59 if ($counter == 1)
868 10 69 if (/^$topics_intro|^$/) { }
69 0 elsif (not $_ =~ /$delimiter_core/) { }
887 60 311 if $hl =~ /^\s*$/
892 360 480 unless $key =~ /_style_flag$/
894 480 0 if ($key =~ /(.*)_style_flag$/) { }
899 116 364 unless defined ${$config_in_ref;}{$key}
904 60 251 unless ($init{'message'})
905 60 0 if (/${$config_in_ref;}{'message_style_flag'}/)
913 173 138 unless ($init{'from'})
914 60 113 if (/${$config_in_ref;}{'from_style_flag'}/)
921 260 51 unless ($init{'subject'})
922 60 200 if (/${$config_in_ref;}{'subject_style_flag'}/)
929 125 186 unless ($init{'to'})
930 31 94 if (/${$config_in_ref;}{'to_style_flag'}/)
937 163 148 unless ($init{'reply_to'})
938 8 155 if (/${$config_in_ref;}{'reply_to_style_flag'}/)
945 169 142 unless ($init{'cc'})
946 17 152 if (/${$config_in_ref;}{'cc_style_flag'}/i)
953 195 116 unless ($init{'date'})
954 60 135 if (/${$config_in_ref;}{'date_style_flag'}/)
961 195 116 unless ($init{'org'})
962 0 195 if (/${$config_in_ref;}{'org_style_flag'}/)
969 15 296 unless ($matched)
970 15 0 if ($last_analyzed ne 'subject')
981 0 45 if defined $_[0]
983 0 45 unless $subj
988 0 45 if (defined $subject_constant and $thread =~ /^$subject_constant\s+(.*)/)
992 0 45 if ($^O eq 'MSWin32')
995 45 0 if ($unix{$^O})
1007 0 45 unless $thread
1014 27 18 unless $MIME_cleanup_flag
1017 0 18 if ($chunks[1] =~ m[Content-Type:\smultipart/alternative]o) { }
0 18 elsif ($chunks[1] =~ /--Apple-Mail-/o) { }
18 0 elsif (not $chunks[1] =~ /^This.+?message.+?MIME format/o) { }
1020 0 0 if $chunks[$i] =~ /Content-Type:/
1022 0 0 if (@nextparts == 4) { }
1023 0 0 if $MIME_cleanup_log_flag
1028 0 0 if $MIME_cleanup_log_flag
1035 0 0 if $chunks[$i] =~ /--Apple-Mail-/o
1037 0 0 if (@nextparts == 3 or @nextparts == 4) { }
1038 0 0 if $MIME_cleanup_log_flag
1040 0 0 if (@nextparts == 4)
1043 0 0 if ($chunks[$nextparts[1]] =~ /(.*?)--Apple-Mail-/so)
1047 0 0 if $fragment
1051 0 0 if $MIME_cleanup_log_flag
1059 0 0 if ($chunks[1] =~ /--=_alternative/) { }
0 0 elsif ($chunks[1] =~ /cryptographically\ssigned/) { }
1061 0 0 if $chunks[$i] =~ /--=_alternative/
1063 0 0 if (@nextparts == 3) { }
1064 0 0 if $MIME_cleanup_log_flag
1073 0 0 if $MIME_cleanup_log_flag
1079 0 0 if $MIME_cleanup_log_flag
1085 0 0 if $chunks[$i] =~ /-{4,6}[_\s]?=_NextPart| --Boundary_| --------------InterScan_NT_MIME_Boundary/x
1091 0 0 if (@nextparts == 3) { }
0 0 elsif (@nextparts == 1) { }
0 0 elsif (@nextparts == 5 or @nextparts == 6) { }
0 0 elsif (@nextparts == 7 or @nextparts == 8) { }
1092 0 0 if $MIME_cleanup_log_flag
1097 0 0 if $MIME_cleanup_log_flag
1101 0 0 if $MIME_cleanup_log_flag
1106 0 0 if $MIME_cleanup_log_flag
1111 0 0 if $MIME_cleanup_log_flag
1126 41 2 if defined $output_ref
1129 0 43 $^O eq 'MSWin32' ? :
1137 0 0 unless defined $messages{$_}[2]{$opt_fields{$i}[0]}
1144 43 0 if defined $thread_msg_delimiter
1154 2 0 defined ${$config_out_ref;}{'todays_topics'} ? :
1157 0 2 if ($choice eq 'ALL') { }
1165 0 0 unless open TOPICS, ">$topicsfile"
1168 0 0 unless close TOPICS
1177 0 2 unless open TOPICS, ">>$topicsfile"
1180 0 2 unless close TOPICS
1205 0 2 unless exists ${$dateref;}{'year'} and exists ${$dateref;}{'month'} and exists ${$dateref;}{'day'}
1208 0 2 unless 1900 <= ${$dateref;}{'year'}
1212 0 2 unless 1 <= ${$dateref;}{'month'} and ${$dateref;}{'month'} <= 12
1240 0 0 unless ${$dateref;}{'day'} >= 1 and ${$dateref;}{'day'} <= 28 or $month31{${$dateref;}{'month'}} and ${$dateref;}{'day'} >= 29 and ${$dateref;}{'day'} <= 31 or $month30{${$dateref;}{'month'}} and ${$dateref;}{'day'} >= 29 and ${$dateref;}{'day'} <= 30 or ${$dateref;}{'month'} == 2 and ${$dateref;}{'day'} == 29 and ${$dateref;}{'year'} % 400 == 0 || ${$dateref;}{'year'} % 100 != 0 && ${$dateref;}{'year'} % 4 == 0
1256 0 8 unless open $fh, $in
1261 0 8 unless close $fh