Wednesday, August 21, 2013

reading a growing file in perl


  • How do I read a file which is constantly updating? (Stack Overflow) [link]
  • How can I read from continuously updated file in Perl? (Stack Overflow) [link]
Approaches:
  • File::Tail (or one of its sisters) is your friend (preferred!)
  • use this (together with sleep(...)) for getting EOF reset: seek(LOG, 0, 1) (if you must stay with vanilla perl)
Wrote my 1st script making use of File::Tail today, a "main log file" referring to short other log files. Now I read all of them using File::Tail. Looks good and rather versatile.

No comments: