in reply to Re^3: MLDBM tie fails
in thread MLDBM tie fails

Thanks, I'll try DBM::Deep. BTW there were no stealth updates on the first post :-)
UPDATE: Tried DBM::Deep. I'm getting this error:
Use of uninitialized value in -e at /usr/local/share/perl/5.8.8/DBM/Deep/File.pm line 55
Here is the code snippet:
#!/usr/bin/perl -w use strict; use Bio::AlignIO; use Bio::SeqIO; use Fcntl qw(O_RDWR O_CREAT); use DBM::Deep; require Variation::RecombConfig; use Variation::Recomb; use POSIX qw(ceil floor); use DirHandle; use File::Temp; use Data::Dumper; # do lots of stuff to create a big complex hash, %positions_hash my $db = DBM::Deep->new( -filename =>"positions.db", pack_size => 'lar +ge'); $db->import(\%positions_hash); $db->optimize();
From the DBM::Deep code it seems that it is not properly creating the new file positions.db. Is there a way around this?

Replies are listed 'Best First'.
Re^5: MLDBM tie fails
by tilly (Archbishop) on Dec 22, 2008 at 16:38 UTC
    I would suggest tying the big complex hash to DBM::Deep before creating the big complex data structure. That is because processing the whole thing at once takes up too much memory. Doing it incrementally from the start will behave much better.

    If that fails then try to come up with a minimal test case and file a bug report at http://groups.google.com/group/DBM-Deep?pli=1.

      Hi tilly, Thanks so much for your advice. I set up the tie earlier in the program than the database structure creation:
      use Bio::AlignIO; use Bio::SeqIO; use Fcntl qw(O_RDWR O_CREAT); use DBM::Deep; use Data::Dumper; <br> ...<br> my $db = tie %positions_hash, "DBM::Deep", "positions.db"; <br>...<br> # hash creation

      This appears to work, but the only drawback is slowness. Guess I can't get away from that by only tie-ing after hash creation because that produces the error:
      DBM::Deep: Cannot sysopen file 'positions.db': No such file or directory.
      Thanks again.