I would avoid Storable simply because it depends on the Perl version and the perl configuration. That would be acceptable for short-term, temporary storage (say up to a few days), but not for long-term storage. Sooner or later, you will update perl, and that may get you in trouble with Storable. Another problem is that Storabe uses a binary format, which makes it harder to debug.

The common text-based formats JSON, XML, INI, and YAML have specs that do not depend on Perl at all. Upgrading perl won't be a problem. And of course, those formats are more or less human readable.

Some relational databases have added support for data in JSON and/or XML format, so accessing JSON/XML data from within SQL is possible and should be quite efficient. I assume that you need the set of user preferencs only in Perl, not in SQL. So simply serializing your user preferences to a JSON or XML string and deserializing them back should work even without JSON/XML support from the database. In general, you would load the user preferences on login and keep them for the entire session. You write them only if the user changes some user preferences. Parsing a little bit of JSON or XML at login should not hurt much. And as a nice extra, the JSON / XML containing the user preferences is just a bit of text for the database. Storing and retrieving text works with every relational database, it keeps your code independant from the actual database.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

In reply to Re: Storable for user preferences by afoken
in thread Storable for user preferences by Bod

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.