Hi ALL!
Should i still lock my dbm files accessed from cgi under mod_perl if i
need only read from them? Not my program nor any others never will write
to
this files.
I have a problem with code:
use DB_File;
use strict;
my %fields;
my $fieldsdb='/path/to/db_file';
.... some code there ....
if (!(tie(%fields, 'DB_File', $fieldsdb, O_RDONLY, 0666, $DB_HASH)))
{print "Sorry, database access timeout. $!";}
else {
...other code...
if (defined($fields{$key})) {print "Field for $key is
$fields{$key}\n";}
else {print "Field for $key not defined!\n";}
untie %fields;
}
If i run this code from command line or under mod_cgi, it work fine.
But if it run repeatedly under mod_perl, it occasionally give me a
"database access timeout" message (see code above), but error value $!
still empty. I'm confused: why error occurred on tie phase, before any
read statements?
The second problem is - even after successful tie()-ing of database
rarely i get "Field not defined!" message for defined keys...
Dmitry