the simple Store/Retrieve is all I needed. -- Ah, the simple store/retrieve is not so simple.

My personal preference between YAML, Storable, and JSON is YAML. As for version of YAML, I'm not fussy so I use YAML::Any. That way I can use whatever YAML (XS, Old, other) that has been installed on the host system.

YAML handles a much wider range of data structures than JSON, as wide as Storable, and it won't blow up on you if you just happen to have a circularity in your data.

I prefer YAML over Storable, because YAML is human readable and machine/Perl version independent. The main issue with Storable is that the data is dumped exactly as Perl stores it in C, which means that it is machine specific and possibly Perl release specific. You can't assume that a file you dump on your machine will load properly on another machine.

Since Storable dumps in a format efficient for the computer and not a person, its output is not at all easy to inspect, if you are trying to figure out what went wrong. Finally, it is a bit fussy to test dumped data (did I get what I expected?) in an automated fashion because small details about the way a variable is handled during the life of the program (namely whether it was used as a string, number or both) can change the way a number is dumped.

Since JSON is also human readable, JSON is often pushed as the faster, more "hip" substitute for YAML, but there are some limitations that really make it only suitable for very simple kinds of data. Neither Storable or YAML face any of these limitations.


In reply to Re: Converting from Storable to YAML by ELISHEVA
in thread Converting from Storable to YAML by raybies

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.