in reply to Re: selecting from a number of different input sources.
in thread selecting from a number of different input sources.

The file that I am readnig from is constantly being written to by some other source, so its not a static file. At times getline will block when there is no new data, and at times it won't when there is new data.

  • Comment on Re^2: selecting from a number of different input sources.

Replies are listed 'Best First'.
Re^3: selecting from a number of different input sources.
by ikegami (Patriarch) on Jul 21, 2010 at 17:25 UTC

    At times getline will block when there is no new data

    I'll repeat: No, it won't.

    $ perl -le'$|=1; for (;;) { print "poke"; sleep 1; }' > file & perl -M +IO::Handle -e'sleep 3; print while $_ = STDIN->getline; print "exited + instead of blocking\n"' < file ; fg [1] 29483 poke poke poke poke exited instead of blocking perl -le'$|=1; for (;;) { print "poke"; sleep 1; }' > file ^C $ cat file ; rm file poke poke poke poke poke poke
Re^3: selecting from a number of different input sources.
by runrig (Abbot) on Jul 21, 2010 at 17:34 UTC