in reply to DBI::mySQL - philosophical question?

Now that I'm converting to 'use strict', each subfunction is naturally enough forcing me to declare the $dbh within it. So I presume my options are:
  1. declare $dbh as a global variable, use 'our' within the subfunctions and carry on with a single connection.
  2. connect and disconnect to the database for each separate database query.
My $0.02:
  1. I'm not sure why you would need our for every function, unless they are all in a different file.
  2. Never disconnect and then connect again if you can help it! Especially if you want to use different (non-mysql) databases on remote machines this can take a long time.

I'd say that the most "clean" way would be to pass the database handle ($dbh) as a parameter to the function.

This will at least make it possible to move the functions (and the calling code) to other packages and/or files without hassle (at the cost of having slightly more characters to type for each call).

HTH,
Joost.