My own timid excursion into XML was made for two reasons:
- Tied hashes between two systems (e.g. my hosted website
and my local mirror) can be incompatible, depending on the db
engines employed.
- Tied hashes normally encompass only one level. Hashes
containing arrays and other hashes can be cumbersome to
implement.
What I was hoping to achieve was a portable, readable file
capable of containing a complex Perl data structure, that I
could slurp into memory, manipulate, and write back out.
XML::Simple is the putative answer to these goals. It was
pretty simple, but not brain-dead simple. Some of the arrays
embedded in my hash have only one element. Apparently XML,
by itself, is unable to distinguish between a single-element
array and a scalar, so there is no a priori one-to-one
correspondence between plain XML and a Perl data structure.
XML::Simple gives you a way to force certain elements to be
arrays when the XML file is read, but this amount of finagling
was contrary to my objectives.
Would I use XML again? Probably not as a general-purpose
embodiment of a Perl data structure. For that, I would look
around for another format, another module -- or write my
own. But my mind is still open for other applications. With
this much smoke and heat, there's gotta be a fire somewhere!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Outside of code tags, you may need to use entities for some characters:
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|