Branch Coverage

blib/lib/POE/Component/Server/SimpleSMTP.pm
Criterion Covered Total %
branch 132 254 51.9


line true false branch
27 6 7 if $opts{'handlers'}
28 7 6 unless $opts{'handlers'} and ref $opts{'handlers'} eq 'ARRAY'
29 12 1 unless $opts{'domains'} and ref $opts{'domains'} eq 'ARRAY'
30 10 3 unless defined $opts{'simple'} and not $opts{'simple'}
31 13 0 unless defined $opts{'handle_connects'} and not $opts{'handle_connects'}
32 13 0 unless defined $opts{'hostname'}
33 13 0 unless $opts{'relay'}
34 12 1 unless $opts{'origin'}
35 13 0 unless $opts{'maxrelay'}
36 0 13 if $opts{'relay_auth'}
37 13 0 unless $opts{'version'}
40 13 0 ref $options eq 'HASH' ? :
72 2 0 if $pause
82 0 1 unless scalar @{$$self{'_mail_queue'};}
85 1 0 if $$_{'uid'} eq $uid
95 0 3 unless $self->_conn_exists($id)
97 1 2 if ($handle and $^O ne 'MSWin32') { }
107 0 12 unless $_[0]{'listener'}
128 0 409 unless $wheel_id and defined $$self{'clients'}{$wheel_id}
136 0 70 unless grep {$_ eq $cmd;} @{$$self{'cmds'};}
142 0 6 unless ref $handler and ref $handler eq 'ARRAY'
146 6 0 if (ref $$handler[$count] and ref $$handler[$count] eq 'HASH') { }
149 0 6 unless $$handler[$count]{'SESSION'}
151 0 6 unless $$handler[$count]{'EVENT'}
153 0 6 unless $$handler[$count]{'MATCH'}
155 0 6 if UNIVERSAL::isa($$handler[$count]{'SESSION'}, 'POE::Session')
159 0 6 if ($@) { }
182 0 13 if ($$self{'alias'}) { }
188 13 0 if ($kernel != $sender)
206 13 0 unless $$self{'resolver'} and $$self{'resolver'}->isa('POE::Component::Client::DNS')
209 1 12 if $$self{'dnsbl_enable'}
225 0 13 if ($$self{'listener'})
229 13 0 defined $$self{'address'} ? :
13 0 defined $$self{'port'} ? :
256 0 12 unless $wheel
284 0 134 unless $self->_conn_exists($id)
286 64 70 if ($$self{'clients'}{$id}{'buffer'})
287 5 59 if ($input eq '.' and $$self{'simple'}) { }
2 57 elsif ($input eq '.' and ref $$self{'clients'}{$id}{'buffer'} eq 'ARRAY') { }
1 56 elsif ($input eq '.') { }
304 50 6 if (ref $$self{'clients'}{$id}{'buffer'} eq 'ARRAY') { }
317 0 70 unless $cmd
318 0 70 unless ($self->_valid_cmd($cmd))
323 8 62 if ($cmd eq 'quit')
334 0 0 unless $self->_conn_exists($id)
342 0 90 unless $self->_conn_exists($id)
343 82 8 unless $$self{'clients'}{$id}{'quit'}
351 0 1 unless $self->_conn_exists($id)
364 13 0 unless $$self{'alias'}
367 1 12 if $$self{'dnsbl_enable'}
374 0 1 unless $self->_conn_exists($id)
388 0 1 unless $$self{'buffers'}{$wheel_id}{'shutdown'}
404 0 0 unless (@events)
412 0 0 unless /^_/
415 0 0 unless ($$self{'sessions'}{$sender_id}{'refcnt'}++ or $session == $sender)
428 0 0 unless (@events)
442 0 0 unless /^_/
444 0 0 unless ($blah)
448 0 0 if (--$$self{'sessions'}{$sender_id}{'refcnt'} <= 0)
450 0 0 unless ($session == $sender)
462 13 0 if (--$$self{'sessions'}{$session_id}{'refcnt'} <= 0)
464 13 0 unless $session_id eq $smtpd_id
495 55 42 if $self->_pluggable_process('SMTPD', $event, \(@args), \@extra_args) == 4
497 0 42 if scalar @extra_args
512 0 90 unless $self->_conn_exists($id)
513 0 90 unless $output
515 0 90 if $self->_pluggable_process('SMTPC', 'response', $id, \$output) == 4
517 0 90 unless $self->_conn_exists($id) and defined $$self{'clients'}{$id}{'wheel'}
526 5 0 if $recipient =~ /$$handler{'RE'}/
533 2 6 if $$self{'paused'}
534 0 6 if $$self{'_smtp_clients'} and $$self{'_smtp_clients'} >= $$self{'maxrelay'}
537 1 5 unless $item
540 0 5 if ($$self{'relay'})
546 5 0 if (my $handler = $self->_check_recipient($recipient))
562 0 0 if $response
570 0 0 unless ($$response{'response'})
571 0 0 if (time - $$item{'ts'} > 345600)
581 0 0 unless scalar @mx
612 0 0 if ($$self{'relay_user'} and $$self{'relay_pass'})
618 0 0 scalar keys %auth ? :
645 0 0 if ($$error{'SMTP_Server_Error'} and $$error{'SMTP_Server_Error'} =~ /^5/)
648 0 0 if (time - $$item{'ts'} > 345600)
660 0 12 unless $$self{'handle_connects'}
661 11 1 if (not $$self{'dnsbl_enable'}) { }
675 0 1 if ($$data{'error'}) { }
680 0 1 if $$data{'response'} ne 'NXDOMAIN'
689 0 0 if $$data{'error'} and $$data{'error'} eq 'NOERROR'
697 3 1 unless $$self{'simple'}
705 0 0 unless $$self{'simple'}
713 3 8 unless $$self{'simple'}
717 0 8 if ($$self{'dnsbl_enable'} and !$$self{'clients'}{$id}{'dnsbl'} || $$self{'clients'}{$id}{'dnsbl'} ne 'NXDOMAIN') { }
0 8 elsif ($$self{'clients'}{$id}{'mail'}) { }
8 0 elsif (my($from) = $args =~ /^from:\s*<(.+)>/i) { }
726 0 8 if ($$self{'sender_verify'})
734 0 0 if $response
738 0 0 unless $args
747 3 12 unless $$self{'simple'}
751 2 10 if (not $$self{'clients'}{$id}{'mail'}) { }
0 10 elsif ($$self{'sender_verify'} and defined $$self{'clients'}{$id}{'fverify'}) { }
10 0 elsif (my($to) = $args =~ /^to:\s*<(.+)>/i) { }
756 0 0 if ($fverify eq 'NXDOMAIN') { }
770 1 9 if (not $self->_recipient_domain($to)) { }
779 0 0 unless $args
788 7 3 unless scalar @{$$self{'domains'};}
791 0 3 unless $hostpart
792 2 1 if grep {uc $_ eq uc $hostpart;} @{$$self{'domains'};}
798 3 5 unless $$self{'simple'}
801 0 5 if (not $$self{'clients'}{$id}{'mail'}) { }
0 5 elsif (not $$self{'clients'}{$id}{'rcpt'}) { }
0 5 elsif ($$self{'sender_verify'} and defined $$self{'clients'}{$id}{'fverify'}) { }
809 0 0 if ($fverify eq 'NXDOMAIN') { }
831 0 8 unless $$self{'simple'}
839 0 7 unless $$self{'simple'}
847 0 7 unless $$self{'simple'}
855 0 2 unless $$self{'simple'}
864 0 5 unless $$self{'simple'}
872 3 2 unless grep {/^Message-ID:/i;} @{$buf;}
873 4 1 unless $$self{'origin'}
877 1 4 if $$self{'origin'}
889 1 0 if (ref $_[0] and ref $_[0] eq 'HASH') { }
0 0 elsif (ref $_[0] and ref $_[0] eq 'ARRAY') { }
899 0 1 unless $item{'from'}
900 0 1 unless $item{'msg'}
901 0 1 unless $item{'rcpt'} and ref $item{'rcpt'} eq 'ARRAY' and scalar @{$item{'rcpt'};}
902 1 0 unless $item{'ts'} and $item{'ts'} =~ /^\d+$/
903 1 0 unless $item{'uid'}
904 1 0 unless $item{'subject'}