Perrin,

Thanks for your response...my replies below:
--
   Steve Bannerman
   [EMAIL PROTECTED]
   44.(0)1865.273866


> -----Original Message-----
> From: Perrin Harkins [mailto:[EMAIL PROTECTED]
> Sent: 06 August 2003 20:40
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: RE: HTTP POST: parameters "empty" when using
> ModPerl::Registry(okay when using ModPerl:PerlRun)...
>
> ...snip...
>
> 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.

You're correct...that made it work.

So with respect to your explanation about the "long running perl system," am
I to understand that the old version of the saveFile() subroutine uses a
reference to a different $cgi instance that the $cgi instance in the main
body of the script?

As I said, I'm new to perl but that seems to be an awfully strange behavior
of the language...if true, shouldn't the compilation (of the subroutine)
fail because it references an undeclared variable ($cgi)?

Cheers

>
> - Perrin

Reply via email to