Kipp, James wrote:


Hello,

I was wondering if it's possible to save the error of
a DOS command from the error stream into a variable.

For example, the STDOUT of a DOS command can be saved
to a variable this way:

$var = `dir`; # Using back quotes

but this won't save anything from STDERR.


you could try the old 2>&1 trick $out = `$cmd 2>&1`;


I believe this requires proper handling by the shell, which DOS might do.


or use system() and read the docs for capturing error codes:

This doesn't really provide the contents of STDERR though, only an exit code...



example:
system("blah blah");
my $err = $? >> 8; if ($err) { print "we got errors" }

If neither of the above work you may also want to check out the IPC::Open3 standard module, though I don't know whether or not it works on M$ systems.


http://danconia.org


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to