js1 has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I have some Berkeley DB files which were created with Storable 2.15 on Solaris 8 using 64 bit perl. I am trying to port these files to Redhat 4 (again using perl 64bit), but on running the script, I get an error message which states:

Byte order is not compatible at blib/lib/Storable.pm (autosplit into b +lib/lib/auto/Storable/thaw.al) line 366, at /usr/lib/perl5/site_perl/ +5.8.5/MLDBM/Serializer/Storable.pm line 27

I have tried setting $Storable::interwork_56_64bit=1 to no avail, but I think that fix is for an older version of the Storable module.

Should these Berkeley DB files be portable to other platforms, or do I need to try something else?!

Thanks for any help.

js1.

Replies are listed 'Best First'.
Re: Berkeley DB files portable?
by Fletch (Bishop) on Oct 30, 2007 at 16:32 UTC

    Erm . . . Storable doesn't create Berkeley DB files; Storable uses its own on-disk format. If you're moving Storable-serialized data between machines of different endian-ness you want to look at the nstore routine which writes out stored data in a portable ("network") byte ordering that will behave correctly anywhere.

    What you probably want is to write a conversion script on the old platform which reads in the current files and writes out (again, using nstore) a new portable copy. Then move those new portable copies to the new platform.

      Thanks, both are really helpful replies. I'll have a look at the nstore subroutine as you suggest.

      Also RHEL4 is what I should have said, not Redhat 4!

      Thanks again.

Re: Berkeley DB files portable?
by gamache (Friar) on Oct 30, 2007 at 16:29 UTC
    Some implementations of Berkeley DB allow you to specify byte order on the command line; for instance, on my NetBSD box, the -E switch specifies the endian order to use. If you have a version of db that supports this sort of thing, I'd recommend using the command-line db tool to dump the database files into another format, then try using them from Perl again.

    p.s. RedHat 4? Wow, that's an oldie. I hope to god it's heavily patched; I remember dealing with far too many break-ins on that OS.