# 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__