http://www.perlmonks.org?node_id=482728

monsieur_champs has asked for the wisdom of the Perl Monks concerning the following question:

Fellows,
I'm starting a new Perl project, and our team system architect is a guy from Java OO school. I'm trying to help him to understand and use the Perl Class::DBI family, making analogies with J2EE object families so he can understand and model what's going on.

I've implemented a small prototype for part of our application, so I can demonstrate Class::DBI in action. So I wrote something like this (simplified for this article):

package Project::CDBI; use base "Class::DBI"; __PACKAGE__->connection( __DSN__, __USER__, __PASSWORD__ ); 1; package Project::CDBI::User; use base "Project::CDBI"; __PACKAGE__->table( 'user' ); __PACKAGE__->columns( All => qw/ id name login passwd email / ); __PACKAGE__->sequence( 'user_id_seq' ); 1; package Project::Main; use strict; use warnings; use Project::CDBI::User; # many lines of code here... # somewhere here we find a user and change his email. $user = Project::CDBI::User->find_or_create( $user_id ); $user->email( $new_email_addr ); $user->update; Project::CDBI::User->dbi_commit; __END__

And then it happened. The architect asked me to use DAO design pattern to implement the database access, and to use VO (Value Objects) to pass info arround. I just can't point him what object plays the Value Object role and what object plays the Data Access Object role when using Class::DBI.

Given that, a enlightened and wise monk here can please tell me what are the roles each perl object implemented here plays and what should I do to implement that Value Objects and Data Access Objects the architect asked me to?

May the gods bless you all.