Re: timeout wont run without a 'print'!?




On Jan 2, 2008, at 10:38 PM, Thomas Ledbetter wrote:

I have a timeout set up to run every second, such that the 6 text entry
widgets get a random number displayed in them.

The weird thing is: the timeout itself only runs once and then stops
after the first iteration  *unless* I put a 'print' statement in the
subroutine!?!  And then it runs fine!?!  But only with the 'print;' in
there!?!?

The timeout will uninstall itself unless the callback returns a true value. Most likely you were not returning anything, so the value of the last expression in the subroutine was used as the return value, and print() was returning true where without it it was returning false.

http://live.gnome.org/GTK2-Perl/FrequentlyAskedQuestions#head-98626f4df6988bac3d10b50a3f4e21eca0698da2

http://gtk2-perl.sourceforge.net/doc/pod/Glib/MainLoop.html#integer_Glib_Timeout

http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#g-timeout-add

--
Diane, ten-oh-three, Great Northern Hotel.
Sheriff Truman and I have just been with the one-armed man, or what's left of him. In another time, another culture, he may have been a seer, or a shaman priest, but in our world, he's a shoe salesman, and lives among the shadows.
-- Special Agent Dale Cooper




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]