develooper Front page | perl.perl5.porters | Postings from January 2001

problem with dbm-based hash

Thread Next
From:
Rich Morin
Date:
January 29, 2001 18:00
Subject:
problem with dbm-based hash
Message ID:
p05001917b69bcea7e68a@[192.168.168.205]
I tried sending this in via perlbug, but I have received no indication that
anything got through; besides I have a bit more info to offer...

I have a rather large (40 MB; ~50K key) hash which is behaving oddly.  If
I use keys() to walk through the hash, certain items don't show up.  I can,
however, pull them out by specific request.  Here is a demo script:

#!/usr/bin/env perl
#
# dbc2 - check contents of db
#
# Written by Rich Morin, CFCL, 2001.01

{
   $mdb1 = '/home/meta/trim';
   $path = '/etc/defaults';

   dbmopen(%mdb1, $mdb1, undef) or die ("can't open $mdb1");
   print "$mdb1{$path}\n";

   print "\n=====\n\n";

   for $key (keys(%mdb1)) {
     print "key=\"$key\"\n" if ($key =~ /defaults/);
   }
   dbmclose(%mdb1);
}

And the corresponding output:

<filechar>
   <device>134400</>
   <inode>37</>
   <nlink>2</>
   <type>directory</>
</filechar>
<rdm_note>
   <name>/etc/defaults</>

   <description>default system configuration files</>

   <purpose>
     /etc/defaults is used to store a variety
     of default system configuration files
     (e.g., make.conf, pccard.conf, rc.conf).
   </>

   <category>directory</>

   <note>
     Do not modify the files in /etc/defaults.
     Instead, create override files in /etc.
     For example, if you wish to modify the settings
     that are being made by /etc/defaults/rc.conf,
     put the override (or supplementary) values into /etc/rc.conf.
   </>

   <files>/etc</>
   <files>/etc/defaults/make.conf</>
   <files>/etc/defaults/pccard.conf</>
   <files>/etc/defaults/rc.conf</>

   <see_also section="?" status="primary">?</>
   <see_also section="?" status="related">?</>

   <admin>?</>
</rdm_note>


=====

key="/etc/defaults/make.conf"
key="/usr/src/etc/defaults/rc.conf"
key="/usr/src/contrib/ncurses/include/capdefaults.c"
key="/boot/defaults/loader.conf"
key="/usr/share/examples/etc/defaults/pccard.conf"
key="/usr/src/contrib/gcc/defaults.h"
key="/usr/share/examples/etc/defaults/rc.conf"
key="/etc/defaults/rc.conf"
key="/usr/src/etc/defaults/make.conf"
key="/usr/libdata/perl/5.00503/mach/sys/ttydefaults.ph"
key="/stand/etc/defaults/rc.conf"
key="/etc/defaults/rc.conf.local"
key="/usr/share/examples/etc/defaults"
key="/boot/defaults"
key="/usr/share/examples/etc/defaults/make.conf"
key="/stand/etc/defaults"
-- 
--
http://www.cfcl.com/rdm
email: rdm@cfcl.com
phone: +1 650-873-7841

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About