English 中文(简体)
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 bliblibStorable.pm (autosplit into  bliblibautoStorable	haw.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.

最佳回答

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.

问题回答

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.





相关问题
Why does my chdir to a filehandle not work in Perl?

When I try a "chdir" with a filehandle as argument, "chdir" returns 0 and a pwd returns still the same directory. Should that be so? I tried this, because in the documentation to chdir I found: "...

How do I use GetOptions to get the default argument?

I ve read the doc for GetOptions but I can t seem to find what I need... (maybe I am blind) What I want to do is to parse command line like this myperlscript.pl -mode [sth] [inputfile] I can use ...

Object-Oriented Perl constructor syntax and named parameters

I m a little confused about what is going on in Perl constructors. I found these two examples perldoc perlbot. package Foo; #In Perl, the constructor is just a subroutine called new. sub new { #I ...

Where can I find object-oriented Perl tutorials? [closed]

A Google search yields a number of results - but which ones are the best? The Perl site appears to contain two - perlboot and perltoot. I m reading these now, but what else is out there? Note: I ve ...

热门标签