Branch Coverage

blib/lib/POE/Component/Server/SimpleSMTP.pm
Criterion Covered Total %
branch 134 262 51.1


line true false branch
24 6 7 if $opts{'handlers'}
25 7 6 unless $opts{'handlers'} and ref $opts{'handlers'} eq 'ARRAY'
26 12 1 unless $opts{'domains'} and ref $opts{'domains'} eq 'ARRAY'
27 10 3 unless defined $opts{'simple'} and not $opts{'simple'}
28 13 0 unless defined $opts{'handle_connects'} and not $opts{'handle_connects'}
29 13 0 unless defined $opts{'hostname'}
30 13 0 unless $opts{'relay'}
31 12 1 unless $opts{'origin'}
32 13 0 unless $opts{'maxrelay'}
33 0 13 if $opts{'relay_auth'}
34 13 0 unless $opts{'version'}
37 13 0 ref $options eq 'HASH' ? :
69 2 0 if $pause
79 0 1 unless scalar @{$self->{'_mail_queue'};}
83 1 0 if $_->{'uid'} eq $uid
92 0 3 unless $self->_conn_exists($id)
94 1 2 if ($handle and $^O ne 'MSWin32') { }
104 0 12 unless $_[0]{'listener'}
125 0 409 unless $wheel_id and defined $self->{'clients'}{$wheel_id}
133 0 70 unless grep {$_ eq $cmd;} @{$$self{'cmds'};}
139 0 6 unless ref $handler and ref $handler eq 'ARRAY'
143 6 0 if (ref $handler->[$count] and ref $handler->[$count] eq 'HASH') { }
147 0 6 unless $handler->[$count]{'SESSION'}
149 0 6 unless $handler->[$count]{'EVENT'}
151 0 6 unless $handler->[$count]{'MATCH'}
153 0 6 if UNIVERSAL::isa($handler->[$count]{'SESSION'}, 'POE::Session')
156 0 6 if ($@) { }
179 0 13 if ($self->{'alias'}) { }
185 13 0 if ($kernel != $sender)
204 13 0 unless $self->{'resolver'} and $self->{'resolver'}->isa('POE::Component::Client::DNS')
209 1 12 if $self->{'dnsbl_enable'}
222 0 13 if ($self->{'listener'})
228 13 0 defined $self->{'address'} ? :
13 0 defined $self->{'port'} ? :
253 0 12 unless $wheel
281 0 134 unless $self->_conn_exists($id)
283 64 70 if ($self->{'clients'}{$id}{'buffer'})
284 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 '.') { }
301 50 6 if (ref $self->{'clients'}{$id}{'buffer'} eq 'ARRAY') { }
314 0 70 unless $cmd
315 0 70 unless ($self->_valid_cmd($cmd))
320 8 62 if ($cmd eq 'quit')
331 0 0 unless $self->_conn_exists($id)
339 0 90 unless $self->_conn_exists($id)
340 82 8 unless $self->{'clients'}{$id}{'quit'}
348 0 1 unless $self->_conn_exists($id)
361 13 0 unless $self->{'alias'}
364 1 12 if $self->{'dnsbl_enable'}
371 0 1 unless $self->_conn_exists($id)
385 0 1 unless $self->{'buffers'}{$wheel_id}{'shutdown'}
401 0 0 unless (@events)
409 0 0 unless /^_/
412 0 0 unless ($self->{'sessions'}{$sender_id}{'refcnt'}++ or $session == $sender)
425 0 0 unless (@events)
439 0 0 unless /^_/
441 0 0 unless ($blah)
445 0 0 if (--$self->{'sessions'}{$sender_id}{'refcnt'} <= 0)
447 0 0 unless ($session == $sender)
459 13 0 if (--$self->{'sessions'}{$session_id}{'refcnt'} <= 0)
461 13 0 unless $session_id eq $smtpd_id
492 55 42 if $self->_pluggable_process('SMTPD', $event, \(@args), \@extra_args) == 4
494 0 42 if scalar @extra_args
509 0 90 unless $self->_conn_exists($id)
510 0 90 unless $output
512 0 90 if $self->_pluggable_process('SMTPC', 'response', $id, \$output) == 4
514 0 90 unless $self->_conn_exists($id) and defined $self->{'clients'}{$id}{'wheel'}
523 5 0 if $recipient =~ /$handler->{'RE'}/
530 2 6 if $self->{'paused'}
531 0 6 if $self->{'_smtp_clients'} and $self->{'_smtp_clients'} >= $self->{'maxrelay'}
534 1 5 unless $item
537 0 5 if ($self->{'relay'})
543 5 0 if (my $handler = $self->_check_recipient($recipient))
559 0 0 if $response
567 0 0 unless ($response->{'response'})
568 0 0 if (time - $item->{'ts'} > 345600)
578 0 0 unless scalar @mx
609 0 0 if ($self->{'relay_user'} and $self->{'relay_pass'})
623 0 0 scalar keys %auth ? :
642 0 0 if ($error->{'SMTP_Server_Error'} and $error->{'SMTP_Server_Error'} =~ /^5/)
645 0 0 if (time - $item->{'ts'} > 345600)
657 0 12 unless $self->{'handle_connects'}
658 1 11 if ($self->{'dnsbl_enable'}) { }
672 0 1 if ($data->{'error'}) { }
677 0 1 if $data->{'response'} ne 'NXDOMAIN'
686 0 0 if ($data->{'error'} and $data->{'error'} eq 'NOERROR')
688 0 0 if scalar @answers
698 3 1 unless $self->{'simple'}
706 0 0 unless $self->{'simple'}
714 3 8 unless $self->{'simple'}
718 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) { }
725 8 0 if (my $host = 'Email::Address'->new(undef, $from, undef)->host) { }
728 0 8 if ($self->{'sender_verify'})
735 0 0 if $response
743 0 0 unless $args
752 3 12 unless $self->{'simple'}
756 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) { }
761 0 0 if ($fverify eq 'NXDOMAIN') { }
775 9 1 if ($self->_recipient_domain($to)) { }
784 0 0 unless $args
793 7 3 unless scalar @{$self->{'domains'};}
796 0 3 unless $hostpart
797 2 1 if grep {uc $_ eq uc $hostpart;} @{$$self{'domains'};}
803 3 5 unless $self->{'simple'}
806 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'}) { }
814 0 0 if ($fverify eq 'NXDOMAIN') { }
836 0 8 unless $self->{'simple'}
844 0 7 unless $self->{'simple'}
852 0 7 unless $self->{'simple'}
860 0 2 unless $self->{'simple'}
869 0 5 unless $self->{'simple'}
871 0 5 if ($self->{'sender_verify'} and defined $self->{'clients'}{$id}{'fverify'})
874 0 0 if ($fverify eq 'NXDOMAIN') { }
893 3 2 unless grep {/^Message-ID:/i;} @{$buf;}
895 4 1 unless $self->{'origin'}
898 1 4 if $self->{'origin'}
910 1 0 if (ref $_[0] and ref $_[0] eq 'HASH') { }
0 0 elsif (ref $_[0] and ref $_[0] eq 'ARRAY') { }
920 0 1 unless $item{'from'}
921 0 1 unless $item{'msg'}
922 0 1 unless $item{'rcpt'} and ref $item{'rcpt'} eq 'ARRAY' and scalar @{$item{'rcpt'};}
923 1 0 unless $item{'ts'} and $item{'ts'} =~ /^\d+$/
924 1 0 unless $item{'uid'}
925 1 0 unless $item{'subject'}