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

i created mldbm(DB_File,Data::Dumper) on windows-2000 platform. i dont have any problem to read that DB from sun station but i couldnt read it from linux station.
and vice-versa(produce on linux couldnt read from sun station. also produce on sun couldnt read it from linux):

here is the code portion i used to connect tothe MLDM db:

use DB_File; use Data::Dumper; use MLDBM qw(DB_File Data::Dumper); $dbPath = "x.dat" tie %db, 'MLDBM', $dbPath, O_RDONLY, 0640 or die $!;
and here is the error code ive got:
MLDBM error: Second level tie failed, "" at mldbm2.pl line 10

is that the situation that MLDBM not portable across (windows,sun) and linux or did ive done something wrong?

itamar

20030403 Edit by Corion: Added formatting

Replies are listed 'Best First'.
Re: mldbm portability (windows,solaris)<->linux
by benn (Vicar) on Apr 03, 2003 at 09:53 UTC
    I think your guess is correct and the binary format of the Berkley DB is not portable. You could *try* other DB formats (SDBM,NDBM etc.), but I suspect you'll have the same problem. I'd probably just export/import a Data::Dumper'ed flat file, but then the 'laziness' bit of Perl always appealed to me :)

    Cheers,
    Ben
Re: mldbm portability (windows,solaris)<->linux
by Improv (Pilgrim) on Apr 03, 2003 at 14:48 UTC
    DB_File uses whatever version of db your Perl was built with, which can vary. I would guess that the Perls your win2k and Sun boxes have were built with a different version than what your Linux box has. You might be able to tell what version of DB was used for each using the 'file' command (on Solaris or Linux). The manpage for DB_File might also be helpful.