lib/App/MadEye/Plugin/Agent/POP3S.pm untested

filter: Statementstmt 0.0% 0 / 25 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 43 CC 2 SCAR 11.5
CC
2
Cov
0%
is_dead
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 3.1
1 package App::MadEye::Plugin::Agent::POP3S;
2 use strict;
3 use warnings;
4 use App::MadEye::Plugin::Agent::Base;
5 use IO::Socket qw(SOCK_STREAM);
6 use IO::Socket::SSL;
7  
8 sub is_dead {
9 my ($self, $host) = @_;
10  
11 my $conf = $self->config->{config};
12 my $port = $conf->{port} or die "missing port";
13 my $timeout = $conf->{timeout} || 10;
14  
15 eval {
16 my $sock = IO::Socket::SSL->new(
17 PeerAddr => $host,
18 PeerPort => $port,
19 Proto => 'tcp',
20 Type => SOCK_STREAM,
21 Timeout => $timeout,
22 ) or die "can't connect pop3s $host:$port $!\n";
23 };
24  
25 if ( $@ ) {
26 return "pop3d is dead $@";
27 } else {
28 return 0;
29 }
30 }
31  
32 1;
33 __END__