Good day to all. This is a question about data persistence.
Context
A complex data structure, many hashes deep and many hashes wide, needs to be read from and written to. It needs to persist between program runs. I don't need to have more than a bit of it in memory at any time.
I found
use MLDBM through
http://www.perl.com/pub/2006/02/16/mldbm.html.
Pros: does all the above.
Cons: Need to extract a reference to work on and save it back to the file.
EDIT:
Con: can't edit references directly in the database file because references are no longer tied once extracted. This makes for clunkier code.
Questions
Is this good, bad, and/or ugly? Is this the state of the art? What are the different ways that monks have dealt with this kind of situation? Will I ever come to a decision? Am I forever doomed to to obsess about it?
Tune in next week . . .
Thank you all.
EDIT: spell check fail (persistance changed to persistence) (thank you erix)
$state{tired}?sleep(40):eat("crow");
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.