We don't bite newbies here... much | |
PerlMonks |
Class::HPLOO - Need advice in attributes and object persistence for OODB.by gmpassos (Priest) |
on Feb 08, 2004 at 22:45 UTC ( [id://327511]=perlquestion: print w/replies, xml ) | Need Help?? |
gmpassos has asked for the wisdom of the Perl Monks concerning the following question:
update: Changed the title for who was thinking that this was a release announcement.
I have just released Class::HPLOO 0.11, with support for attributes definitions. I have inserted the attribute support to build an automatically object persistence system for OODB through Class::HPLOO. First, some example of the new syntax for attributes:
The idea of the attributes, is to give a type to them and the setter and getter methods. Soo, with a method to access or set the attributes we can know when they are changed or not, soo will be possible to define if an object is "dirty" or "clean", needed to make the persistent proxy system. The DB communication will be made through HDB (a module that I haven't released yet, for now it's just for our internal use in our projects, but will be there for the public). With HDB we don't use SQL, or don't need to use, to work with the DB, we just use commands and syntax based in Perl it self. Soo, we can work with any type of DB without need to care with the nuances of each SQL or behavior of each DB type. Soo, the persistence system will work in any DB, from SQLIte to MySQL and Oracle. But the seconde idea, is to make an easy and simple way to create a persistence class. For example, in Java the easier framework for persistence is the "Prevayler" system (not made by SUN), where we just declare the clas with that: And bingo, the persistence system is done. But "Prevayler" use a log persistence system, soo it doesn't use DB, just a log with all the commands send to an object. Soo, when the system is reloaded, the objects are rebuild with all the commands in the log. But for a true persistent system, that works in different processes, different machines and for big systems, it really need to be made with a true DB.
But how to to make this simple and easy in Perl? For example, in Perl we don't have the "implements" resource for classes. But with just an "extends" system it won't work too, since the persistence system need to change the setter and getter methods, also inserting "mask/layer" classes (proxy) when an object has some association with other object. But the biggest problem in the definition, is how to just define simple like in the "Prevayler" example, and also define the DB connection? Soo, before start to work on that, I'm just asking for some opinion from the monks about the persistence system and the new attribute definition. Thanks in advance,
Graciliano M. P.
Back to
Seekers of Perl Wisdom
|
|