Given the following function:
Code:
sub execute($) {
local $response = qx!$_[0]!;
local $result = ($? >> 8);
return ($result,$response);
}
If called with the following argument:
Code:
($Result,$Response) = execute("iwconfig");
I would expect $Response to contain the STDOUT and $Result to contain the STDERR. But that is only partially true. Within the terminal I see the following print out
Code:
lo no wireless extensions.
etho no wireless extensions.
wifi0 no wireless extensions.
and when I step through the code, I see that $Response has the rest of the output from the "iwconfig" command:
Code:
ath0 IEE 802.11g ESSID:"" Nickname:""
...etc...
The question that I have is, why can't I capture ALL of the STDOUT? Why does some still escape and get printed to the screen regardless? I've tried backticks, system(), and even piping the output to a file...but none of them work completely to mask all STDOUT from getting printed to the screen. In case you are wonderring, my intention is to create a function that can silently run commands in the background without interfering with main execution by printing crap on the screen. Any ideas?
Thanks,
DBelcher