views:

437

answers:

2

I'm trying to thaw a database BLOB that was frozen using Storable on a 64-bit Solaris (production) machine. When I try to thaw on a 32-bit Windows (development) PC I receive "Byte order is not compatible error".

perl -v (on solaris)
This is perl, v5.8.8 built for i86pc-solaris-64

perl -v (on Windows)
This is perl, v5.10.1 built for MSWin32-x86-multi-thread

Exact error is:

(Unable to read: Byte order is not compatible at blib\lib\Storable.pm (autosplit into  blib\lib\auto\Storable\thaw.al) line 415, at ../handlers/Search/actions/SearchSendQueue.pm line 124 )

line 124 of SearchSendQueue.pm:

my $object = thaw( $item->{object} );

Does anybody know how I can thaw this object on the 32-bit machine?

Note: The object is valid and working on the 64 bit production machine. I've already tried "$Storable::interwork_56_64bit = 1;" as suggested on other forums.

+5  A: 

I know the docs indicate it's supposed to be possible, but I've never been able to get it to work except by using nfreeze/nstore* on the the 64-bit machine.

ysth
+7  A: 

Storable documentation says:

Storable writes a file header which contains the sizes of various C language types for the C compiler that built Storable (when not writing in network order), and will refuse to load files written by a Storable not on the same (or compatible) architecture.

In the same section, they suggest that the basic use of Storable is a local and FAST persistence method. However, you can use nstore to store the persisted structure in network byte order. The result will be that it reads and stores slower but works across all platforms.

So the suggestion is that you'll have to use the 64-bit machine to read and re-store the data in network order using nstore.

Axeman
Does that work for 32/64-bit gaps or just for big-endian/little-endian CPUs?
fennec
@fennec: That should work for completely portable Storable files. The section I referenced deals specifically with 64-bit architectures.
Axeman
I was trying to avoid thaw / nfreeze on the production server. However, it seemed to be the only way, so that's what I ended up doing.
biometrics74