package MySchema; #... setup schema stuff here ... __PACKAGE__->connection(sub { # Do whatever you want to do to build your $dbh return $dbh; });