I'm working on a cgi script, in which I call a program. My predecessor had it setup as:
$result = `command 2> error_log`;
Ok, all well enough. stdout goes to the variable $result, stderr to the file error_log.
I've been making some major modifications to this script, though, and would like to set it up in such a way that I could send stderr to a variable as well. I really don't want to deal with creating a bunch of 0 length files, and I don't really need to keep the data around, so there isn't much point in me using a file. Also, it would be easier to say:
then to say:
if($errror_file_name size >0) do_error_stuff
So, is there an easy way to send both stdout and stderr to variables? (I'd even settle for a not-so-easy-way, as it would make the rest of my job easier