Output buffering problems during recursion

Discussion in 'Perl' started by Tim Mohler, Sep 15, 2003.

  1. Tim Mohler

    Tim Mohler Guest

    All -

    I have a script that provides a web page interface to various system
    utilities. Once the user has selected the utility and input various
    parameters, it calls itself with a different method and input value,
    for instance ping.

    During the initial call, the output is not buffered, but on the second
    call, the actually executes the utility, output is buffered until the
    command completes.

    I have $| set to 1 in both the initial user form routine and during
    the utility routine.

    I am using perl 5.8 and Apache 2.0.40. On the old box, with perl 5.6
    and Apache 1.3, it works perfectly. Also, on the new box (with the new
    versions) a simple perl script called from the command line runs
    utilities like ping perfectly with no buffering.

    Anyone have any ideas?

    Thanks
    Tim Mohler
    Tim Mohler, Sep 15, 2003
    #1
    1. Advertising

  2. Tim Mohler <> wrote:
    > I have a script that provides a web page interface to various system
    > utilities. Once the user has selected the utility and input various
    > parameters, it calls itself with a different method and input value,
    > for instance ping.
    >
    > During the initial call, the output is not buffered, but on the second
    > call, the actually executes the utility, output is buffered until the
    > command completes.
    >
    > I have $| set to 1 in both the initial user form routine and during
    > the utility routine.


    $| doesn't actually have anything to do with buffering. It tells
    perl to flush the selected filehandle's stdio buffers after each
    write.

    When you fork and exec an external program (like ping), the child
    process will set up its *own* stdio buffers without knowing or caring
    anything about $|. The only thing it cares about, usually, is whether
    standard output is connected to a terminal -- if you hook it up to a
    pty (with e.g. Expect or IO::pty) you'll probably get line-buffered
    output.

    --
    Steve
    Steve Grazzini, Sep 16, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U2NvdHRPbmVz?=

    Buffering the output of multiple controls

    =?Utf-8?B?U2NvdHRPbmVz?=, Oct 27, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    506
    =?Utf-8?B?a2Fub25lcw==?=
    Oct 28, 2004
  2. Mark Riordan
    Replies:
    6
    Views:
    4,865
    Mark Riordan
    Oct 15, 2004
  3. JD

    output buffering

    JD, Nov 11, 2005, in forum: Python
    Replies:
    5
    Views:
    289
  4. Shahid Juma

    Output Buffering

    Shahid Juma, Oct 5, 2004, in forum: ASP General
    Replies:
    1
    Views:
    131
    Ray Costanzo [MVP]
    Oct 5, 2004
  5. Replies:
    8
    Views:
    721
    John Reye
    Apr 26, 2012
Loading...

Share This Page