BerkeleyDB wrapper with Perlish interface and error handling