I have had a similar experience with
Storable. I used to
freeze a data structure, store it as a
blob in a (MySQL) table, then
thaw it upon use. That worked all well and fine until either:
- The Storable module was updated.
- The application was migrated from a 32-bit to 64-bit server, or vice versa.
- The application was moved to an operating system with a different endianness.
Any of the above rendered the stored data unusable and meant the data had to be converted, all of which would have been completely unnecessary had we used a
textual ascii representation to begin with. Additionally, one cannot easily
view the contents of the data when stored using a binary representation, which makes inspection, debugging and testing much more difficult than it should be.
I ended up using String::Escape's hash2string and string2hash to (de)serialize the data and store it as text. Easy to use, understand, inspect and test, while completely platform-independent and probably not slower than any binary conversion.
See also The Importance of Being Textual chapter of Eric S. Raymond's book The Art of Unix Programming:
Text streams are a valuable universal format because they're easy for human beings to read, write, and edit without specialized tools. These formats are (or can be designed to be) transparent.
Designing a textual protocol tends to future-proof your system.
--
No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]
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.