Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Tie, DBM's, HoH and Sparse Keys

by TheoPetersen (Priest)
on Apr 10, 2001 at 20:13 UTC ( [id://71472]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Tie, DBM's, HoH and Sparse Keys

I tried this (Perl 5.6.1, RedHat 6.0) and found something wierd.
checkdbm \%terms,$db; print "hashref =", tied($terms{$db}), "\n";
prints "hashref =" and the use of uninitialized value warning. So the tiedness of the hash reference is getting lost somewhere.

Replies are listed 'Best First'.
Re: Re: Tie, DBM's, HoH and Sparse Keys
by mr.nick (Chaplain) on Apr 10, 2001 at 20:17 UTC
    Yeah, that didn't work quite as expected, so I followed runrigs suggestion and changed it to:
    sub checkdbm { my $hashref=shift; my $key=shift; if (-f "$key-dbm.db") { return; } my %hash; tie (%hash,'NDBM_File',"$key-dbm",O_RDWR|O_CREAT,0640); $hashref->{$key}=\%hash; }
    which works .. sorta. The DB files fill with the correct information, but my memory usage isn't any less. Odd, no?

    Well, off to Storable I suppose (and I was really trying to get THIS to work ... for stubborness sake).

      If speed is not of the essence...

      Could you try untying the hashes in between operations on particular top-level keys? That should release the NDBM_File buffers and what-not.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://71472]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.