package MyDB_DB; use DBI; use constant DBI_STRING => 'dbi:mysqlPP:plant;merlin','uname','password'; my $dbh; sub DB_connect { $dbh = DBI->connect( DBI_STRING ) || die "Cannot connect: $DBI::errstr\n"; #return $dbh; } sub DB_prepare { my $statement = pop; #print 'PlantDB_DB: '.$statement."\n"; my $sth = $dbh->prepare($statement) || die "Cannot prepare statement: $DBI::errstr\n"; return $sth; } sub DB_execute { my $sth = pop; $sth->execute || die "Cannot execute statement: $DBI::errstr\n"; } sub DB_finish { $dbh->disconnect; } sub new { my $self = {}; bless $self; return $self; } return 1;