|Syntactic Confectionery Delight|
Persistence for Class::MethodMaker?by mattr (Curate)
|on Feb 22, 2006 at 08:28 UTC||Need Help??|
mattr has asked for the
wisdom of the Perl Monks concerning the following question:
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?Sincerely,
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?