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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.