The webserver may not be serving the CGI from the same directory structure as you are using from the command line. Are you using a relative path to the module? If so, you may need to use Cwd to find out where the webserver thinks your script is running from.