Does the text file need to be in a particular format? If not, you're free to choose any serialization format you like, be it XML, YAML, JSON, or something else. Personally, I might recommend YAML, as it maps to Perl data structures better than JSON and is less verbose than XML. See for example YAML::XS.
| [reply] |
"[YAML] maps to Perl data structures better than JSON ..."
I was not aware of that. I do recall having some issues with de-serializing anonymous subs into Perl data from JSON text, but i would like for you to give more details as to why you have this opinion, please. In the meantime, i found this link which has more interesting perspectives on which to use: http://stackoverflow.com/questions/1876735/should-i-use-yaml-or-json-to-store-my-perl-data
I myself have opted to use JSON for feeding information to programs (robots) and YAML for feeding information to humans. :) I also try to keep my data simple, which means not having to worry about anonymous sub references. I strive to keep my data in my data and my code in my code.
jeffa
L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)
| [reply] [d/l] [select] |
i would like for you to give more details as to why you have this opinion, please
The opinion was perhaps stated a little more strongly than it should have been. When I was choosing a serialization format a year or two ago, I recall having an easier time getting YAML to round-trip certain data structures (I think it was undefs, numeric values and/or booleans) more cleanly than JSON. If I have a little more time later I might try to reproduce those issues.
| [reply] [d/l] |
So a quick test showed that both YAML::XS and JSON::XS round-trip some simple data structures equally well. So now I'm not sure anymore if back then I was testing different modules which did have issues round-tripping some data structures, or whether I'm just remembering wrong.
One thing I did remember is that I like YAML's facilities for including string literals, kind of like here docs:
---
foo: |
Hello
World: cool
I'm a three-line string literal
AFAIK there's no here docs in JavaScript / JSON... | [reply] [d/l] |