getter setter and database
- From: KenPerl@xxxxxxxxx
- Date: 16 May 2006 22:03:37 -0700
suppose I have a table person with following columns, name, age,
salary. If use OOP to write a class like this,
package Person;
sub new{
$class=shift;
my $self = {};
$self->{_name} = undef;
$self->{_age} = undef;
$self->{_salary}= undef;
bless ($self,$class);
return $self;
}
#accessor method for name
sub name {
my $self = shift;
my $name = shift;
$self->{_name} = $name if defined($name);
return $self->{_name};
}
My question is, should I query/update the table at the same time in
above accessor method? If not, what's the best practice?
.
- Prev by Date: Re: can't load library that exists (Oracle.sl)
- Next by Date: (Fwd) Just a quick question on the DBI perl mod ORA-24315: illegal attribute type
- Previous by thread: DBD::Multiplex, mysql replication and transactions
- Next by thread: (Fwd) Just a quick question on the DBI perl mod ORA-24315: illegal attribute type
- Index(es):
Relevant Pages
|