Dear Monks,

How do you implement Class::MethodMaker persistence, and can it be done fully through Class::DBI?

I need persistent OO storage for an app that can be in both CGI or a wxperl gui app, on unix or windows.. I want to use DBI but not be forced to use a server-based database i.e. use dbm or SQLite (though FAILs are shown for SQLite). I'm having trouble persisting Class::MethodMaker, and can't see if it will really work with Class::DBI which I have used. There is a past thread from someone with the same idea and a kludge. Failing that some other transparent mechanism (if possible using DBI.pm) would be needed, preferably not just serializing the whole object into a single bloblike field.

Also, I found you can't dump the entire object with Data::Dumper unless you vivify each field manually.. or is there a way?

Some issues seem to be class arrays/hashes, setting defaults, overridden methods, and using both Class::DBI and MethodMaker idioms. Class::DBI has its own ways of doing them.

Also I have looked at Class::Generate which is interesting but same question about how to automatically persist.

Currently I am thinking about giving up on Class::MethodMaker and am painfully trying for the first time to wedge Class::DBI into a dbm (mldbm) (lots of carping). But what I'd love is transparent storage of Class::MethodMaker through Class::DBI.. all the calories and you don't get fat, yup. Any ideas?

Sincerely,

Matt R.


In reply to Persistence for Class::MethodMaker? by mattr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.