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

Doesn't seem to work on mine. IO::Handle too does not help.

use strict; use warnings; use IO::Handle; open my $WHOIS, "jwhois x.x.x.x 2>&1 |"; my $io = IO::Handle->new; $io->fdopen($WHOIS, "r"); $io->blocking(0); print $io->getline; $io->close;

I don't get any output, if the server is unavailable.


--
Rohan

Replies are listed 'Best First'.
Re^3: Non-buffered read from program
by myuji (Acolyte) on Dec 30, 2005 at 14:44 UTC
    Do you mean to use $io->autoflush(1) ? Try this code:
    use strict; use warnings; use IO::Handle; open my $WHOIS, "whois x.x.x.x 2>&1 |"; my $io = IO::Handle->new; $io->fdopen($WHOIS, "r"); $io->autoflush(1); while(my $line = $io->getline){ print $line; } $io->close;
    This is working fine on my environment.