Solved

Problem with Perl Storable under 64bit

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

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…

830 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