Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Handling program output in real time

by Anonymous Monk
on Nov 10, 2003 at 06:31 UTC ( [id://305803]=note: print w/replies, xml ) Need Help??


in reply to Handling program output in real time

You need to set $| = 1; in "blackbox.pl".

Replies are listed 'Best First'.
Re: Re: Handling program output in real time
by dvergin (Monsignor) on Nov 10, 2003 at 07:04 UTC
    Yes, that *does* produce the desired behavior. (Interesting that the output from blackbox.pl spits out over time at the command line but not when it is piped. Hmmm...)

    Unfortunately the actual program I am trying to track is pilot-xfer which reports its progress incrementally at the command line. And I have no control over its output buffering or whatever. It is what it is. (Thus the name of the stand-in: "blackbox".)

    So where does that leave me in trying to solve my problem in the monitor program (the second one given)?

      IO::Pty may help you (system dependent), if your monitor program can emulate a terminal (tty) the xfer program will give it line buffered output (which is what you want).
        I have stared very hard at the docs for IO::Pty and I can't dope out how to use it here. No doubt this is in part because I don't understand what is meant by: "the creation of a pseudo tty". (The topic is outside my normal field of Perl endeavors.)

        Can you show how IO::Pty could be used to modify the second program in the OP (the program with PIPE1 in it) so that it would process the output from blackbox.pl in real time (leaving blackbox.pl untouched)?

        Regarding the "system dependent" issue, I am running Linux 7.3 with the 2.4.20-20.7 kernel. I gather from the docs for IO::Tty that I sould be okay in that respect.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://305803]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-03-29 13:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found