Subject: | Win32::Job stdout problem |
I'm trying to use this script to get command's output into a scalar but it doesn't seems to work. It only works if filehandle is opened on a real file.
use strict;
use Win32::Job;
use Data::Dumper;
my $job = Win32::Job->new;
my $buffer;
open CHILDOUT,'>',\$buffer;
$job->spawn("ipconfig.exe"
,"ipconfig /all"
,{stdin=>'NUL'
,stdout=>\*CHILDOUT
,stderr=>\*CHILDOUT
}
);
my $ok=$job->run(undef);
print Dumper($buffer);
close CHILDOUT;
Tested on Perl 5.8.7 built for MSWin32-x86-multi-thread, ActiveState Build 815.
Thank you.