in reply to how to retrieve the error message returned by the system command
If you're running on a *nix OS, you could redirect the standard error to a temporary file and then parse the contents if it the file exists.
--njcodewarriormy $ERR_FILE = q{/tmp/error_message.txt}; qx{COMMAND 2>$ERR_FILE}; if ( -f $ERR_FILE ) { open my $FH, '<', $ERR_FILE; my @err_msg = <$FH>; close $FH; unlink $ERR_FILE or die "Can't remove $ERR_FILE: $!"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how to retrieve the error message returned by the system command
by swampyankee (Parson) on Mar 27, 2006 at 17:19 UTC |