in reply to Re: Non-buffered read from program
in thread Non-buffered read from program

IO::Select seems like a good choice, but unfortunately it does not work. i.e. if the whois server is unavailable, I get no output.

open my $WHOIS, "jwhois x.x.x.x 2>&1 |"; my $s = IO::Select->new($WHOIS); while (my @ready = $s->can_read) { for my $fh (@ready) { if ($fh == $WHOIS) { my $buf = <$fh>; if ($buf) { print $buf; } else { close($fh); } } } }

Note that this works great, if the server sends some output and then closes the connection, but not for servers which send some output and then hang.


--
Rohan