Storable does a binary dump. That could be an efficiency bonus or a debugging nightmare. If you want something you can inspect and read, consider either JSON or YAML.
Personally, I would recommend YAML. I've worked with both and YAML is a lot more flexible than JSON, especially when it comes to hashes. For example,
- JSON does not handle circular references safely, YAML does.
- you can control the order of hash keys much more easiliy in YAML than in JSON.
- JSON dumps blessed objects as undef or throws an exception unless the object's class has a TO_JSON method. YAML defines a default mechanism for dumping objects. If your hash key values are object references, this might be an issue.
- JSON has no syntax for encoding the class into which an object is blessed. So even if you write a TO_JSON method for the class, you will have to get creative if you want to store the class into which the hash should be blessed.
- JSON is not friendly to code ref dumps. YAML is. If your hash key values are code references, this might be an issue.
Despite a subset of nearly alike syntax, there are some small but very differences in YAML and JSON syntax. For example, YAML strings need to end with a newline. JSON barfs when they do. If you only have time to learn one, YAML will cover more use cases and take you farther.
Best, beth
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
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.