If you're NOT in a CGI environment, but in mod_perl (or some other environment where perl shares the same process with the web server) it's possible that the webserver or one of its "plugins" uses a different version of the mysql client library and that would muck things up.
It would help if you post the actually reported error instead of just "the following comment just above the line that fails"