BusyBird::Watcher - interface for watcher objects


    my $watcher = $timeline->watch_unacked_counts(
        assumed => { total => 0 },
        callback => sub { ... }
    $watcher->active;   ## returns true if the $watcher is active
    $watcher->cancel(); ## cancels the $watcher


This is an interface (or role) class for watcher objects. A watcher is something that represents a callback registered somewhere. Users can use a watcher to cancel (i.e. unregister) the callback.

BusyBird::Watcher does not implement any method. Implementations of BusyBird::Watcher must be a subclass of BusyBird::Watcher and implement the following methods.


$is_active = $watcher->active()

Returns true if the $watcher is active. Returns false otherwise.

An active watcher is the one whose callback can be called. On the other hand, the callback of an inactive watcher will never be called.


Cancels the $watcher, that is, makes it inactive.

If $watcher is already inactive, it stays inactive.


Toshio Ito <toshioito [at]>