Today, a short one as I’m short on time. But I wasn’t able to do a PMM last week, and I’d hate to skip it two weeks in a row, so…
Say hello to File::Tail. A simple concept, but a very, very useful one. Ever run the *NIX “tail -f <file>” command? Yeah, it’s pretty much just like that. Only in Perl, so it’s actually more flexible. Much more.
You can use it in a very simple manner, to read from files that are continuously updating. You can control how often and to what degree it adjusts the wait-interval it uses when polling the underlying file to check for changes. You can also tie a file-handle to it. You can do things like select-polling across several such handles or objects, to read in a non-blocking way from multiple tail’d files at once. It even comes bundled with two sample scripts showing it in action.
Check it out!