perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <>
Subject Re: scripts running under Apache::Registry and tie()/untie()
Date Wed, 20 Feb 2002 14:44:12 GMT wrote:
> Hi,
> I'm very new to modperl and I've got a question regarding the usage of tie
> () and untie().
> I've written a perl-script for authenticating a user's IP-address
> against a DBM-database which has stored a certain valid IP-range
> for each user.
> I put it into a directory where every .perl-file runs under
> Apache::Registry.
> Now I do a tie() once in the .perl-script. Do I have to untie() in the same
> script
> or is this not necessary because as I understood the perl-script keeps
> "living" as long as the child-process who started it?!

If the dbm file access is read-only it's the best to tie it during 
startup and then simply access it. If you need to read/write, read:


tie %Foo::Bar::dbm, "NDBM_File", ...

and then in your code:

print $Foo::Bar::dbm{taz};

beware that if you use each(), keys(), values() on this dbm it won't be 
shared anymore between the processes (though still work properly, but 
more memory will be used). For more info read:

Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker      mod_perl Guide

View raw message