in reply to Tk and socket question

I noticed the part of code that you meant to highlight with "<b> ... </b>" -- of course, that sort of highlighting doesn't work within "code" tags, and monks should be looking for real comment lines within code sections to learn about your intentions/problems with the code...

Anyway, I think the part your missing might be found in "perldoc Tk::fileevent" -- this allows Tk to continue with its own event loop (for handling user inputs at the GUI), while also watching for activity on an open file handle or socket.

The basic idea is that when Tk is running the GUI, you don't do " while <INP_HANDLE> { ... }" anywhere in the code, unless your intent is to read the given handle all the way to EOF before handling any other GUI activity. Instead, you open your handle (file or socket), create a handler callback to read from that handle whenever Tk detects available input on the handle, deal with that event, and hand control back to the Tk event loop (until it detects more input on the handle).

(I haven't used it much myself, so I'm not the best person to offer sample code, but the docs should be clear enough...)