The following module was proposed for inclusion in the Module List: modid: XML::FromArrayref DSLIP: adpfa description: Output XML described by a Perl data structur userid: NICWOLFF (Nic Wolff) chapterid: 11 (String_Lang_Text_Proc) communities: https://github.com/nicwolff/XML-FromArrayref/issues
similar: XML::Writer, XML::Simple rationale: Writing out valid XML is still a pain. The procedural approach of modules like XML::Writer is clunky - you still have to balance closing tags! Perl's data structures can express hierarchical data very concisely, but there's no easy way to turn a data structure into XML. XML::Simple::XMLout() kind of works, but uses a hash for element content so it loses child element order. This module turns an arrayref into XML in a straightforward and predictable fashion. Elements and attributes whose names eval false get skipped, which makes optionally wrapping an element very natural: [ $bold && b => 'This is bold if $bold was true' ] And using map() and grep() to generate or filter repeated elements is great fun. I considered a more general namespace, maybe under SGML::, that this and my similar HTML::FromArrayref could be under, but that module is already in CPAN under HTML:: so this one would just have a weird name. Thanks for your time! enteredby: NICWOLFF (Nic Wolff) enteredon: Thu Oct 31 20:58:24 2013 UTC The resulting entry would be: XML:: ::FromArrayref adpfa Output XML described by a Perl data structur NICWOLFF Thanks for registering, -- The PAUSE PS: The following links are only valid for module list maintainers: Registration form with editing capabilities: https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=d2e00000_15c8a59d398465ae&SUBMIT_pause99_add_mod_preview=1 Immediate (one click) registration: https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=d2e00000_15c8a59d398465ae&SUBMIT_pause99_add_mod_insertit=1 Peek at the current permissions: https://pause.perl.org/pause/authenquery?pause99_peek_perms_by=me&pause99_peek_perms_query=XML%3A%3AFromArrayref