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.
Cheers,
use Term::ReadLine; # automatically loads Term::ReadLine::Gnu,
# which must be present
use Event;
use AnyEvent;
my $term = new Term::ReadLine("Test Event");
my $attribs = $term->Attribs;
$term->callback_handler_install( "> ", sub{ print "got: @_\n" });
my $stdin_watcher = AE::io(*STDIN, 0,
sub
{
$attribs->{'callback_read_char'}->();
}
);
my $timer = AE::timer(5,0,
sub
{
print "....timed out\n";
$term->rl_deprep_terminal(); # restore usual terminal behavior
exit;
}
);
Event::loop();
__END__
--
Joel Roth