Tomas Doran > App-RabbitTail-0.002 > App::RabbitTail::FileTailer

Download:
App-RabbitTail-0.002.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Source  

NAME ^

App::RabbitTail::FileTailer - responsible for tailing a file and invoking a callback for each line.

SYNOPSIS ^

    use App::RabbitTail::FileTailer;
    use AnyEvent;

    my $tailer = App::RabbitTail::FileTailer->new(
        backoff_increment => 0.1,
        max_sleep => 10,
        fn => $somefile,
        cd => sub { warn("Got line " . $_[0]) },
    );
    $tailer->tail; # Sets up watcher to fire callbacks, returns

    # Rest of your code.

    # Enter event loop.
    AnyEvent->condvar->recv;

DESCRIPTION ^

An instance of App::RabbitTail::FileTailer manages tailing a file with exponential backoff of checking if the file has been written when no bytes are available to minimise system load.

AUTHOR, COPYRIGHT AND LICENSE ^

See App::RabbitTail for copyright and license.

syntax highlighting: