NAME

MYDan::Util::MIO::CMD - Run multiple commands in parallel.

SYNOPSIS

use MYDan::Util::MIO::CMD;

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

my $cmd = MYDan::Util::MIO::CMD->new( map { $_ => \@cmd } @node );
my $result = $cmd->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 128 ) number of commands in parallel.
log : ( default STDERR ) a handle to report progress.
timeout : ( default 300 ) number of seconds allotted for each command.
input : ( default from STDIN ) input buffer.

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