in reply to YAOOM
my $recs = $dbh->selectall_arrayref( $sql ); my @people; foreach my $rec ( @$recs ) { my $i = 0; my $person = Person->new(); foreach my $meth ( map { $person->can($meth) } qw( name hight weig +ht age gender dob ) ) { $person->$meth( $rec->[$i++] ) if $meth; } push @people, $person; }
------
We are the carpenters and bricklayers of the Information Age.
Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: YAOOM
by petral (Curate) on Dec 08, 2001 at 01:31 UTC | |
|
Re: Re: YAOOM
by lachoy (Parson) on Dec 08, 2001 at 00:08 UTC | |
by dragonchild (Archbishop) on Dec 08, 2001 at 00:22 UTC | |
by lachoy (Parson) on Dec 08, 2001 at 05:38 UTC | |
|
Re: Re: YAOOM
by mortis (Pilgrim) on Dec 07, 2001 at 22:54 UTC |