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

filter: Statementstmt 0.0% 0 / 22 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 30 CC 2 SCAR 12.0
CC
2
Cov
0%
is_dead
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 3.3
1 package App::MadEye::Plugin::Agent::Ping;
2 use strict;
3 use warnings;
4 use App::MadEye::Plugin::Agent::Base;
5  
6 use Net::Ping;
7  
8 sub is_dead {
9 my ($self, $host) = @_;
10  
11 my $timeout = $self->config->{config}->{timeout};
12  
13 my $p = Net::Ping->new("tcp");
14 $p->hires(1);
15 my ( $ret, ) = $p->ping( $host, $timeout );
16 $p->close;
17  
18 if ($ret) {
19 return; # success
20 } else {
21 return "dead";
22 }
23 }
24  
25 1;
26 __END__