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

filter: Statementstmt 0.0% 0 / 24 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 44 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::Memcached;
2 use strict;
3 use warnings;
4 use Cache::Memcached::Fast;
5 use App::MadEye::Plugin::Agent::Base;
6  
7 sub is_dead {
8 my ($self, $host) = @_;
9  
10 my $conf = $self->config->{config};
11 my $port = $conf->{port} || 11211;
12 my $timeout = $conf->{timeout} || 1;
13 my $namespace = $conf->{namespace} || 'madeye';
14  
15 my $sock = Cache::Memcached::Fast->new({
16 servers => ["$host:$port"],
17 namespace => $namespace,
18 connect_timeout => $timeout,
19 });
20  
21 $sock->set($host, 1) or
22 return "Can't set data";
23 return "Can't get data" unless $sock->get($host);
24  
25 return; # success!!
26 }
27  
28 1;
29 __END__