in reply to Redirecting and using output from executed program
Two ways of doing this might be the shell redirect method
and the Perl IPC method# @exec has the commad that i wish to run # but we're throwing away the error meesages open (T_RES,"@exec 2>/dev/null |") or die "Unable to fork '@exec': $!"; while (<T_RES>) { # parsing the output }
# @exec has the commad that i wish to run use IPC::Open3 my $pid; $pid = open (WTR,T_RES,ERR,"@exec") or die "Unable to fork '@exec': $!"; while (<T_RES>) { # parsing the output } waitpid $pid, 0; # if necessary, see below
Thought the shell method might be easier, the IPC::Open3 method might be more portable.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Redirecting and using output from executed program
by DrHyde (Prior) on Sep 30, 2004 at 16:50 UTC |