...
my $recs = $dbh->selectall_arrayref( $sql );
my @people;
foreach my $rec ( @$recs ) {
my $i = 0;
my $person = Person->new();
foreach my $meth ( qw( name hight weight age gender dob ) ) {
$person->$meth( $rec->[$i++] );
}
push @people, $person;
}
####
package Base;
use strict;
use warnings;
our @ISA = qw();
use vars qw( $AUTOLOAD );
sub new
{
...
}
sub throw
{
my $self = shift;
my($p,$f,$l) = caller();
die "Exception at: ",$p,"->$f($l)\n ",join('',@_);
}
# report non-existant methods
sub AUTOLOAD
{
my($self) = @_;
$self->throw("Error, unsupported method: $AUTOLOAD\n");
}
1;
####
$person->shoeSize();