Posted on 2006-01-12 16:29:21-08 by jhuettemeister
Why call function for each line
Hi, actually I am a fan of File::Tail and File::Tail::App. But I think the File::Tail::App can be optimized if you could also read multiple lines at once, put them to a arrayref and make the method call on this (instead of the line_handler). Meanwhile I fix it amateurishly... cheers johannes
Direct Responses: 1623 | Write a response
Posted on 2006-01-13 00:11:41-08 by dmuey in response to 1620
Re: Why call function for each line

> I think the File::Tail::App can be optimized if you could also read multiple lines at once

This doesn't make any sense because each line is had from File::Tail's read(), you never give it anything to process it gives you what needs processed. So to change it to process a given array would imply that currently you pass it a line to process which you don't :)

If you have an array you want to process the same as you would a live updated each part of just do:

_wag_tail($_) for @my_lines;

Just be sure to your not going to goof up the "lastrun" info or you will lose information, process it twice, or cause infinite loops.

Perhaps if you could elaborate on what you're trying to do exactly it will make more sense and might even be incorporated but as it stands since read() gives a line at a time then the function processes one line.

Otherwise you're not processing a live tailed file :)

Please clarify if I've misunderstood.

thanks :)

Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.