On Tuesday, July 9, 2002, at 06:25 , John W. Krahn wrote:
[..]
> One way would be to cache the last line read and the next time you read
> the file loop until that line is encountered and only process the lines
> after it.
john,
when you say 'cache the last line' - are you meaning
#
# majik function knows where we cache Stuff
#
my $last_line = get_last_line_from_cach();
open(FH, .... ) or die "horrible death";
#grovel log till we see the match on $last_line
while(<FH>) {
last if /$last_line/;
}
#
# now do our new stuff with it,
# but save the 'new' $last_line
# in theory - if there were no new lines,
# this while will not execute...
#
while(<FH>) {
$last_line=$_;
.....
}
do_majik_with_db(@arg_list);
#
# majik funkion hides last line in cache
#
push_into_cache($last_line);
or did you mean something like the usual
$curpos = tell(FILE);
cf: perldoc -f seek
so that we can cache this, and test to see if
$curpos the next time is 'longer' than the logfile,
hence that the logfile has been roled,
or were you planning to save the 'stat',
cf perldoc -f stat
along with the cache to verify that the log has not
been rolled in the process???
ciao
drieux
---
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]