in reply to Burned by Storable

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: 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]

Replies are listed 'Best First'.
Re^2: Burned by Storable
by perrin (Chancellor) on Jun 11, 2008 at 10:51 UTC
    Did you use the option to store the data in network order? That should deal with 32/64 bit and endianness just fine.
      No I didn't, in fact I was not even aware of the option. I reckon it would probably take care of some, but not all, of the above challenges. Still, personally I would choose a textual format every time for the sake of transparency.
      --
      No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]