perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: scripts running under Apache::Registry and tie()/untie()
Date Wed, 20 Feb 2002 14:44:12 GMT
johannes.grumboeck@porsche.co.at 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:
http://perl.apache.org/guide/dbm.html

e.g. startup.pl:

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:
http://perl.apache.org/guide/performance.html#Sharing_Memory


_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


Mime
View raw message