A few more questions please.  Am I passing the paramters in the anchor
examples I presented earlier as I should using PerlRun or mod_perl?   Should
I be able to see the correct passed parameters when I pull them across to
the module invoked by the anchor prior to entering a sub in that module (my
$page = new CGI;$params = $page->param("str");)?  If a subroutine needs many
parameters, how would you recommend they be passed?  After simply installing
mod_perl, am I using the Apache embedded Perl interpreter or do I have to
make the transition to PerlRun or mod_perl for this to occur?

CraigT 

    

Michael Peters wrote:
> 
> CraigT wrote:
>> Perrin,
>> 
>> Is what I'm hearing you say is that in the PerlRun environment (and I'm
>> guessing the mod_perl environment too), anything that a subroutine uses
>> coming from outside that code must be passed as a parameter like
>> '&sub($paramter)'.   Am I correct in this.    
> 
> Yes and no. The key to understanding this under mod_perl is that global
> variables and packaged scoped variables do not get reinitialized for each
> request like they do under normal CGI.
> 
> So if you are using a global var that should retain state between
> requests, then
> no you don't need to pass it to each subroutine. But if you're not, then
> yes you do.
> 
> And btw, you don't need the '&' in front of the the sub.
> 
>   sub($paramter)
> 
> is the proper way to do it.
> 
>> Associating the words scope and closure helped.   I know scope well
>> although
>> different languages implement the idea differently.   I had not heard the
>> word closure before or had not understood it as scope.
> 
> While related, they aren't the same thing. A closure is a function that
> "remembers" it's lexical environment when compiled. So it can reference
> things
> that were declared in the same scope as it self.
> 
> http://en.wikipedia.org/wiki/Closure_%28computer_science%29
> and in Perl
> http://www.perl.com/pub/a/2002/05/29/closure.html
> 
> Depending on the other languages you know, you might never have
> encountered a
> closure before since they don't exist in languages like C, C++ or Java.
> 
> -- 
> Michael Peters
> Developer
> Plus Three, LP
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/passing-CGI-paramters-tf4008753.html#a11465053
Sent from the mod_perl - General mailing list archive at Nabble.com.

Reply via email to