develooper Front page | perl.perl5.porters | Postings from February 2008

Storable byte ordering cross-CPU incompatibility

Thread Next
John ORourke
February 7, 2008 09:04
Storable byte ordering cross-CPU incompatibility
Message ID:
Hi folks,

Summary:  I'm trying to retrieve from a store file created on a 
different architecture, and I get the "Byte order is not compatible" 
error.  I don't think this is a bug but I'm hoping someone knows a 
workaround to make Storable files cross-platform.

----------------------------------------------- Longer version and test 

I've been having trouble using Storable to freeze on one machine and 
thaw on another.  I get the old "Byte order is not compatible at 
blib/lib/ (autosplit into 
blib/lib/auto/Storable/ line 380" message.

The only mention I can see of this error is with perl 5.6.x, and that's 
not in use here.

Here's my test case:
-------------------------------------Machine 1:
 - OS: Ubuntu 6.10
 - CPU: Dual core Athlon 64
 - Kernel 2.6.17-10-generic SMP x86_64
 - Storable 2.18 fresh from CPAN
 - Perl v5.8.8 built for x86_64-linux-gnu-thread-multi
 - $Config{byteorder} = "12345678"

       use Storable;
       store( { a=>1 }  ,"testfile");

--------------------------------Machine 2:
 - OS: Ubuntu 6.06.2 LTS
 - CPU: Intel Core2 6600
 - Kernel 2.6.15-26.686 SMP i686
 - Storable 2.18 fresh from CPAN
 - Perl 5.8.7 for i486-linux-gnu-thread-multi
 - $Config{byteorder} = "1234"

       use Storable;
       use Data::Dumper;
       print Dumper( retrieve( "testfile" ) );

------------------------------------------Test Case:

Running the first code snippet on machine 1, copying testfile to machine 
2 using scp, and running the second code snippet on machine 2 produces 
the error mentioned above.

Running them the other way around gives the same error.

thanks in advance,

John O'Rourke
Versatilia Ltd

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About