The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

POE::Wheel - POE FollowTail Protocol Logic

SYNOPSIS

  $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
  );

DESCRIPTION

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.

PUBLIC METHODS

  • POE::Wheel::FollowTail::event(...)

    Please see POE::Wheel.

EVENTS AND PARAMETERS

  • 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";
      }

SEE ALSO

POE::Wheel; POE::Wheel::ListenAccept; POE::Wheel::ReadWrite; POE::Wheel::SocketFactory

BUGS

This wheel can't tail pipes and consoles. Blargh.

AUTHORS & COPYRIGHTS

Please see the POE manpage.