[Vlaanderen] setting up a file hierarchy

karl.moens at pandora.be karl.moens at pandora.be
Thu May 21 08:06:25 PDT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 
Perhaps using a configuration file in which you describe the structure
(and maybe even contents, if not default, of the sub-files) of the
.docx file. Your program then just reads the configuration and does
all the tedious "mkdir"s and "print OUT <<EOF"s and zips it into the
.docx file.

There are a lot of configuration file handling modules on CPAN.
Personally I like working with the YAML-format, but YMMV.

Suggestion: pose your question on www.perlmonks.org, but if it is for
homework add a little "own" code already otherwise you will not get
good replies.

Karl "CountZero"

Jurgen Pletinckx schreef:
> 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
>
>
>
> _______________________________________________
> Vlaanderen mailing list
> Vlaanderen at pm.org
> http://mail.pm.org/mailman/listinfo/vlaanderen
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
 
iEYEARECAAYFAkoVbfAACgkQJeU7XmmCbf+tnQCfVfQEWWwQORiN2Nz8a84+RXZV
pwcAn1FcP/yPYyCCvaqmilflXt54u22B
=i/ED
-----END PGP SIGNATURE-----



More information about the Vlaanderen mailing list