Solved

Problem with Perl Storable under 64bit

Posted on 2010-09-03
8
1,007 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
 

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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 demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now