sub new { my ($parent, $type, $args) = @_; my ($self) = {}; bless ($self); foreach my $table ($parent->{dbh}->tables()) { if ($table eq $type); $self->{type} = $type; last; }; }; return undef unless (defined($self->{type})); print STDOUT "new - Creating new object of type '", $self->{type}, "'\n" if ($parent->{debug}); my ($sth) = $parent->{dbh}->prepare("select * from ".$self->{type}); $sth->execute; for (my $index = 0; $index < $sth->{NUM_OF_FIELDS}; $index++) { $self->{data}->{$sth->{NAME_lc}->[$index]} = (defined($$args{$sth->{NAME_lc}->[$index]})) ? $$args{$sth->{NAME_lc}->[$index]} : undef; }; return ($self); };