use strict;
use warnings;
use Test::TCP;
use File::Which qw/which/;
test_tcp(
client => sub {
my $port = shift;
# your test code here.
},
server => sub {
my $port = shift;
exec(which('memcached'), '-p', $port);
die "should not reach here";
},
);