http://www.perlmonks.org?node_id=1018568


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

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);