in reply to Tk::repeat function
I'd probably use some sort of flag to indicate whether refreshing is currently happening. Perhaps along the lines of:
{ my $is_refreshing = 0; sub refresh_func { return if $is_refreshing; $is_refreshing = 1; # refresh code here $is_refreshing = 0; return; } }
You'll probably want to check for exceptions such as comms failures, timeouts, etc. which also reset the flag before exiting.
Depending on your version of Perl and how you've actually written your refresh_func() code, $is_refreshing might be better declared as a state variable:
sub refresh_func { state $is_refreshing = 0; return if $is_refreshing; $is_refreshing = 1; # refresh code here $is_refreshing = 0; return; }
-- Ken
|
|---|