in reply to CGI.pm not returning POSTed param w/mod_perl

I assume you're developing under the strict pragma, correct?

It sounds like you're creating your CGI object as a lexical variable (like my $q=new CGI;) and expecting it to be global throughout all your subroutines. For some crazy reason, this isn't how variable scoping behaves under mod_perl, specifically the Apache::Registry handler. When the above happens, you can't predict what value your CGI object will have in a nested subroutine. Sometimes nothing, sometimes a previous value, etc. It's very bizarre, 'cuz your script will run fine under regular CGI.

See This node for a long discussion of this. You have a few options. Probably the easiest one is to declare the CGI object as global with a global variable at the top of your script, (ala use vars qw/$q $dbh/;)

perl.apache.org has fabulous documentation. Go here for all you need to know about variable scoping and mod_perl

Update: After re-reading your post, this might be more useful to you. It discusses sharing global variables between modules.

  • Comment on Re: CGI.pm not returning POSTed param w/mod_perl