in reply to Database in a folder?

Would you recommend me some more sophistiated modules or ways to solve my problem?

I can't see what your problem is, you have only described the solution. Using a directory as a high level index is a common enough solution, and if the modules you mention resolve the data in the way you wish then why go for anything more complex? Keep it simple.

On the other hand, if there is some feature you need that these modules do not supply then ask away. Right now it is hard to see what you need that you do not have.

Replies are listed 'Best First'.
Re^2: Database in a folder?
by AriSoft (Sexton) on Feb 16, 2010 at 21:32 UTC

    Hi,

    My problem is to find the right tie::module.

    The data is currently a shared hash of shared hashes. I would like to save it into files where first hash key is filename and second hash key+data is serialized to a file. It is like a cardfile.

    I was hoping that there is some universal "tie to files" module but didn't find one which does this all without extra programming.

      Are you seeking to persist your data between runs of your program? Or offload the data to disk becuase of volume and memory constraints?

      If the former, it should be relatively trivial and safe. If the latter, with threads involved, it requires considerable thought and care. You might look at DBM::Deep, though there doesn't appear to be any mention of thread-safety one way or the other. It can certainly handle the hashes of hashes aspect, and has ACID transactions which might mean it would work from multiple threads.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

        I am looking for these features:

        1) Persistent storage in user editable form which means text files indexed by filenames.

        2) Shared storage between threads. That means file locking. It could copy the idea of lock() function.

        3) Data amount is small enough for this kind of light database model. No internal caching needed or even allowed.

        4) Data will be accessed by a tied variable like ${$key}{$subkey} which should point to file \somedatadir\key which contains subkeys like "subkey=>data" or something similar in a single file.

        DBM:Deep looks interesting but I think it does not qualify my requirement n:o 1.