in reply to capture output of tcpdump and PID
Answering the first question first, you do indeed have two processes; that's what the | does in the open. See doc:perlopentut.
I'm not sure what want with the second one. If you mean that you want to stop after a specified amount of time, then you could just use alarm() to set a timer for the desired amount of time and exit the loop at that point. Like (untested):
my $done = 0; local $SIG{ALRM} = sub { $done = 1; }; alarm 10; # or whatever while (not $done and $output = <STDIN>) { print $output; # don't need newline as it's there already }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: capture output of tcpdump and PID
by mike928 (Initiate) on May 24, 2012 at 14:38 UTC | |
by aaron_baugher (Curate) on May 24, 2012 at 18:29 UTC | |
by thargas (Deacon) on May 25, 2012 at 11:30 UTC |