use strict; use Carp; use ClarRPC; #In house module my ($pid1, @resp1) = rpc(10.15.51.208, '1300', 'ping -n 15 10.15.51.208'); my ($pid2, @resp2) = rpc(10.15.51.208, '1301', 'ping -n 15 10.15.51.208'); my ($pid3, @resp3) = rpc(10.15.51.208, '1302', 'ping -n 15 10.15.51.208'); print ("RESP1: @resp1\n"); print ("RESP2: @resp2\n"); print ("RESP3: @resp3\n"); sub rpc { my ($ip, $port, $command) = @_; my @resp; my $pid; my @pids; if ($pid = fork()) { push(@pids, $pid); #waitpid($pid, 0); } elsif (defined $pid) { my $connection = ClarRPC->connect($ip, $port); ($pid, @resp) = $connection->rpc('ClarRPCService::system_call', $command); $connection->disconnect(); exit; } return $pid, @resp; }