You've got your answer already, but on another note,
'
use Apache::DBI' and '
use Apache::Registry' do not belong
in your scripts. They go in your httpd.conf or startup.pl
(see the docs for each and for mod_perl) and they should
work transparently in mod_perl and have no purpose
in vanilla CGI.
In fact, IIRC, if a script has 'use Apache::DBI' in it then it will no longer run from the command line (and
maybe even under plain CGI??).