stefan k has asked for the wisdom of the Perl Monks concerning the following question:

Fellow Monks,
I'm still working on some perl-gtk programm and have come thru many of the problems with the standard perl-gtk tutorial and the source code of CSCMail.

Right now I got two questions burning:

  1. What other useful ressources are there to get knowledge from (like good programms' source or API description (not the PDF file from the GtkPerl website)
  2. (This is my main question)
    When I'm in the main loop of Gtk I can't do anything else.
At least I don't know any way to do anything there.
I figured out how to (e.g.) update a label showing the time from other sourcecode as:
while (1) { while (Gtk->events_pending) { Gtk->main_iteration; } $time = strftime("%H:%M:%S",localtime()); $time_label->set($time); }
But this uses up all the CPU time available. An additional
sleep(1)
within the while()-loop makes the whole programm respond very slowly.

So, since I need not only to update the time label but also have to check a file for a change since my last visit (and maybe I'll have to add more actions later)
I ask you, my Fellow Monks:

What else can I do??

Regards Stefan K

Edited 2001-04-09 by mirod: added </ol> tag

Replies are listed 'Best First'.
Happy Now: The Solution
by stefan k (Curate) on Apr 09, 2001 at 19:47 UTC
    Fellow Monks,
    the path to enlightenment is hard and one has to walk it all by himself *sigh*

    Anyway thanks to the mailinglist at http://mail.gnome.org/archives/gtk-perl-list/ and -once again- the sources of CSCMail I found a solution to my question:

    Gtk->timeout_add($delay_in_ms,\&what_ever_sub_you_need); main Gtk;
    I hope anyone will come across this node and will find this solution helpfull...

    Thanks for thinking.

    Regards Stefan K

grmlblbl
by stefan k (Curate) on Apr 09, 2001 at 18:24 UTC
    Dear monks,
    sorry for the missing _end_of_enumerated_list! Thanks go out to jeroenes. I can't find a way to edit my posting so I'll just put the tag in this post and see what I'll get...

    hey, and don't you laugh at me ;-)

    Update: Thanks mirod!

    Regards Stefan K