ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/eg/event
(Generate patch)

Comparing Coro/eg/event (file contents):
Revision 1.12 by root, Sat Apr 14 15:12:30 2007 UTC vs.
Revision 1.13 by root, Mon Nov 24 04:56:38 2008 UTC

22 print "$user\@$host: $_" while <$fh>; 22 print "$user\@$host: $_" while <$fh>;
23 print "$user\@$host: done\n"; 23 print "$user\@$host: done\n";
24} 24}
25 25
26# display the time or garble the display, YMMV. 26# display the time or garble the display, YMMV.
27sub timer : Coro { 27async {
28 my $w = Coro::Event->timer (interval => 0.001, hard => 1); 28 my $w = Coro::Event->timer (interval => 0.001, hard => 1);
29 use Time::HiRes qw(time); 29 use Time::HiRes qw(time);
30 while () { 30 while () {
31 $w->next; 31 $w->next;
32 print "\e7\e[C\e[C\e[C\e[C\e[C\e[C\e[C\e[C <time ", time, "> \e8"; 32 print "\e7\e[C\e[C\e[C\e[C\e[C\e[C\e[C\e[C <time ", time, "> \e8";
33 }; 33 };
34} 34};
35 35
36my $stdin = new_from_fh Coro::Handle \*STDIN; 36my $stdin = new_from_fh Coro::Handle \*STDIN;
37 37
38$SIG{PIPE} = 'IGNORE'; 38$SIG{PIPE} = 'IGNORE';
39 39
43 if ($cmd eq "finger") { 43 if ($cmd eq "finger") {
44 print "user> "; my $user = <$stdin>; chomp $user; 44 print "user> "; my $user = <$stdin>; chomp $user;
45 print "host> "; my $host = <$stdin>; chomp $host; 45 print "host> "; my $host = <$stdin>; chomp $host;
46 async { finger $user, $host }; 46 async { finger $user, $host };
47 } elsif ($cmd eq "quit") { 47 } elsif ($cmd eq "quit") {
48 $quit->send; 48 last;
49 } else { 49 } else {
50 print "unknown command '$cmd', either 'finger' or 'quit'\n"; 50 print "unknown command '$cmd', either 'finger' or 'quit'\n";
51 } 51 }
52} 52}
53 53

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines