It depends on the scope of your object. Your idea is okay if it only lasts for the one request. If it lasts longer, that DBI connection might get replaced by a new one. I typically write an accessor method for getting a database handle instead. Some people use a singleton object, which is pretty much the same deal.