Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Echoless terminal state after exiting Tk/Term::ReadLine event loop (Solved!)

by zentara (Archbishop)
on Nov 01, 2009 at 14:52 UTC ( #804346=note: print w/ replies, xml ) Need Help??


in reply to Echoless terminal state after exiting Tk/Term::ReadLine event loop (Solved!)

... have you perchance seen Term::ReadLine and Tk - Solved ?


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


Comment on Re: Echoless terminal state after exiting Tk/Term::ReadLine event loop (Solved!)
Re^2: Echoless terminal state after exiting Tk/Term::ReadLine event loop (Solved!)
by gnosti (Friar) on Nov 01, 2009 at 17:23 UTC
    Thanks. I have Tk and Term::ReadLine playing well together using the same basic code as this example.

    In the same project, I also have a use case where Tk is not running. I am using Event.pm there. From the link you provided, I see that event loops can live together. I'm also curious if I can simplify my code by using AnyEvent to provide the same interface, regardless of the underlying event loop.

      I see that event loops can live together.

      to be honest, it seems that you want to do complicated nested loop operations, but by using a distinct set of modules, which may or may not be thread safe or reliable together

      there is a solution, however.... the GLib module, which is the Perl interface to the glib, (upon which gtk2 is based.... so its on alot of systems.... firefox uses it on linux)

      So Glib has your basic eventloop, that has been well thought out..

      ...it works in threads....you can nest the loops.....you can give threads context, and priorities.... etc....

      So I would switch to GLib if you want looping complexity.....and for that matter.....the glib c library is pretty simple to code for basic loop recipes like timers and filehandle watching.....plus the c does a cleaner job of thread memory reclamation(as compared to Perl)..... it is so elegant in depth, that you probably could model the thought process with it


      I'm not really a human, but I play one on earth.
      Old Perl Programmer Haiku
        Nice of you to suggest Glib, which appears to be useful for many functions besides events.

        My needs at present are really pedaestrian--just a couple of basic watchers--only complicated because the app I'm working on has terminal-based and Tk-GUI interfaces. I pretty much have to use Tk::event for the Tk and Tk/ReadLine side. I have similar watchers written using Event.pm for the text interface, because I don't want to force Tk on people who might be console users. So it won't be both loops together. Just one of the other. It looks like AnyEvent will let me code identically to both Event and Tk::event backends, as well as to Glib or Wx if I decide I want to snazz up my GUI.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (11)
As of 2014-09-22 14:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (197 votes), past polls