This is slightly off the topic you're bringing up, but most CGI infrastructures, like CGI::Application and Catalyst provide a way to check these things before every request, in one place, in OO fashion. I suggest checking them out.
My criteria for good software:
Does it work?
Can someone else come in, make a change, and be reasonably certain no bugs were introduced?