in reply to $ENV question

This is only a guess... but I suspect that they are being set too late in your program. I've seen this sort of problem before where env vars set inside the program don't take effect when it relates to code that is liked in at run-time unless they are put inside a begin block. Try enclosing your statments to set your ENV values in a BEGIN block like this:
BEGIN { $ENV{DBI_DSN} = "path"; }
or if you want to be paranoid:
BEGIN { unless ($ENV{BEGIN_BLOCK}) { $ENV{DBI_DSN} = "path"; $ENV{BEGIN_BLOCK} = 1; exec 'env',$0,@ARGV; } }