I have an application that I essentially hacked together that uses a flat file database to implement an addressbook and some other features. It works fine but I have decided to use this as an opportunity to learn DBI and OOP.
I have gotten DBI to work using mysql so at least I know how to create, read, write, update, modify a database useing SQL.
I was going to try to define a class in the OO sense that contained that data base. In doing this I've read the first part of Conway's Object Oriented Perl book and kind of understand the OOP concept. The problem I am having is "getting started". Here's my problem.
Is the class the individual records in the data base or the database itself. In the OOP examples a new object is created by the constructor and passed back to the user as a referent to a blessed anonomous hash. This seems to imply that the objects are stored as anonomous hashs rather than items in a database. I'm confused as to how to handle this. I obviously can't bless the database because that makes no sense.
From a proceedural point of view it's easy for me to figure out. I'd just make routines to do the DBI stuff I need and return whatever I need in scaler, array or hash as appropriate. But I'd really like to try to do something Object Oriented to figure out how to use objects.
I'd appreciate any suggestions or any recommendations of where to go look for more into.
Thanks
Andy Cruce
I have gotten DBI to work using mysql so at least I know how to create, read, write, update, modify a database useing SQL.
I was going to try to define a class in the OO sense that contained that data base. In doing this I've read the first part of Conway's Object Oriented Perl book and kind of understand the OOP concept. The problem I am having is "getting started". Here's my problem.
Is the class the individual records in the data base or the database itself. In the OOP examples a new object is created by the constructor and passed back to the user as a referent to a blessed anonomous hash. This seems to imply that the objects are stored as anonomous hashs rather than items in a database. I'm confused as to how to handle this. I obviously can't bless the database because that makes no sense.
From a proceedural point of view it's easy for me to figure out. I'd just make routines to do the DBI stuff I need and return whatever I need in scaler, array or hash as appropriate. But I'd really like to try to do something Object Oriented to figure out how to use objects.
I'd appreciate any suggestions or any recommendations of where to go look for more into.
Thanks
Andy Cruce