E
Eric
Hello,
I am using Perl threads to launch multiple executions of a command in
parallel. The code to do this is:
foreach my $Machine ($self->Machines) {
my $thr = threads->new(\&doPowerAction, $Machine);
}
foreach my $t (threads->list()) {
$t->join;
}
The sub referenced is:
sub doPowerAction
{
my $machine = shift;
my $runScript = `power.exp $machine`;
if ($runScript =~ m/SUCCESS/) {
return "SUCCESS";
} elsif ($runScript =~ m/FAILURE/) {
return "FAILURE";
} else {
return "INTERNAL_ERROR";
}
}
The problem is that I don't seem to be able to figure out how to
capture the return value in the calling routine. Does anyone know how
to do this?
Thanks in advance to all that respond.
Eric
I am using Perl threads to launch multiple executions of a command in
parallel. The code to do this is:
foreach my $Machine ($self->Machines) {
my $thr = threads->new(\&doPowerAction, $Machine);
}
foreach my $t (threads->list()) {
$t->join;
}
The sub referenced is:
sub doPowerAction
{
my $machine = shift;
my $runScript = `power.exp $machine`;
if ($runScript =~ m/SUCCESS/) {
return "SUCCESS";
} elsif ($runScript =~ m/FAILURE/) {
return "FAILURE";
} else {
return "INTERNAL_ERROR";
}
}
The problem is that I don't seem to be able to figure out how to
capture the return value in the calling routine. Does anyone know how
to do this?
Thanks in advance to all that respond.
Eric