use Class::LazyLoad [ qw/ DBI connect / ]; my $dbh = DBI->connect( @your_params_here ); # Right now, the $dbh hasn't actually connected or done DBI-ish things. $dbh->do_whatever(). # Now, it does.