sub some_event_handler { # set a timer for 10s from now, unless it's already set set_oneshot_timer( event_to_send => 10 ); } sub handle_timer_event { # caught the timer; clear the flag caught_oneshot_timer($_[STATE]); }