in reply to open* and buffered program output

I've not written scripts along these lines before, but have you looked into Expect and also the $| variable? I think $| sets the flushing behavior on Perl's output only, but I could be wrong. The Expect module is designed to automate use of this sort of prompt-the-user tool.

--
[ e d @ h a l l e y . c c ]

Replies are listed 'Best First'.
Re: Re: open* and buffered program output
by narse (Pilgrim) on Feb 20, 2004 at 20:33 UTC
    Simply doing $|++ doesn't help me in this case. Nor does setting autoflush(). I suppose I should be using getc() but that does not seem like a very perl way of doing things. I was hoping for something more interesting like setting the end of line delimiter to a regex but I don't see a way of doing this. I wouldn't want to create my own buffer for assembling characters back into strings. Any thoughts?
      Two possibilities for you.

      One is that the message that you are trying to capture may be sent on STDERR, not STDOUT. If so then you are just listening on the wrong handle.

      The other is that the buffering is not happening in Perl, but in tar. If that is the case, then you could use something like IO::Pty to fool tar into thinking that it is talking to a terminal, and not on a pipeline.