Posted on 2007-08-16 18:07:53-07 by mirod in response to 5894
Re: Determining if twig has been modified

At the moment there is nothing that tells you whether a twig was changed, and adding that would be both difficult and bad for performances. What you can do is set a flag in any piece of code that would modify the twig. Maybe you could even automate that to a point by using Hook::LexWrap or something similar. An other option is to subclass XML::Twig::Elt and to redefine the methods that are likely to be used to change the twig (once again, you could use Hook::LexWrap to do this automagically) so they set a flag. Saddly enough the complete list of those methods doesn't exist, and is pretty long. Plus what happens if, for example, you cut an element and then paste it back in the same position?

If you posted a detailed example, I could probably suggest some other ways to do this (how about diffing the input xml and the output, if they aren't too big?).

--
mirod

Direct Responses: 5916 | Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.