ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/eg/event
Revision: 1.2
Committed: Sun Jul 15 03:24:18 2001 UTC (22 years, 11 months ago) by root
Branch: MAIN
Changes since 1.1: +26 -7 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 #!/usr/bin/perl
2
3 use Coro;
4 use Coro::Event;
5
6 my $stdin = Coro::Event->io(fd => \*STDIN, poll => 'r');
7
8 sub kbdline {
9 $stdin->next;
10 my $x = <STDIN>; chomp $x; $x;
11 }
12
13 sub keyboard : Coro {
14 $|=1;
15 while() {
16 print "cmd> "; my $cmd = kbdline;
17 print "data> "; my $data = kbdline;
18 print "cmd<$cmd> data<$data>\n";
19 print "working...";
20 do_timer(after => 1);
21 print "done\n";
22 }
23 }
24
25 sub idle : Coro {
26 my $w = Coro::Event->idle(min => 1, max => 2);
27 while () {
28 $w->next;
29 print ".";
30 };
31 }
32
33 Coro::Event->main;
34