NAME

MIO::CMD - Run multiple commands in parallel.

SYNOPSIS

use MIO::CMD;

my @node = qw( host1 host2 ... );
my @cmd = qw( ssh {} wc );

my $mcmd = MIO::CMD->new( map { $_ => \@cmd } @node );
my $result = $mcmd->run( max => 32, log => \*STDERR, timeout => 300 );

my $stdout = $result->{stdout};
my $stderr = $result->{stderr};
my $error = $result->{error};

METHODS

run( %param )

Run commands in parallel. The following parameters may be defined in %param:

max: ( default 32 ) number of commands in parallel.
log: ( default STDERR ) a handle to report progress.
timeout: ( default 300 ) number of seconds allotted for each command.

Returns HASH of HASH of nodes. First level is indexed by type ( stdout, stderr, or error ). Second level is indexed by message.