package Foo; sub new { my $dbh = External->dbh; # how we get the $dbh is not the question here my $driver = $dbh->SOMETHING; # now set to 'mysql', but what is "SOMETHING" ? bless {},__PACKAGE__.'::'.$driver; } sub general { same for all database drivers }