in reply to Re: XML::Twig - Filtering and duplexing output to multiple output files
in thread [SOLVED] XML::Twig - Filtering and duplexing output to multiple output files

The problem in this case is the flush method, which does some light magic to output the parts of the tree that haven't been output yet, and then updates the state of the XML::Twig object (so the next call to flush Just Works™). You can't call it twice in a row, with 2 different filehandles, it wouldn't work. That's why using IO::Tee is a brilliant idea.

Replies are listed 'Best First'.
Re^3: XML::Twig - Filtering and duplexing output to multiple output files
by Discipulus (Canon) on Nov 13, 2014 at 08:47 UTC
    obviously the author is right!
    See indeed the docs about flush

    You cannot hack it using print or sprint because they have to be used AFTER parse. lesson learned. Thanks.

    L*
    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.