in reply to IO::Select question
This will at first wait until you type something, and after that scroll with 'waiting to read' 'can read', even if you don't type anything more.$sel = IO::Select->new(); $sel->add(\*STDIN); while(1) { print "waiting to read:\n"; my @handles = $sel->can_read(); print "can read\n"; foreach $h (@handles) { if($h == \*STDIN) { my $line = <STDIN>; my $finish = do_something_with_line($line); } } if($finish) {last;} }
C.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: IO::Select question
by Eradicatore (Monk) on Jan 21, 2003 at 17:24 UTC | |
by castaway (Parson) on Jan 21, 2003 at 17:45 UTC | |
by Eradicatore (Monk) on Jan 21, 2003 at 18:36 UTC | |
by Coruscate (Sexton) on Jan 21, 2003 at 22:12 UTC | |
by Eradicatore (Monk) on Jan 21, 2003 at 23:30 UTC |