Perl Monk, Perl Meditation | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I am having trouble with interrupting Perl as it processes a loop with a ‘sleep’ in it.
I am using Perl on a Windows 11 pc. The included code runs a loop. At the start of the loop is ${INT} which sets a sub to be used if CNTRL-C is used. This sub simply sets the variable $loop_test to zero so that the loop ends. This test Perl works. However, when I use this is the ‘production’ application, where a sub is also called (this tests if a file has recently being store and then acts on this information) CNTRL-C does not work. Has any Monk a suggestion as to how this can be made to work?
I am using Perl Tk and could have a button which when used has the effect of calling the sub to set a variable to end the loop My attempts to do this have failed because the button fails to respond. I seem to remember (it is a few years since I have written any Perl Tk code) that there is some property that can be assigned to a button so that it would work in these circumstances. However, my searches for this have failed. Can any Monk point me it the right direction? In reply to Interrupting a loop by merrymonk
|
|