Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: threads, file handles and wxPerl

by zentara (Archbishop)
on Feb 13, 2013 at 16:24 UTC ( #1018568=note: print w/ replies, xml ) Need Help??

in reply to threads, file handles and wxPerl

I haven't found any way to get the handle from the thread to the main window loop

Try using the fileno of the filehandle. See FileHandles and threads for the basics. Also [threads] Open a file in one thread and allow others to write to it may yield a clue.

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Comment on Re: threads, file handles and wxPerl
Replies are listed 'Best First'.
Re^2: threads, file handles and wxPerl
by sdetweil (Sexton) on Feb 13, 2013 at 17:02 UTC
    thanks.. using the fileno() gets me the results I need.. (if you clone the handle as input when u need to write to it!. well you get what you get!)
    this is the output approach
    open my $fh, ">&=$CHILD_FILENO";

      Be careful. The file won't close until you close both handles; but you have to ensure than you do not close the first handle before the the thread has had a chance to clone it. You may need a shared var as a semaphore to coordinate things.

      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        thank you. I added close $fh; after the write in the event handler. I am letting the thread ending close the open3() created handles cause they were declared as local(). Should I do that explicitly? (adding it didn't cause any issues);

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1018568]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2015-11-27 08:22 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (722 votes), past polls