sub new_from_DBH{ #if you have already DBI connection, you can use this my ($pkg, $dbh, $param) = @_; my $self = {}; $self->{'DBH_OBJ'} = $dbh; $self->{'param'} = {}; foreach my $key(keys %{$param}){ $self->{'param'}->{$key} = $param->{$key}; } bless($self, $pkg); return $self; }