Hi,
to read a record from a database I generated a list of the column names
(@fields).
The get/set methods of the record class are constructed like "set+name
of column" e.g. getDate, setAmount.
After the DB-connect I would like to automatically generate the name of
the appropriate
set-method in order to reduce the typing :) :
while (my $hrRes = $sth->fetchrow_hashref)
{
foreach (@fields)
{
$self->"set".$_($hrRes->{$_});
# resulting in e.g. $self->setDate($hrRes->{'Date'}) or
# $self->setAmount($hrRes->{'Amount'})
}
}
How can I accomplish that (if at all)?
Thank you for yor help.
--
K. Jantzen
*
* <http://www.jantzen-software.de>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>