Hello Sofia,
What is happening is that only STDOUT is being saved in the @output array.
STDERR is still going to the console (your screen). If on a UNIX/Linux
system, try adding "2>&1" in front of your command like this:
@output = `2>&1 infoerr_parse.pl`;
The "2>&1" redirects any output to file descriptor 2 (STDERR) to file
descriptor 1 (STDOUT). You may also want to add "$| = 1;" towards the
beginning of your script so that the script automatically flushes the output.
You can also extend this concept of redirection to the example that Ronald
gave:
At 01:24 PM 9/10/2001 -0400, Yacketta, Ronald wrote:
>open(COM, "parse.pl |") || die("fork failed: \l$!\n");
>while ( <COM> ) {
> blah
>}
>close COM
Simply add "2>&1" to the front of the command:
open(COM, "2>&1 parse.pl |") || die("fork failed: \l$!\n");
Does either of these methods work for what you are doing?
Note: I get slightly different results between using backticks and the open
command. The backticks method did not capture all output to STDERR.
A question for those more knowledgeable than I: This is the UNIX way of
redirecting STDERR. Is there an alternate Perl way?
Regards,
- Robert
At 10:21 AM 9/10/2001 -0700, Sofia wrote:
>@output = `infoerr_parse.pl`;
>print LOG "@output\n";
>
>Now, infoerr_parse.pl pings some machines and creates
>the following output:
>infoerr: info_get_data() timed out for node 27
>infoerr: info_get_data() timed out for node 37
>Message errors for node(s) 0..50
>There seems to be 0 nodes propagating errors.
>
>When I gather this output on @output array, I don't
>get the lines that say "..timed out for node.."
>
>Does anybody know how I can gather all the output?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]