in reply to which XML module?

The Perl XML FAQ has advice on choosing a parser module but doesn't really say anything about writing XML (patches welcome).

One approach is to generate SAX events and use XML::SAX::Writer to generate the XML. Kip Hampton's XML::Generator::PerlData could be useful for generating the SAX events from a Perl data structure.