in reply to Re: XML::Twig parsefile_inplace misunderstanding (xml_pp twig_handlers _all_ flush)
in thread XML::Twig parsefile_inplace misunderstanding

thanks Corion and Anonymous,

so the inplace options are valid only during the scope of the parse_inplace call? after this normal behaviour and handle are restored?

So it can be used only with the on-the-fly processing style and not with the tree-processing one? Should be not difficult replicate the inplace behaviour but i prefer to use the XML::Twig method for shortness and laziness.

thanks

L*
there are no rules, there are no thumbs..
  • Comment on Re^2: XML::Twig parsefile_inplace misunderstanding (xml_pp twig_handlers _all_ flush)
  • Download Code

Replies are listed 'Best First'.
Re^3: XML::Twig parsefile_inplace misunderstanding (xml_pp twig_handlers _all_ flush)
by Anonymous Monk on Jul 19, 2013 at 09:57 UTC

    so the inplace options are valid only during the scope of the parse_inplace call?

    UTSL :) its

    select temp handle; parsefile; restore original handle; rename /backup;

    So it can be used only with the on-the-fly processing style and not with the tree-processing one?

    That is tree mode. If you change the flush to a print, you'll see lots and lots of duplicated output.

    but i prefer to use the XML::Twig method for shortness and laziness.

    short/lazy things are supposed to be easy/obvious to use, I think this one got kind of got away from mirod, but its not like I have better ideas, I mean come on :)

    $twig->infile('file.xml') ->backup('.bak') ->tempout ->parseit ->replaceoriginalwithtemp