You can try temporarily redirecting STDERR to your file.  I think it's
something like this:

open(OLDSTDERR,">&STDERR") || die;
open(STDERR,">err.log") || die;

Then you can put it back the same way.

Someone please correct me if I have the syntax wrong.  I can't test it here.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 20, 2003 6:43 AM
To: [EMAIL PROTECTED]
Subject: Want to get error return as text string?


I want to get the error message from a system call as a text string and not
a numeric code.  The error I see on the screen is:

cp: cannot create /tmp/dev/fin/test/test.inf: Permission denied

but when I check $! for an error string, it is blank.  $?  does contain an
error code, but I'm not sure how I would translate it to a text string.   I
also tried saving the output to a variable, but it doesn't contain the
error message:

my $out = `$cmd`;

Any suggestions.  Thanks for any help in advance!



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

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

Reply via email to