in reply to Emulating command line pipe
my $tac_pid = open my $fh, "tac $logfile |"; while (<$fh>) { last if /$match/; } kill 13, $tac_pid; # SIGPIPE close $fh;
But even so tac might be reading more than it should needed, since there's buffering
on both sides of the pipe (and yes, I guess closing the filehandle $fh sends a SIGPIPE to tac... :-)
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Emulating command line pipe
by davistv (Acolyte) on Aug 31, 2007 at 17:08 UTC | |
by shmem (Chancellor) on Aug 31, 2007 at 17:23 UTC | |
by davistv (Acolyte) on Aug 31, 2007 at 17:55 UTC |