in reply to Using File::Tail::select with STDIN?

Hello phillipdhall, and welcome to the Monastery!

The error arises because File::Tail::select expects each element of your @handles array to be a File::Tail object. So, you would need to create a File::Tail object initialised with STDIN. Except you can’t, because the documentation for the constructor rules this out:

name
 This is the name of the file to open. The file will be opened for reading. This must be a regular file, not a pipe or a terminal (i.e. it must be seekable).

So, it seems you will need to find a different approach. Maybe something using a timeout? (See the example code for the select method.)

I can’t experiment, as File::Tail won’t install on Windows. :-(

Athanasius <°(((><contra mundum

  • Comment on Re: Using File::Tail::select with STDIN?

Replies are listed 'Best First'.
Re^2: Using File::Tail::select with STDIN?
by phillipdhall (Initiate) on Aug 12, 2012 at 14:41 UTC

    Per the File::Tail documentation:

    select is intended to enable the programmer to simoultaneously wait for input on normal filehandles and File::Tail filehandles. Of course, you may use it to simply read from more than one File::Tail filehandle at a time.

    Your answer makes sense because it doesn't seem to work, but I'd say that documentation is quite misleading. I did find this bug that may be related, but it hasn't been updated in 7 years, so I'm guessing development on this module stopped a long time ago, in a galaxy far, far away...

    So for now, I believe the fork/thread methods suggested by aitap and zentara are my next learning adventure...