So I figured it out on my own. For anyone in a similar situation, you can turn on transactions
$dbh->{AutoCommit} = 0;
And then try to delete the row, like this for example…
my $sth = $dbh->prepare("DELETE FROM auth_users WHERE username = ?");
$sth->execute($username);
And then check for an error...
if ( $sth->err ) { print "CAN'T be deleted.";}
else { print "CAN be deleted.";}
And then just roll back to not commit to the delete in case it could be deleted…
$dbh->rollback;
This is what works for me. If anyone has any better ideas, or some concerns with this method, feel free to share.