marky1124 has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

I would very much appreciate some help from the monks. I'm attempting to migrate an application suite from a 32bit Debian Sarge system with perl v5.8.4 & Storable v2.14 to a 64bit Debian Etch system with Perl v5.8.8 & Storable v2.18. Along the way I've found that the perl Storable format written out by the 32bit system can not be read by the 64bit system. When the 64bit system tries to read the 32bit systems' storable it gives the following error

Byte order is not compatible at blib/lib/Storable.pm (autosplit into blib/lib/auto/Storable/_retrieve.al) line 380, at ./try line 37
I may be wrong but I do not believe this to be connected to the $Storable::interwork_56_64bit flag mentioned in the Storable man page.

I've used Storable::file_magic to compare the headers of Storable files written by the two systems, the differences are as follows:

32 bit system:
'hdrsize' => 15, 'version' => '2.7', 'longsize' => 4, 'ptrsize' => 4, 'byteorder' => '1234',
64 bit system:
'hdrsize' => 19, 'version' => '2.7', 'longsize' => 8, 'ptrsize' => 8, 'byteorder' => '12345678',
I also have data being fed from another Debian Sarge system which has perl v5.8.4 and Storable v2.14. That data arrives daily.

So I'm looking for advice. Ideally I'd like to be able to configure the 64-bit system to accept the Storable files written out by the 32-bit systems. Is that possible? If not what is the least disruptive approach I can take to having all the systems singing in harmony?

Thanks very much for your attention and meditation,
Cheers,
Mark
  • Comment on Reading 32-bit Storable files on 64-bit system

Replies are listed 'Best First'.
Re: Reading 32-bit Storable files on 64-bit system
by grinder (Bishop) on Dec 20, 2007 at 18:14 UTC

    Storable does purport to be a data exchange mechanism. You will have to load the Storable files on your 32-bit system and save them out in another format that is geared to data exchange, and ship that over the wire. On increasing order of complexity you have:

    • tab delimited
    • CSV
    • YAML
    • JSON
    • XML
    • custom, other, punch-cards

    One very nifty module worth a plug is Data::Serializer, which provides a convenient front-end to the underlying format used, and makes it trivial to swap out tab-delimited and switch to YAML as the needs dictate, on the systems involved in data exchange.

    • another intruder with the mooring in the heart of the Perl

Re: Reading 32-bit Storable files on 64-bit system
by eserte (Deacon) on Dec 20, 2007 at 21:37 UTC
    If you want compatible Storable files, then you have to use nstore() instead of store() when dumping. That's all.
      Fantastic thank you. nstore() seems to allow exchange of storable files both ways round from 32-bit to 64-bit and vice versa, and there appears to be no performance or file size penalty with nstore() vs store().

      The only thing that would be better would be if retrieve() were able to use the 'longsize', 'ptrsize' and 'byteorder' values from the header and interpret the file appropriately. That would assist me with the thousands of store()'d storables I already have.

      Cheers,
      Mark