I have a question about DB_File::Lock with a database and users hitting
the STOP button. We have recently converted a database from an ASCII flat
file to db file. The ASCII flat file used flock() to lock the files. Now
that we have switched to DB_File, we have adopted DB_File::Lock as our
locking mechanism What we have essentially is:
my($strDBFilename) = "msglist.db";
my($locking)="write";
tie(%msglistdb, 'DB_File::Lock', $strDBFilename,O_CREAT|O_RDWR,
0644,$DB_HASH,$locking)
[...critical stuff...]
untie(%msglistdb);
If everything goes normally, this will provide a locked fence file that
will be unlocked when the file is closed during the untie. If I have read
the mod_perl guide correctly, when a user hits the STOP button on a
browser while the "critical stuff" is being processed, the script will
abort and the files will be closed and the fence file unlocked because we
magically go out of scope at the point of the abort. Is this a correct
reading? Will the lock be removed when the user hits the STOP button? If
so, for my own erudition, can someone explain to me why we go out of
scope in this case and why/how the files are closed when we go out of scope?
Thanks in advance,
Dave