Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: Checking multiple files..by nobull (Friar) |
on Mar 28, 2005 at 12:35 UTC ( [id://442782]=note: print w/replies, xml ) | Need Help?? |
I want to check on multiple growing files but I really don't know how to do it. Basically just use the polling approach you've already partially figured out for a single file but loop over an array (or hash) of filehandles. However you've not considered the possibility that there may be an incomplete line at the end of the file. To see how to cope with that take a look at how File::Tail does it. This is really quite complex. Perhaps you should just use File::Tail. Asside: I think you are saying exit where you meant last. I know "select()" is somehow related with my question but I cannot figure how to do it... :( The builtin select() applies when you want to monitor multiple pipe/sockets/devices. These things can be in a state where they have no data to return now but are not at an EOF contition. A file cannot. However File::Tail defines another select(). Oh, and please get into using strictures and warnings now rather than waiting to suffer/inflict the pain that not using them will cause sooner or later.
In Section
Seekers of Perl Wisdom
|
|