|
POE::Wheel - POE FollowTail Protocol Logic
|
POE::Wheel - POE FollowTail Protocol Logic
This module is not included with the standard ActivePerl distribution. It is available as a separate download using PPM.
$wheel = new POE::Wheel::FollowTail(
Handle => $file_handle, # File to tail
Driver => new POE::Driver::Something(), # How to read it
Filter => new POE::Filter::Something(), # How to parse it
PollInterval => 1, # How often to check it
InputState => $input_event_name, # State to call upon input
ErrorState => $error_event_name, # State to call upon error
);
This wheel follows the end of an ever-growing file, perhaps a log
file, and generates events whenever new data appears. It is a
read-only wheel, so it does not include a put() method. It uses
tell() and seek() functions, so it's only suitable for plain files.
It won't tail pipes or consoles.
-
POE::Wheel::FollowTail::event(...)
Please see POE::Wheel.
-
PollInterval
PollInterval is the number of seconds to wait between file checks.
Once FollowTail re-reaches the end of the file, it waits this long
before checking again.
-
InputState
The InputState event is identical to POE::Wheel::ReadWrite's
InputState. It's the state to be called when the followed file
lengthens.
ARG0 contains a logical chunk of data, read from the end of the tailed
file.
-
ErrorState
The ErrorState event contains the name of the state that will be
called when a file error occurs. The FollowTail wheel knows what to
do with EAGAIN, so it's not considered a true error.
The ARG0 parameter contains the name of the function that failed.
ARG1 and ARG2 contain the numeric and string versions of $! at the
time of the error, respectively.
A sample ErrorState state:
sub error_state {
my ($operation, $errnum, $errstr) = @_[ARG0, ARG1, ARG2];
warn "$operation error $errnum: $errstr\n";
}
POE::Wheel; POE::Wheel::ListenAccept; POE::Wheel::ReadWrite;
POE::Wheel::SocketFactory
This wheel can't tail pipes and consoles. Blargh.
Please see the POE manpage.
|
POE::Wheel - POE FollowTail Protocol Logic
|
|