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

Comparing Coro/eg/event (file contents):
Revision 1.8 by root, Fri Jul 27 02:51:33 2001 UTC vs.
Revision 1.9 by root, Sun Apr 14 01:18:38 2002 UTC

10sub finger { 10sub finger {
11 my $user = shift; 11 my $user = shift;
12 my $host = shift; 12 my $host = shift;
13 13
14 my $fh = new Coro::Socket PeerHost => $host, PeerPort => "finger" 14 my $fh = new Coro::Socket PeerHost => $host, PeerPort => "finger"
15 or die; 15 or die "$user\@$host: $!";
16 16
17 print $fh "$user\n"; 17 print $fh "$user\n";
18 18
19 print "$user\@$host: $_" while <$fh>; 19 print "$user\@$host: $_" while <$fh>;
20 print "$user\@$host: done\n"; 20 print "$user\@$host: done\n";
38 print "unknown command '$cmd', either 'finger' or 'quit'\n"; 38 print "unknown command '$cmd', either 'finger' or 'quit'\n";
39 } 39 }
40 } 40 }
41} 41}
42 42
43async { finger("root", "localhost") };
44
43# display the time or garble the display, YMMV. 45# display the time or garble the display, YMMV.
44sub timer : Coro { 46sub timer : Coro {
45 my $w = Coro::Event->timer(interval => 0.001, hard => 1); 47 my $w = Coro::Event->timer(interval => 0.001, hard => 1);
46 use Time::HiRes qw(time); 48 use Time::HiRes qw(time);
47 while () { 49 while () {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines