in reply to Disabling Buffering

The surest, simplest way would be to just pass an argument (--nobuffer) or set something in the environement from your launching program, then check for that inside your perl (either by parsing @ARGV or looking at $ENV{HEYDONOTBUFFER} or what not).

Replies are listed 'Best First'.
Re^2: Disabling Buffering
by richz (Beadle) on Nov 29, 2004 at 20:48 UTC
    Fletch, that's not the question I am asking an answer to.

    What I want is a clean way of making both STDERR and STDOUT hot for the entire perl script. I just want to add code at the top of the script so that when I do my check to see if I want buffering I can add code to make the filehandles hot.

    This is what I want ideally if possible:

    if(want to buffer) { ..... something to make STDERR and STDOUT hot for entire script .... }

    TIA.

      So do it. If you set autoflush on a handle it'll stay unbuffered until something else sets it back. Unless you have code that's twiddling $| or doing STDOUT->autoflush( 0 ) they should stay that way.

        Fletch, I have been looking for a way to catch stdout and stderr from my own Win32::Process::Create() call -- looks like you got that problem handled, can you please reply with your method? Thanks so much, and yes I'm desperate... Mark