Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Using AnyEvent with Term::ReadLine::Gnu

by gnosti (Friar)
on Jan 22, 2012 at 03:18 UTC ( #949213=note: print w/ replies, xml ) Need Help??

in reply to Using Term::ReadLine in an event loop other than Tk [SOLVED]

Here is a solution that depends on Term::ReadLine::Gnu.

# Sample code showing how to integrate # Event with Term::ReadLine::Gnu (uses AnyEvent for watcher syntax) 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(); exit; } ); Event::loop(); __END__

Comment on Using AnyEvent with Term::ReadLine::Gnu
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2015-10-10 08:57 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (255 votes), past polls