package LSPDB; use DBI; sub make_trouble { my $dbh = _connect(); return $dbh->selectrow_hashref("SELECT bar FROM course where foo = ?", {}, 1); } sub _connect { my $db_options = { HandleError => \&_db_handle_error, AutoCommit => 1, }; my $_dbh = DBI->connect( 'DBI:Sybase:server=foo;database=bar', 'theuser', 'thepass', $db_options, ); return $_dbh; } sub _db_handle_error { my ($errstr, $dbh, $ret) = @_; die $errstr; } 1;