hi,
I have some code that uses flat files with the following format :
key|field1=val1|field2=val2|field3=val3|
I have successfuly used Tie::StdHash to put this into :
$hash{key}{fieldN}
structure...up to now everything is ok...
Now as u may alredy guessed the hard part is to,
make STORE works efectively..
The simplest way is to just rebuild the text file into
string and then slurp the result into the file every STORE
What other tehniques i can employ to make things better
The things become worse 'cause I will have not one but several files and I will want to be able to support simultaneous access via flock() probably..
So if i make some sort of caching i have to do longer locks..
FYI I dont expect too many simultaneous access, but has to have it as a feature...
One more thing I dont want to use SQL or DBM, why :
- the files will be maximum several thousand entires/lines
- I can edit the files with text editor.
- I can easly grep files with regexes to make some stuff
that are horribly hard with SQL.
- DB is noneditable, but is also a option if lines goes over 10 000 :"), 'cause it too can be hidden behind a HASH
If I decide to move this into SQL DB, i will probably hide it behind HASH access(there is such module AFAIK), that is one of the reasons I move to Tie::Hash.