Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use 32-bit Perl to thaw something frozen with 64-bit Storable?

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.

like image 240
uxnow Avatar asked Jan 07 '10 06:01

uxnow


2 Answers

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.

like image 166
Axeman Avatar answered Nov 07 '22 20:11

Axeman


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.

like image 28
ysth Avatar answered Nov 07 '22 19:11

ysth