File::Tail may be used like a conventional tail(1) - without the rescan - by specifying the 'tail' argument to the constructor. However to prevent the 'wait' you have to only display those lines you ask for (then destroy the object). For example:
use strict;
use File::Tail;
my $num_of_lines = 10;
my $tail = new File::Tail (name=>$ERRLOG, tail => $num_of_lines);
for (1..$num_of_lines) {
my $line = $tail->read();
print "$_: $line";
}
$tail = undef;
update: I emailed the author of File::Tail (Matija Grabnar) with this solution, and he was kind enough to respond immediately with the following: "You're wasting most of File::Tails potential, but yes, that should work.
Note that it won't work if your input is a stream or a pipe (for which
ordinary tail would work)." | [reply] [d/l] |