Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Can I capture string typING in STDIN without press enter?

by exilepanda (Monk)
on May 30, 2012 at 14:46 UTC ( #973303=note: print w/ replies, xml ) Need Help??


in reply to Re: Can I capture string typING in STDIN without press enter?
in thread Can I capture string typING in STDIN without press enter?

Wow! This one works... I simply flush an array per each enter pressed.. and capture the last line by your method.. However, could you explain a little more what magic is inside the Glib::Idle?... I don't even know where to find the documentation... @@"


Comment on Re^2: Can I capture string typING in STDIN without press enter?
Re^3: Can I capture string typING in STDIN without press enter?
by zentara (Archbishop) on May 31, 2012 at 10:39 UTC
    Hi, see Glib MainLoop for the MainLoop documentation. Documentation is sparse, but essentially, it waits until the Glib eventloop is idle, before running the sub, so as not to interfere with it. It is seen used more when you try to use Glib or Gtk2 code from a thread. If you get into GUI's, you will often read about the thread safety of the GUI toolkit. Gtk2's thread safety is accomplished principally by only using Glib::Idle->add to access the main gui code from within the thread. Here are a couple of examples.

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
      Thanks a lot for all the suggestions and examples. I am going start with your simpler example above first ( looks more familiar style and easier for me ) but see if I will spot some thread safe is needed for the real run... this is a really nice alternative resort! Thanks again, Cheers! =)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (13)
As of 2014-07-29 13:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (217 votes), past polls