Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Keep It Simple, Stupid
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (13)
As of 2014-04-23 09:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (541 votes), past polls