NAME

UAV::Pilot::Events

SYNOPSIS

my $condvar = AnyEvent->condvar;
my $events = UAV::Pilot::Events->new({
    condvar => $condvar,
});
$events->register( ... );
$events->init_event_loop;
$condvar->recv;

DESCRIPTION

Handles event loops on a regular timer.

METHODS

new

new({
    condvar => $cv,
})

Constructor. The condvar argument is an AnyEvent::Condvar.

register

register( $event_handler )

Adds a object that does the UAV::Pilot::EventHandler role to the list. The process_events method on that object will be called each time the event loop runs.

init_event_loop

Sets up the event loop. Note that you must still call recv on the AnyEvent::Condvar to start the loop running.