in reply to Apache Modules

The basic problem is that you are using CGI.pm in a non-CGI environment. When invoking a CGI the apache server handler for CGIs sets up the environment variables and STDIN/STDOUT filehandles just before it executes the CGI program. The CGI apache handler sets up the CGI runtime environment *from* the info contained/accessable in the $r request object.

The big "Ahha!" experience for me was to realize that the $r request object is the rough equivalent of the $q CGI.pm query object. Actually the $r request object has alot more info in it, which is great.