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.
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. |
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |