in reply to Re^2: Doubt on defined-ness
in thread Doubt on defined-ness

Interesting idea... but I can't even get that to return an empty string:

#!/usr/bin/perl use Fcntl; fcntl(STDIN, F_GETFL, my $flags) or die "Couldn't get flags: $!\n"; fcntl(STDIN, F_SETFL, $flags|O_NONBLOCK) or die "Couldn't set flags: $ +!\n"; $_=<STDIN>; use Data::Dumper; print Dumper $_; # --> prints $VAR1 = undef;

Maybe you can construct a better case (?)

Replies are listed 'Best First'.
Re^4: Doubt on defined-ness
by ikegami (Patriarch) on Jun 18, 2008 at 23:42 UTC

    I said "maybe", as in "it's something to try". I have no experience with non-blocking handles. Reportedly, IO::Handle::blocking doesn't even work on my OS.

    That said, I do have access to a linux machine, and I'm getting the same result (undef) using STDIN->blocking(0).

      Anyhow...   Good to have learned IO::Handle provides a blocking method :)