package DBIx::Handy; my $dbh = undef; sub get_instance { my $class = shift; if($dbh == undef){ $dbh = ... } return $dbh; } ...etc