Home > Archive > PerlTk > December 2005 > Tk:Error ("after" script) - what does it mean ??
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Tk:Error ("after" script) - what does it mean ??
|
|
|
| Hi all,
I have a rather complicated Perl/TK code (which I'm not going to post here
:)
I sometimes get the following error printed when my application ends:
Tk::Error:
("after" script)
Everything works well, but I want at least to understand the meaning of this
error.
Any help ?
TIA,
Oded
| |
| zentara 2005-12-13, 8:13 am |
| On Tue, 13 Dec 2005 14:22:25 +0200, "Oded" <dv@mailtag.com> wrote:
>Hi all,
>
>I have a rather complicated Perl/TK code (which I'm not going to post here
>:)
>I sometimes get the following error printed when my application ends:
>
>Tk::Error:
> ("after" script)
>
>Everything works well, but I want at least to understand the meaning of this
>error.
>
>Any help ?
Yes, it's a commonly seen message, and it means you left an "after" or
"repeat" statement running, when you exited. I'm not sure what is the
exact combinations of widgets that cause it, but this is how to stop it.
What you need to do is name your after statements, and have a safe
exit subroutine, which cancels the statement before exiting.
########################################
#############
my $timer; #global so you can access from anywhere
$timer = $mw->repeat(1000 => sub {$counter ++});
sub clean_exit{
$timer->cancel;
exit;
}
########################################
###############
then you need to call that sub at all exit points, even trying to catch
the window manager's X button with
$mw->protocol( 'WM_DELETE_WINDOW' => \&clean_exit );
Those are the basics. Of course you can get very creative on
stopping your timers, but the above method is the basics.
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
| |
|
| I managed to get rid of this error thanks to your detailed explanation.
Thanks much,
Oded
"zentara" <zentara@highstream.net> wrote in message
news:fuftp1hfu1mh4nv6pppfn59n87g37cropj@
4ax.com...
> On Tue, 13 Dec 2005 14:22:25 +0200, "Oded" <dv@mailtag.com> wrote:
>
here[color=darkred]
this[color=darkred]
> Yes, it's a commonly seen message, and it means you left an "after" or
> "repeat" statement running, when you exited. I'm not sure what is the
> exact combinations of widgets that cause it, but this is how to stop it.
>
> What you need to do is name your after statements, and have a safe
> exit subroutine, which cancels the statement before exiting.
>
> ########################################
#############
> my $timer; #global so you can access from anywhere
>
> $timer = $mw->repeat(1000 => sub {$counter ++});
>
> sub clean_exit{
> $timer->cancel;
> exit;
> }
> ########################################
###############
>
> then you need to call that sub at all exit points, even trying to catch
> the window manager's X button with
>
> $mw->protocol( 'WM_DELETE_WINDOW' => \&clean_exit );
>
>
> Those are the basics. Of course you can get very creative on
> stopping your timers, but the above method is the basics.
>
>
> --
> I'm not really a human, but I play one on earth.
> http://zentara.net/japh.html
|
|
|
|
|