NAME
Tk::Tickit::Bridge::Loop - service an IO::Async loop from Perl/Tk
SYNOPSIS
my $pump = Tk::Tickit::Bridge::Loop->new(
widget => $mw, loop => $loop, interval => 10,
)->start;
Tk::MainLoop();
$pump->stop;
DESCRIPTION
Runs one nonblocking loop_once(0) every interval milliseconds (default 10) using Tk's timers. Add your Tickit::Async object to this IO::Async loop before starting. Keep the pump object alive. No IO::Async dependency is loaded here; any loop implementing loop_once(0) can be supplied.
start and stop are idempotent and return the pump. running reports whether it is active. stop cancels the outstanding timer, and may safely be called from an IO::Async callback. Destroying the pump cancels its timer; destroying its Tk widget cancels Tk's associated timer, after which callers should call stop to reset the reported running state.
Exceptions from loop_once stop the pump and propagate to Tk's error handler. The application owns both loops, Tickit setup, terminal restoration, and exit policy. Request shutdown in callbacks and perform final cleanup after returning to the outer event dispatcher. Do not recursively pump the same IO::Async loop.
Polling introduces up to about one interval of extra latency when callbacks are short. It is not sample-accurate synchronization. Long callbacks block both interfaces. There are no threads or child processes in this helper.
AUTHOR AND LICENSE
Copyright (c) 2026 Joel Roth. Same terms as Perl itself.