It is best to provide a code snippet (preferrably a runnable one) in the post to take a look at.
I am not sure what you mean by 'Plain CGI env' and mod_perl. If the former is run from a shell, and the latter is run by a web server, there is a good probability that the user, cwd, and perl/path search dirs are not what you are expecting them to be