Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Problem with Perl Storable under 64bit

Posted on 2010-09-03
8
Medium Priority
?
1,079 Views
Last Modified: 2012-05-10
Hi all,

I have a little problem with Perl under my 64bit machine.
I have saved data under my 32bit server with the perl Storable into a file "file.txt".

Now if I type the command

file file.txt

the shell says:

perl Storable(v0.7) data (major 2) (minor 4)

and if I want to retrieve the file on the 64bit server, there appears the following error:

Byte order is not compatible at ../../lib/Storable.pm (autosplit into ../../lib/auto/Storable/_retrieve.al) line 331, at ./perlbot.pl line 217

It's very important to me that my perl-program runs under 64bit.

I tried to use the compatibility mode in perl ($Storable::interwork_56_64bit = 1) but it doesn't work.

Can I convert the 32bit Storable-File to a 64bit Storable-File, so that my 64bit server can read the file without this error?


Regards,

Peter
0
Comment
Question by:sourceweb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 19

Expert Comment

by:Kim Ryan
ID: 33596109
What version of Perl are you using? See this, http://search.cpan.org/dist/Storable/Storable.pm#64_bit_data_in_perl_5.6.0_and_5.6.1 . I f you use later versions should not be any problem
0
 

Author Comment

by:sourceweb
ID: 33596258
$Storable::interwork_56_64bit = 1 didn't help to solve my problem, but in your URL was written to

"also migrate your data"

but how can I convert a 32bit Storable-File to a 64bit file.
I need the information in this file, I think all I have to do is to change the C header signature

"Hence Storable running on perl with 64 bit integers will read the header from a file written by a 32 bit perl, not realise that the data is actually in a subtly incompatible format, and then go horribly wrong (possibly crashing) if it encountered a stored integer. This is a design failure."

I think I need only to change the binary C header in this file, but I don't know how to change this.
If I use

cat file.txt

at the beginning there are some bits not in ASCII and than comes my data in ASCII.
I think that I need to change only the first few bits in this strorable-file.
0
 
LVL 10

Expert Comment

by:jeromee
ID: 33596490
What did you store in that file?
It might be possible to skip the header and then "parse" the rest to retrieve your data in some fashion.
0
Quick Cloud Training

Looking for some quick training on the cloud in 2 hours or less? Check out these how-to guides in AWS, Linux, OpenStack, Azure, and more!

 

Author Comment

by:sourceweb
ID: 33596704
The information in this file is not important, but it's needed by my perl-program.

This perl program must work correctly, I am not allowed to modify it (so that it doesn't use 'retrieve' anymore).

So the perl program needs a correct 64bit storable file, otherwise I have to use 32bit Linux for the next 5 years.


Regards,

Peter
0
 
LVL 10

Accepted Solution

by:
jeromee earned 2000 total points
ID: 33596845
Hi Peter,
Maybe I'm missing something but here are the steps I suggested in the other thread:
 * on the 32-bit machine: create a small perl script that runs Storable::retrieve() on the file and save the extracted data using Data::Dumper or some other hardware-agnostic method
 * on the 64-bit machine: instead of using Storable::retrieve() , use Data::Dumper to retrieve the data
 * if using Data::Dumper is too slow, on the write a quick converted from  Data::Dumper  to Storable, so that you can start using Storable again

0
 

Author Comment

by:sourceweb
ID: 33596906
Yes, this should work! Thanks, good idea, so I transfer the data in a 'bit-independent' ;) way and create a new Storable on the 64bit server that's compatible.

I have never worked with Data::Dumper but I think I should find something about that in a perl-doc.

If it works I will close the topic...
0
 
LVL 10

Expert Comment

by:jeromee
ID: 33597172
0
 

Author Closing Comment

by:sourceweb
ID: 33650116
It works... with a little tinkering.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question