Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Using AnyEvent with Term::ReadLine::Gnu

by gnosti (Chaplain)
on Jan 22, 2012 at 03:18 UTC ( [id://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__

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-23 07:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found