1 # currently works neither with perl-5.8.0@29163 nor 29243 but has
4 # Now, after a 'stty sane' again works with 29163 and 29243
10 my $cv = AnyEvent
->condvar;
12 my $io_watcher = AnyEvent
->io (fh
=> \
*STDIN
,
15 warn "io event <$_[0]>\n"; # will always output <r>
16 chomp (my $input = <STDIN
>); # read a line
17 warn "read: $input\n"; # output what has been read
18 $cv->broadcast if $input =~ /^q/i; # quit program if /^q/i
21 my $time_watcher; # can only be used once
24 $time_watcher = AnyEvent
->timer (after
=> 2,
26 warn "timeout\n"; # print 'timeout' about every second
27 &new_timer
; # and restart the time
31 new_timer
; # create first timer
33 $cv->wait; # wait until user enters /^q/i