Hi,
I am attempting to modify a script that was coded back when perl 4.xx was 
the current version.  This script accesses databases using DB_File and 
dbmopen().  After every dbmopen and dbmclose there is a flock(). For 
example.

dbmopen(%DB, $filename, 0777) || die "Error: $!\n";
flock(DB,2);
#insert code here
dbmclose(%DB);
flock(DB,8);

Whenever this script run with -w I get "flock on unopened filehandle" 
errors.  Im wondering if the flocks are even neccessary as it appears they 
arn't serving any purpose as they are right now.  What purpose could they 
have served?

Secondly I know that tie is now the way to access these databases and am 
wondering if I could just replace all the dbmopens / flocks with something 
like this instead...

use Fcntl;
use DB_File;
tie %DB, 'DB_File', $filename, O_CREAT|O_RDWR, 0777, $DB_HASH
      or die "Cannot open $filename: $!\n" ;
#insert code here
untie %DB;

Thanks for your help,
Jay

_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to