in reply to Re: Perl TK
in thread Perl TK

Just making sure I have this right....

A script that might look like this:

use Tk; my_long_sub { print "You can't kill me!\n"; sleep 60; my_long_sub(); } $main = MainWindow->new; $main->Button( -text "Start Long Sub", -command \&my_long_sub)->pack;

Could (and should?) be written thusly:

use Tk; $seconds = 60; not_a_long_sub { print "You can't kill me!\n"; #sleep 60; <-Replacing this with an after #my_long_sub(); <-After handles the call } $main = MainWindow->new; $main->Button( -text "Start Long Sub", -command \&not_a_long_sub)->pac +k; $main->after($seconds * 1000, \&not_a_long_sub);

This assumes the after counts in Milliseconds. (Like Tk)

Sorry to work this out in public, but I wanted to get my brain around it quick.... If anyone gathers the notion that I havent grokked this fully, let me know.

Replies are listed 'Best First'.
Re: Re: Re: Perl TK
by JojoLinkyBob (Scribe) on May 11, 2001 at 00:37 UTC
    That looks efficient to me.
    Desert coder