This thread is running real deep (Re^8) :) Below a few comments to your post.

Why are there so many? Simple. Each has it's own set of limitations--along with variations on command line syntax, usage syntax, defaults syntax, etc. etc. etc. I tried several when I first started Perl and got thoroughly confused and frustrated by them. I hate (vermently) the --some_grossly_long_option(colon | is it =? | is space?)value syntax.
Well, I have to agree, but only to a certain level. To many variation confuses people and makes Perl only for the real experts to share code. Yours was not to bad, I have aldready adapted to that, but the problem is there. That's why Perlmonks have the section "Obfuscated Code" as I understand it :D

There was little purpose in my continuing to develop the idea beyond proving that it would work as I don't currently have a use for it, b) you may have already decided upon your course of action and never come back to see what I had posted. c) It would only be truely useful for those (probably rare) occasions where you need to pass a filehandle into another module for it to write to, but want to intercept the output--and then only if you are doing this in combination with threads.
To b): I allways return to follow up my posts or to help someone else for that matter.
To c): Yes, it is a rare special case, but only for Perl I think. Network applications now uses more and more threads and to be able to monitor or log the traffic is useful. Perl is more restrictive than other languages like Java on sharing data amongst treads.

If the Update thread calls $Q-dequeue first, then the callbacl function will not be able to retrieve that data from the queue. And vice-versa. Once you unstacked data, you can't unstack it again.
But that was not my intension. Update()-thread were the only one who got to $Q->dequeue and then supply callback function with the data. But your pseudocode looks better so I leave that solution for the moment. (as usual when you convince me of a better way) ;)

Assuming, based on my knowledge of other windowing systems, that each Tk window receives some event to indicate that the window needs to be redrawn--lets call it the Update event--then the following (very) psuedo-code may clarify the idea.
In "Perl CD bookshelf"->Tk Chapter 15.2 there is a list of legal event types. See here:

Event type

Brief description

Activate

Currently unused.

ButtonPress (or Button)

A mouse button was pressed.

ButtonRelease

A mouse button was released.

Circulate

A widget's stacking order has changed.

ColorMap

A widget's colormap has changed.

Configure

A widget has changed size or position and may need to adjust its layout.

Deactivate

Currently unused.

Destroy

A widget was destroyed.

Enter

The cursor has moved into a widget.

Expose

All or part of a widget has been uncovered and may need to be redrawn.

FocusIn

A widget has gained the keyboard focus.

FocusOut

A widget has lost the keyboard focus.

Gravity

A widget has moved because its parent changed size.

KeyPress (or Key)

A key has been pressed.

KeyRelease

A key has been released.

Motion

The cursor is in motion over a widget.

MouseWheel

The mousewheel is scrolling.

Leave

The cursor has moved out of a widget.

Map

A widget has been mapped onto the display and is visible.

Property

A widget property has changed.

Reparent

A widget has been reparented.

Unmap

A widget has been unmapped from the display and is no longer visible.

Visibility

A widget's visibility has changed.

The closest is Expose but not the one I want. A general redraw-event may not be access at user level. Some investigate is needed to confirm that.
But I don't know that it is going to work anyway. If the User just observe the window and don't interact with it, no redraw event will occur. You should be able to only observe the progress without taking any action that will generate the event.

In the last line of your post, it started with YW, did not get it. I believe that it is a shortening or maybe slang of something. Enlighten me please :)
I have put this program on hold for the moment until I have figured out how to do it, so I'm not in a hurry.
Threads and Perl may not go hand-in-hand but I choose it because of its powerful text-handling capabilites.


In reply to Re^8: Problem with using threads with modules. by tele2mag
in thread Problem with using threads with modules. by tele2mag

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.