++ed by:
AERO ADAMJS

2 PAUSE users

刘刊

NAME

MIO::CMD - Run multiple commands in parallel.

SYNOPSIS

 use MIO::CMD;

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

 my $cmd = 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.