saintex has asked for the wisdom of the Perl Monks concerning the following question:
and these are some rows, the software use to store data:use Fcntl qw( O_WRONLY O_TRUNC O_CREAT O_CREAT O_RDWR O_RDONLY LOCK_EX LOCK_SH LOCK_NB); use MLDBM qw(AnyDBM_File Storable);
then with that row, it read the file:my $dbm = tie %{$self->{DB_HASH}}, 'MLDBM', $self->_db_filename, O_CRE +AT|O_RDWR, FILE_CHMOD
I think these are all the rows involved in data storage.sysopen(DB_SCHEDULE_SAFETYLOCK, $self->_lockfile_name, O_RDWR|O_CREAT +, FILE_CHMOD )
In addition I don't understand (and that is probably the problem) what MLDb does and how Storable and MLDb work together.use MLDBM qw(AnyDBM_File Storable); use Storable qw(retrieve_fd); use Fcntl qw (:DEFAULT :flock); use FindBin qw($Bin); tie (%hash, "MLDBM", $Bin.'mj-test-schedules', O_CREAT|O_RDWR, 0666) or die $!; # sysopen(DB_SCHEDULE_SAFETYLOCK, $Bin.'/mj-test-schedules', O_RDW +R|O_CREAT, 0666); #open FILE, ">", $Bin.'/filename.txt' or die $!; open (DF,$Bin.'/mj-test-schedules') or die $!; flock (DF, LOCK_SH) or die $!; $href=retrieve_fd(*DF); close DF; while ( my ($key, $value) = each(%$href) ) { print "$key => $value\n"; } #print FILE $_ while (<DB_SCHEDULE_SAFETYLOCK>) ; #close FILE; untie %hash;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Storable and MLDb
by tokpela (Chaplain) on Nov 18, 2010 at 19:25 UTC | |
by saintex (Scribe) on Nov 19, 2010 at 14:07 UTC |