This would work if i didn't had an infinitive loop (it seems to save when the program is finished (not killed or crashed).
I thought actions on DBM's were directly saved to disk(and save memoryspace).
If i check the file that is created it does not contain the data.
Maybe it's not effective to continually untie & tie again a hash when somethings changed.
use MLDBM qw(DB_File Storable);
use Fcntl;
...
%users = ();
tie (%users, "MLDBM", "users.dbm",
O_CREAT|O_RDWR, 0600, $DB_File:B_BTREE) ||
die "Could not open or create database.";
...
while (1) { #forever
...
$users{$temp{$fh}{"user"}} = $temp{$fh};
...
}
Any suggestions?
I thought actions on DBM's were directly saved to disk(and save memoryspace).
If i check the file that is created it does not contain the data.
Maybe it's not effective to continually untie & tie again a hash when somethings changed.
use MLDBM qw(DB_File Storable);
use Fcntl;
...
%users = ();
tie (%users, "MLDBM", "users.dbm",
O_CREAT|O_RDWR, 0600, $DB_File:B_BTREE) ||
die "Could not open or create database.";
...
while (1) { #forever
...
$users{$temp{$fh}{"user"}} = $temp{$fh};
...
}
Any suggestions?