http://www.perlmonks.org?node_id=309661


in reply to DBI/mysql gathering all rows on execute

This is besides the point of your post, but consider turning on the RaiseError attribute and then you can get rid of all your or die code, which is actually lacking a print of $DBI::errstr anyway. From the DBI docs:
RaiseError (boolean, inherited) The RaiseError attribute can be used to force errors to raise exceptions rather than simply return error codes in the normal way. It is "off" by default. When set "on", any method which results in an error will cause the DBI to effectively do a die("$class $method failed: $DBI::errstr"), where $class is the driver class and $method is the name of the method that failed.

PApp::SQL and CGI::Application rock the house