develooper Front page | perl.perl5.porters | Postings from January 2012

Re: [perl #108470] Term::ReadLine should use AE instead of Tk for event looping

Thread Previous | Thread Next
From:
Darin McBride
Date:
January 20, 2012 10:52
Subject:
Re: [perl #108470] Term::ReadLine should use AE instead of Tk for event looping
Message ID:
1950627.MyxNCUXCus@naboo
On Friday January 20 2012 5:52:11 AM you wrote:
> On Wed, Jan 18, 2012 at 07:27:35AM -0700, Darin McBride wrote:
> > I'm curious as to how you would receive events registered wtih Event while
> > T::RL is waiting for text, since T::RL is currently going to be spinning
> > the Tk event loop, not the Event event loop, unless you have an idle
> > callback registered with Tk that simply spins the Event loop once.
> 
> Here is a demonstration code, which depends on Term::ReadLine::Gnu.

This is interesting.  You're right - you need Term::ReadLine::Gnu.  However, 
you've completely bypassed all the Tk code completely.  There is no Tk loop 
going on.

I suspect that with these patches, you may be able to use T::RL::P, albeit a 
bit differently.  T::RL becomes your event loop, which is entirely unfortunate, 
but would require a vastly different front-end interface, I believe, than what 
we have now, and require significant changes to the backends as well.  Way too 
much change to shoehorn in here.  If I want to go down that road, it'd be with 
an entirely new CPAN module that would be unlikely to ever make it to core.  
At least with this, I should be able to use Coro to get it working "right", 
regardless of the event model I need for other purposes, and still be able to 
use T::RL::Perl.

T::RL::G is almost providing that support, and you've shoehorned it in, but 
the tradeoff is that for people like me who have had problems installing 
T::RL::G, your code won't be supported.  I'm not complaining, merely 
observing.

> $term->callback_handler_install( "> ", sub{ print "got: @_\n" });

This.  Turns the whole thing on its head. :-)

Thanks, Joel.  I appreciate it.  I'll leave it up to someone higher up on the 
food chain to decide if this patch is still needed (I think so), and what else 
needs to be done to accept it, and on what timetable :-)


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About