[Vlaanderen] setting up a file hierarchy

Jurgen Pletinckx jurgen.pletinckx at algonomics.com
Tue May 19 06:55:48 PDT 2009


Please help me do my homework :)


I've got a module which creates .docx files. Those are 
Microsoft's latest Word format, as described in the 
OOXML standard.

OOXML is not too gruesome to work with, and I'm having 
a great time stuffing my reports with figures and tables
and whatnot.

However, one very smelly piece of code is the creation 
of a new document. A .docx file is just a zip container
with a handful of XML documents (plus extra media, if 
applicable). For most of these, the default content is
fine. But what is the optimal way of generating them?

I currently find myself doing a lot of "mkdir"s and 
"print OUT <<EOF"s, but that's messy. I could set up
a template folder (next to the module?) and copy that
around, but that feels awkward as well. 

I set up the hierarchy in a folder, and package that 
up with Archive::Zip, as it makes interactions with the
files easier. I could write directly into a zip file,
but that doesn't really make a difference to the 
problem. 

So. Any prior art? How should one treat non-code 
dependencies?

(Note: I'm not bothered about deploying this stuff,
this is for now strictly internal. Although, there
doesn't seem to be _anything_ for OOXML on CPAN.
Opportunity!) 


--
Jurgen Pletinckx





More information about the Vlaanderen mailing list