While in scope and until you issue
$dbh->disconnect you will have a database connection. So, as others have pointed out, you have to initiate the code via a sub in your required file. Recall that require does nothing more than act like include. No actual code in the required file will be executed without express written permission from the programmer.