On 18 Mar 2003 23:48:25 -0000, [EMAIL PROTECTED] (Steve Grazzini) wrote:
>James Kipp <[EMAIL PROTECTED]> wrote:
>> Navid M. <[EMAIL PROTECTED]> writes:
>>>
>>> I was wondering if it's possible to save the error of
>>> a DOS command from the error stream into a variable.
>>>
>> you could try the old 2>&1 trick
>> $out = `$cmd 2>&1`;
>>
>> or use system() and read the docs for capturing error codes:
>
>Assuming IPC::Open3 works on Windows [I believe that it does]
>you could also do:
>
> sub readpipes {
> require IPC::Open3;
> my $pid = IPC::Open3::open3(my ($in, $out, $err), @_);
There is a nice module to make ipc even easier than IPC::Open3,
called Proc::Reliable
#!/usr/bin/perl
use Proc::Reliable;
$myproc = Proc::Reliable->new();
($out, $err, $status, $msg) = $myproc->run("ls");
print "STDOUT-> $out\n";
print "STDERR->$err\n";
print "EXIT STATUS-> $status\n";
print "MSG-> $msg\n";
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]