in reply to Re: XML-Twig: Tree building and printing
in thread 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.

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

  • Comment on Re^2: XML-Twig: Tree building and printing

Replies are listed 'Best First'.
Re^3: XML-Twig: Tree building and printing
by frozenwithjoy (Priest) on Jun 25, 2012 at 06:55 UTC
    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

        Then why not try to actually explain this to the OP instead of just talking about how my suggestion in response to his/her question about flushing is nonsense?