in reply to database problems: repost

If this post looks like the last post, the problem is that it's too long.

If you produced a minimal example that demonstrates the problem you have a chance of people looking at it - I personally have no intention of struggling through the mass that you've included - and there is in fact a good chance that you'll discover the problem yourself in the process. If nothing else, it would at least show an honest attempt to resolve the issue prior to coming here.

I personally am pretty suspicious of:
tie %chat, "Tie::IxHash"; # other stuff tie %chat, 'SDBM_File', $chat, O_CREAT | O_RDWR, 0644;
Tying the same hash to 2 different classes looks odd. I think most likely the last tie takes effect and the previous ones don't matter.

update

I tested some with:
#!/usr/bin/perl -w use Tie::IxHash; require SDBM_File; my %chat; my $chat = "./list.dbm"; # location of database tie %chat, "Tie::IxHash"; print tied(%chat), "\n"; tie(%chat, 'SDBM_File', $chat, O_CREAT | O_RDWR, 0666) or die "Couldn’t tie SDBM file '$chat' $!; aborting";; if ( !tied %chat ) { print "database unsuccessful $!.\n"; } print tied(%chat), "\n";
Because of the first tie of %chat, your original if (!tied %chat) does not capture failure of the second tie (to SDBM_File). the 'or die' idiom as part of the 'tie..' is better for this. On my system, the tie to SDBM_File would (often) fail if 'use Fcntl;' wasn't included at the top of the script.



--Bob Niederman, http://bob-n.com