On Wed, 2003-08-06 at 04:50, Steve Bannerman wrote: > However, it doesn't really explain why the "root problem" exists. The way I > think about it, the creation of a new CGI "object" should create a new "set > of slots" for instance data.
That would make sense, but very little about CGI.pm actually works in the way you would expect. It's a very bizarre module because of the dual functional and object interface, and it uses lots of globals even if you are only calling the OO interface. If possible, I would suggest you consider using CGI::Simple instead, which is a drop-in replacement. > Maybe I don't understand the "object paradigm" in perl correctly; however, I > do understand it very well in general. Thus, it seems like a defect in > either perl (the language) or CGI.pm. It's a problem with CGI.pm, not with your understanding of Perl OO. I believe I see the source of your troubles in the code that you posted. You are creating a closure by using a lexical variable and then accessing it from within a sub. This is a no-no with any long-running system like mod_perl. You can get away with it in a standard CGI environment (or PerlRun) because it just exits after each request instead of running the same code again. Here is the offending section: my $cgi = new CGI; &saveFile(); sub saveFile { my $inputfile = $cgi->param('file'); ... etc ... } Change it to this: my $cgi = new CGI; saveFile($cgi); sub saveFile { my $cgi = shift; my $inputfile = $cgi->param('file'); ... etc ... } I think that will do it. - Perrin