| 1 |
The File::Tail module is designed for reading files which are continously |
| 2 |
appended to (the name comes from the tail -f directive). Usualy such files are |
| 3 |
logfiles of some description. |
| 4 |
|
| 5 |
The module tries hard not to busy wait on the file, dynamicaly calcultaing |
| 6 |
how long it should wait before it pays to try reading the file again. |
| 7 |
|
| 8 |
The module should handle normal log truncations ("close; move; open" |
| 9 |
or "cat /dev/null >file") transparently, without losing any input. |
| 10 |
|
| 11 |
Currently this package requires Time::HiRes, because it often needs to sleep |
| 12 |
for less than one second. (I don't beleive one should busy wait on a file |
| 13 |
just because it gets more than one line/second). |
| 14 |
|
| 15 |
The file logwatch is a simple example of use. Try it with |
| 16 |
./logwatch /var/log/syslog 1 if you want to see how File::Tail works. |
| 17 |
|
| 18 |
This version now returns a tied filehandle, but it can also be used as |
| 19 |
a normal object. |
| 20 |
|
| 21 |
A feature added in 0.81 is tail -n functionality: you can demand to read the |
| 22 |
last n lines, reading from the current end of file, or reading from the start |
| 23 |
of file. |
| 24 |
|
| 25 |
Select was added in version 0.90. It allows you to simoultaneously read from |
| 26 |
several File::Tail objects at the same time, while also reading from pipes. |
| 27 |
This is a new implementation, so if you notice any bugs, please let me know. |
| 28 |
************************************************************************* |
| 29 |
Version 0.90 had a bug in "select" which caused it to sometimes overlook |
| 30 |
input waiting on ordinary files until there was input on tailed files. |
| 31 |
************************************************************************* |
| 32 |
NOTE: Select functionality is currently experimental. Consider this a public |
| 33 |
beta. If you notice any new problems, let me know. I will also entertain |
| 34 |
suggestions for changes in the select interface - but only until I release |
| 35 |
the next version. |
| 36 |
|
| 37 |
To build this module, enter |
| 38 |
perl Makefile.PL |
| 39 |
make |
| 40 |
make test |
| 41 |
make install |
| 42 |
|
| 43 |
If you have any problems, contact me at [email protected] |
| 44 |
|
| 45 |
Copyright (c) 1997,1998,1999 Matija Grabnar. |
| 46 |
|
| 47 |
All rights reserved. This program is free software; you can |
| 48 |
redistribute it and/or modify it under the same terms as Perl itself. |
| 49 |
|
| 50 |
|
| 51 |
|