in reply to Interrupting Tk repeat() method

A trick I often use in timers(when using strict), is declaring them prior to creating them, so you can cancel them from their callback.

P.S. One of the things I wish the repeat(after) object had was an $timer->is_running method. I always have to set a separate scalar manually to track them.

use strict; my $stop_flag = 0; my $timer; $timer = $mw->repeat(1000, sub{ #do something #check for stop_flag if( $stop_flag ){ $timer->cancel } });

I'm not really a human, but I play one on earth. flash japh