Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
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



Report this thread to moderator Post Follow-up to this message
Old Post
Oded
12-13-05 01:13 PM


Re: Tk:Error ("after" script) - what does it mean ??
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 thi
s
>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

Report this thread to moderator Post Follow-up to this message
Old Post
zentara
12-13-05 01:13 PM


Re: Tk:Error ("after" script) - what does it mean ??
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 
this 
>  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



Report this thread to moderator Post Follow-up to this message
Old Post
Oded
12-14-05 08:59 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PerlTk archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 03:36 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.