in reply to XML-Twig: Tree building and printing

Using IO::Handle, you can control how output to a filehandle is flushed. In your situation, you may need to go in and make a small change to the print sub in Twig.pm.

Replies are listed 'Best First'.
Re^2: XML-Twig: Tree building and printing
by Anonymous Monk on Jun 25, 2012 at 06:37 UTC

    Using IO::Handle, you can control how output to a filehandle is flushed. In your situation, you may need to go in and make a small change to the print sub in Twig.pm.

    Nonsense. If you don't want to build a giant tree in memory, you don't have to, print as soon as possible.

      What part is nonsense? When you print to a file, it doesn't automatically write to disk that instant. That would be inefficient. An example: you have a script that prints some log file to keep track of the script's progress. Unless you activate autoflush, you can't be certain that the log file represents the current status of the running script. In fact, sometimes the data destined for the log file might not be written at all until the script is completely finished executing.

        The whole thing is nonsense, flushing isn't the issue, building a second gigantic self-referential hash of hashes of hashes of hashes .... in memory is the problem

        There is no point in graft onto tree just print it