Solved

Problem with Perl Storable under 64bit

Posted on 2010-09-03
8
1,019 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
  • 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

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 500 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

786 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