Branch Coverage

blib/lib/Mail/Audit.pm
Criterion Covered Total %
branch 91 200 45.5


line true false branch
30 0 0 if $@
41 0 23 if (ref $$arg[0] eq 'HASH') { }
13 10 elsif (ref $$arg[-1] eq 'HASH') { }
42 0 0 unless @$arg == 1
62 9 0 exists $opts{'data'} ? :
68 9 0 unless ($opts{'no_log'})
70 3 6 exists $opts{'loglevel'} ? :
72 9 0 exists $opts{'log'} ? :
80 7 2 if ($$log{'file'} and open $output_fh, '>>', $$log{'file'}) { }
83 0 2 if $$log{'file'}
102 1 8 if ($opts{'alwaysmime'} or &$mime_test($self))
103 1 0 if (not $opts{'nomime'}) { }
111 0 1 if $@
131 1 0 if exists $$self{'_audit_opts'}{'emergency'}
139 0 0 if exists $$self{'_default_mbox'}
145 0 0 if $default_mbox
164 5 0 if exists $$self{'_audit_opts'}{'_exit'}
178 1 5 if (exists $$local_opts{$opt} && $$local_opts{$opt} || $$self{'_audit_opts'}{$opt} and grep {index($_, '%') >= 0;} @out)
197 4 2 unless defined $user and defined $rest
198 0 2 length $user ? :
209 1 4 if exists $$self{'_audit_opts'}{'accept'}
214 0 4 unless @files
250 8 4 unless @{$accept_types{$accept_type};}
259 3 1 if ((my $success_count = @actually_saved_to_files) > 0) { }
263 1 2 unless (exists $$local_opts{'noexit'} and $$local_opts{'noexit'} or $$self{'_audit_opts'}{'noexit'})
273 0 1 if (not defined $emergency) { }
281 0 1 if (grep {$emergency eq $_;} @files) { }
282 0 0 if (@files == 1) { }
295 0 1 if (not @actually_saved_to_files) { }
316 0 5 if $file =~ m[/\z]
317 0 5 if $file =~ m[/\.\z]
318 4 1 if -d $file
330 1 0 if (my $mkdir_error = $self->_mkdir_p(File::Basename::dirname($file)))
336 0 0 if (not $error) { }
347 0 4 unless defined $$write_opts{'need_from'}
348 0 4 unless defined $$write_opts{'need_lock'}
349 4 0 unless defined $$write_opts{'extra_newline'}
355 0 4 unless (open $fh, ">>$file")
357 0 4 if ($$write_opts{'need_lock'})
359 0 0 if $lock_error
363 0 4 if (not $$write_opts{'need_from'} and $self->head->header->[0] =~ /^From\s/)
370 0 4 if ($$write_opts{'need_from'} and not $self->head->header->[0] =~ /^From\s/)
372 0 0 if (exists $ENV{'UFLINE'}) { }
386 0 0 if $from =~ /<(.*?)>/
398 0 4 if ($$write_opts{'need_from'}) { }
407 0 4 if $$write_opts{'extra_newline'}
409 0 4 if ($$write_opts{'need_lock'})
410 0 0 unless flock $fh, 8
413 0 4 unless close $fh
437 0 4 exists $$local_opts{'one_for_all'} ? :
446 2 2 unless (length $self->get('Lines'))
448 2 0 if @lines == 1 and ref $lines[0] eq 'ARRAY'
454 2 2 if ($maildir_time != time) { }
470 0 4 $$local_opts{'one_for_all'} ? :
483 0 4 $$local_opts{'one_for_all'} ? :
0 4 if (my $mkdir_error = $self->_mkdir_p($$local_opts{'one_for_all'} ? $file : map({"$file/$_";} 'tmp', 'new', 'cur')))
498 4 0 unless $error
506 0 4 unless ($tmp_path)
515 0 4 $$local_opts{'one_for_all'} ? :
525 0 4 $$local_opts{'one_for_all'} ? :
0 4 if (my $mkdir_error = $self->_mkdir_p($$local_opts{'one_for_all'} ? $file : map({'File::Spec'->catdir($file, $_);} 'tmp', 'new', 'cur')))
539 4 0 if (link $tmp_path, $new_path) { }
543 0 0 if ($! == 18) { }
556 0 4 unless unlink $tmp_path
566 1 3 if exists $$self{'_audit_opts'}{'reject'}
580 0 0 exists $$local_opts{'host'} ? :
0 0 exists $$local_opts{'port'} ? :
0 0 exists $$local_opts{'debug'} ? :
587 0 0 unless (exists $$local_opts{'noexit'} and $$local_opts{'noexit'} or $$self{'_audit_opts'}{'noexit'})
599 0 0 if exists $$self{'_audit_opts'}{'pipe'}
609 0 0 unless (open $pipe, "|$file")
619 0 0 unless (exists $$local_opts{'noexit'} and $$local_opts{'noexit'} or $$self{'_audit_opts'}{'noexit'})
633 1 2 defined $reason ? :
640 1 2 unless exists $$local_opts{'noexit'} and $$local_opts{'noexit'} or $$self{'_audit_opts'}{'noexit'}
665 0 0 if ($self->from_daemon)
666 0 0 unless (defined $reply_opts{'even_if_from_daemon'} and $reply_opts{'even_if_from_daemon'})
674 0 0 if (length $self->get('X-Loop') or length $self->get('X-Loop-Detect'))
684 0 0 unless $rcpt
710 0 0 ref $reply_opts{'references'} ? :
0 0 defined $reply_opts{'references'} ? :
721 0 0 if defined $reply_opts{'from'}
722 0 0 if defined $reply_opts{'cc'}
723 0 0 if defined $reply_opts{'bcc'}
724 0 0 if @references
732 0 0 defined $reply_opts{'body'} ? :
745 0 99 unless $$self{'_log'}
746 64 35 if $$self{'_log'}{'level'} < $priority
752 0 35 unless print {$$self{'_log'}{'fh'};} "$line($subroutine): $what\n"
769 2 45 if (wantarray) { }
775 32 13 defined $string && length $string ? :
786 4 4 $_[1] ? :
803 0 0 if ($head->as_string =~ /(^(Mailing-List: |List-ID: |Precedence:.*(junk|bulk|list) |To:.*Multiple recipients of |(((Resent-)?(From|Sender)|X-Envelope-From):|>?From ) .*?\b (Post(ma?(st(e?r)?|n)|office) |(?-i)Mailer?(?i) |sendmail |daemon |m(mdf|ajordomo) |n?uucp |LIST(SERV|proc) |NETSERV |o(wner|ps) |(?-i)r(e(quest|sponse)|oot)(?i) |b(ounce|bs\.smtp) |mirror |s(erv(ices?|er)|mtp(error)?|ystem) |A(dmin(istrator)?|MMGR|utoanswer) )\@ ))/mix)
842 3 2 if ($header =~ / (^(((Resent-)?(From|Sender) |X-Envelope-From):|>?From ) .*?\b (Post(ma(st(er)?|n)|office) |(?-i)Mailer?(?i) |sendmail |daemon |mmdf |n?uucp |ops |(?-i)r(esponse|oot)(?i) |(bbs\.)?smtp(error)? |s(erv(ices?|er)|ystem)|A(dmin(istrator)?|MMGR) )\@ )/mix)
876 0 0 if (flock $fh, 2) { }
880 0 0 if sleep $_
889 0 19 unless @_
890 0 19 unless length $_[0]
892 25 10 if -d $_
895 0 10 if (my $error = $self->_mkdir_p(File::Basename::dirname($_)))
898 1 9 unless mkdir $_, 493