in reply to Re: Reading non-blockingly / "awk has to be better for something."
in thread Reading non-blockingly / "awk has to be better for something."
use IO::Handle; my $fh = *STDIN; $fh->blocking(0); while (1) { # this block would go in your callback, not in a loop lik +e this: $fh->sysread( my $data, 255 ); print "$data"; # split $data into lines on CR|LF put the first lin +e on the end of the last line of the previous block (use an array per +haps) }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Reading non-blockingly / "awk has to be better for something."
by Anonymous Monk on Jul 28, 2012 at 12:39 UTC | |
by Anonymous Monk on Jul 28, 2012 at 13:02 UTC |