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

I have a module I am developing which, for testing purposes, retrieves several Perl hashes that have been stored on disk via Storable.pm. The stored hashes are found in files whose names end in .sto and are stored in the t/storage/ directory of this distribution. The code is being developed primarily on a Linux server and is being stored in a Subversion repository on that same Linux server. The Storable-ized hash files are stored in that repository as well. The code tests properly; here are its test results, my Perl -V information, and the Storable version.

[linux] 556 $ perl Makefile.PL;make;make test Writing Makefile for PostingAnalyzer Skip blib/lib/PerlJobs.pm (unchanged) cp lib/.PostingAnalyzer.pm.swp blib/lib/.PostingAnalyzer.pm.swp cp lib/PostingAnalyzer.pm blib/lib/PostingAnalyzer.pm Manifying blib/man3/PerlJobs.3 PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e" " +test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/01_load.......................ok + t/02_new........................ok + t/03_parse_single_posting.......ok + t/04_parse_multiple_postings....ok + t/05_capture_major_fields.......ok + All tests successful. Files=5, Tests=71, 19 wallclock secs ( 2.89 cusr + 1.13 csys = 4.02 +CPU) [linux] 557 $ perl -V Summary of my perl5 (revision 5 version 8 subversion 7) configuration: Platform: osname=linux, osvers=2.4.29-linode39-1um, archname=i686-linux uname='linux li11-226 2.4.29-linode39-1um #1 wed jan 19 12:22:14 e +st 2005 i686 gnulinux ' config_args='-de' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultipl +icity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-strict-aliasing -pipe -I/usr/local/include + -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-fno-strict-aliasing -pipe -I/usr/local/include' ccversion='', gccversion='3.3.5 (Debian 1:3.3.5-13)', gccosandvers +='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +2 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -ldl -lm -lcrypt -lutil -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc libc=/lib/libc-2.3.2.so, so=so, useshrplib=false, libperl=libperl. +a gnulibc_version='2.3.2' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: USE_LARGE_FILES Built under linux Compiled at Oct 25 2005 11:10:50 @INC: /usr/local/lib/perl5/5.8.7/i686-linux /usr/local/lib/perl5/5.8.7 /usr/local/lib/perl5/site_perl/5.8.7/i686-linux /usr/local/lib/perl5/site_perl/5.8.7 /usr/local/lib/perl5/site_perl . [linux] 558 $ perl -MStorable -e 'print "$Storable::VERSION\n"' 2.15

The problem when I check out that code from the repository onto my iBook. When I run make test on this Darwin system, all my tests fail once they encounter code which calls Storable::retrieve() on the Storable files. Example:

t/01_load.......................ok 10/0Byte order is not compatible at + blib/lib/Storable.pm (autosplit into blib/lib/auto/Storable/_retriev +e.al) line 331, at .../blib/lib/PostingAnalyzer.pm line 340 # Looks like your test died just after 12. t/01_load.......................dubious + Test returned status 255 (wstat 65280, 0xff00) after all the subtests completed successfully

Here are the full test results on Darwin:

[darwin] 536 $ perl Makefile.PL;make;make test Writing Makefile for PostingAnalyzer Manifying blib/man3/PerlJobs.3 PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e" " +test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/01_load.......................ok 10/0Byte order is not compatible at + blib/lib/Storable.pm (autosplit into blib/lib/auto/Storable/_retriev +e.al) line 331, at .../blib/lib/PostingAnalyzer.pm line 340 # Looks like your test died just after 12. t/01_load.......................dubious + Test returned status 255 (wstat 65280, 0xff00) after all the subtests completed successfully t/02_new........................ok 1/0Byte order is not compatible at +blib/lib/Storable.pm (autosplit into blib/lib/auto/Storable/_retrieve +.al) line 331, at .../blib/lib/PostingAnalyzer.pm line 340 # Looks like your test died just after 2. t/02_new........................dubious + Test returned status 255 (wstat 65280, 0xff00) after all the subtests completed successfully t/03_parse_single_posting.......ok 1/0Byte order is not compatible at +blib/lib/Storable.pm (autosplit into blib/lib/auto/Storable/_retrieve +.al) line 331, at .../blib/lib/PostingAnalyzer.pm line 340 # Looks like your test died just after 2. t/03_parse_single_posting.......dubious + Test returned status 255 (wstat 65280, 0xff00) after all the subtests completed successfully t/04_parse_multiple_postings....ok 1/0Byte order is not compatible at +blib/lib/Storable.pm (autosplit into blib/lib/auto/Storable/_retrieve +.al) line 331, at .../blib/lib/PostingAnalyzer.pm line 340 # Looks like your test died just after 2. t/04_parse_multiple_postings....dubious + Test returned status 255 (wstat 65280, 0xff00) after all the subtests completed successfully t/05_capture_major_fields.......ok 1/0Byte order is not compatible at +blib/lib/Storable.pm (autosplit into blib/lib/auto/Storable/_retrieve +.al) line 331, at .../blib/lib/PostingAnalyzer.pm line 340 # Looks like your test died just after 2. t/05_capture_major_fields.......dubious + Test returned status 255 (wstat 65280, 0xff00) after all the subtests completed successfully Failed Test Stat Wstat Total Fail Failed List of +Failed ---------------------------------------------------------------------- +--------- t/01_load.t 255 65280 12 0 0.00% ?? t/02_new.t 255 65280 2 0 0.00% ?? t/03_parse_single_posting.t 255 65280 2 0 0.00% ?? t/04_parse_multiple_postings.t 255 65280 2 0 0.00% ?? t/05_capture_major_fields.t 255 65280 2 0 0.00% ?? Failed 5/5 test scripts, 0.00% okay. 0/20 subtests failed, 100.00% oka +y. make: *** [test_dynamic] Error 255 [darwin] 537 $ perl -V Summary of my perl5 (revision 5 version 8 subversion 7) configuration: Platform: osname=darwin, osvers=7.9.0, archname=darwin-2level uname='darwin macintosh.local 7.9.0 darwin kernel version 7.9.0: w +ed mar 30 20:11:17 pst 2005; root:xnuxnu-517.12.7.obj~1release_ppc po +wer macintosh powerpc ' config_args='-de' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultipl +icity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp -fno- +strict-aliasing -pipe -I/usr/local/include', optimize='-Os', cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-precom +p -fno-strict-aliasing -pipe -I/usr/local/include' ccversion='', gccversion='3.3 20030304 (Apple Computer, Inc. build + 1495)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -L/usr/local +/lib' libpth=/usr/local/lib /lib /usr/lib libs=-ldbm -ldl -lm -lc perllibs=-ldl -lm -lc libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libp +erl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dyld.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/u +sr/local/lib' Characteristics of this binary (from libperl): Compile-time options: USE_LARGE_FILES Built under darwin Compiled at Oct 24 2005 21:19:21 %ENV: PERL5LIB="/usr/local/lib/perl5/site_perl" @INC: /usr/local/lib/perl5/site_perl/5.8.7/darwin-2level /usr/local/lib/perl5/site_perl/5.8.7 /usr/local/lib/perl5/site_perl/5.8.4/darwin-2level /usr/local/lib/perl5/site_perl/5.8.4 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.8.7/darwin-2level /usr/local/lib/perl5/5.8.7 /usr/local/lib/perl5/site_perl/5.8.7/darwin-2level /usr/local/lib/perl5/site_perl/5.8.7 /usr/local/lib/perl5/site_perl/5.8.4/darwin-2level /usr/local/lib/perl5/site_perl/5.8.4 /usr/local/lib/perl5/site_perl . [darwin] 538 $ perl -MStorable -e 'print "$Storable::VERSION\n";' 2.15

So I have the same Perl code, the same .sto files, the same version of Perl, and the same -- and most recent -- version of Storable.pm (2.15). Only the operating system is different.

In the Storable.pm documentation, the "Byte order is not compatible" error message is said to be likely when using earlier versions of Perl. That is not the case here. Nor do the factors discussed in this October 2003 Perlmonks thread Storable: Byte order is not compatible seem to apply. The problem has been reported in connection with MovableType in postings located by Google here: Byte order is not compatible. And a bug was filed about this a couple of years back http://rt.cpan.org/Public/Bug/Display.html?id=6951; no response is evident.

My objective is simply that my tests pass on both Linux and Darwin. Can any Monk offer guidance? TIA.

Jim Keenan

Replies are listed 'Best First'.
Re: Storable problem again: Byte order is not compatible
by perrin (Chancellor) on Mar 14, 2006 at 02:24 UTC
    You probably just need to store the data in "network order." See the docs, where it describes nstore().
      Right on the money! Thanks, Perrin!

      jimk