in reply to XML::Writer

XML::Writer::Nest was developed to address the non-language-enforced indentation and tag-closing that you had to do above. here's a pdf to a talk I did explaining how to improve XML::Writer.

The mantra of every experienced web application developer is the same: thou shalt separate business logic from display. Ironically, almost all template engines allow violation of this separation principle, which is the very impetus for HTML template engine development.

-- Terence Parr, "Enforcing Strict Model View Separation in Template Engines"