perl anyevent

 

 

使用anyevent:

 

#!/usr/bin/perl -w

use AnyEvent;

 

$| =1; print "Enter you name\n";

my $cv = AnyEvent->condvar;

my $name;

my $wait_for_input=AnyEvent->io(

fh=> \*STDIN,

poll=>"r",

cb=>sub {

$name=<STDIN>;

print $name;

$cv->send;

}

);

 

 

print "do something first\n";

 

$cv->recv;

你可能感兴趣的:(anyevent)