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

Maybe on a non-blocking handle?

Replies are listed 'Best First'.
Re^3: Doubt on defined-ness
by almut (Canon) on Jun 18, 2008 at 23:31 UTC

    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 (?)

      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 :)