in reply to best practice when using XML::Parser and strict.
The best practice for using XML::Parser is to not use XML::Parser.
The XML::SAX API is very similar to XML::Parser's Handler style except that because it uses objects, your handlers are methods and can maintain state in the object itself. Which solves exactly the problem you've encountered.
Another advantage of SAX is that it's modular. So when you run into the problem of text content being split across multiple events, you don't need to code around it, you just plug in XML::Filter::BufferText and move on.
|
|---|