EV::Stat#

📦 max

A file status watcher, as EV::stat makes: its callback runs when a path’s status changes - created, deleted, written, its permissions or times changed. These methods read the status before and after and change what is watched; the methods all watchers share are EV::Watcher’s.

Synopsis#

my $w = EV::stat '/var/log/app.log', 0, sub {
    my ($w) = @_;
    my $before = ($w->prev)[7];    # size before the change
    my $after  = ($w->attr)[7];    # size after
    print "grew by ", $after - $before, "\n" if $after > $before;
};

Functions#

Status#

attr#

The path’s status before the change that triggered the callback, as stat returns it. The same method has two other names:

Also available as EV::Stat::prev, EV::Stat::stat.

Configuration#

set#

Watch another path, with another polling interval: $w->set($path, $interval), as EV::stat takes them.

path#

The path watched; with an argument, watch that path instead and return the old one.

interval#

The polling interval in use, in seconds - the default chosen when 0 was given; with an argument, set a new one and return the old.