Re: passing CGI paramters

2007-07-07 Thread CraigT
PAN. > > No, ModPerl::RegistryLoader comes with mod_perl 2. > >> And when I transition to PerlRun and mod_perl, my >> understanding is that I should preload the application programs into the >> ModPerl::Registry? > > You don't really have to preload anything. It may save you some > memory, but it's not important at this point. Wait until your code is > working to worry about things like that. > >> If I preload the Perl modules I'm using, do I still need to 'Use' those >> modules in my application programs? > > You don't technically have to, but it's a good practice to do it > anyway, to make it clear which modules depend on which others and make > it easier to work with later. > > - Perrin > > -- View this message in context: http://www.nabble.com/passing-CGI-paramters-tf4008753.html#a11478312 Sent from the mod_perl - General mailing list archive at Nabble.com.

Re: passing CGI paramters

2007-07-06 Thread Perrin Harkins
On 7/6/07, CraigT <[EMAIL PROTECTED]> wrote: In this regard though, I would like to ask what you recommend to pass back several paramters from a sub The usual way to do it is to accept a list of return values: my ($foo, $bar) = sub_call($param); I'd like to focus on this problem here because

Re: passing CGI paramters

2007-07-06 Thread CraigT
T') { $docroot = $ENV{$key}; } if ($key eq 'SERVER_NAME') { $servname = $ENV{$key}; } } # Get the paramters from the calling program - shoidls.cgi. $govlevel = $page->param("str"); $govcat = substr($govlevel,0,1); $gov = substr($govlevel,1,length($govlevel)-1); This concludes the code for the 2 programs - m3.cgi and ss.cgi. Question 3 and 4. If I preload (compile) my application programs into the Apache registry as I hope to, when I execute under CGI I'm thinking those copies will be used if I have the correct handler (like the one below) in my Apache httpd? I haven't found a package for Apache::RegistryLoader yet and may have to get it form CPAN. And when I transition to PerlRun and mod_perl, my understanding is that I should preload the application programs into the ModPerl::Registry? PerlModule Apache::Registry Alias /cgi-bin/ "/usr/www/steepusa/cgi-bin/" SetHandler perl-script PerlResponseHandler Apache::Registry Options +ExecCGI PerlOptions +ParseHeaders Question 5. If I preload the Perl modules I'm using, do I still need to 'Use' those modules in my application programs? CraigT Perrin Harkins wrote: > > On 7/6/07, CraigT <[EMAIL PROTECTED]> wrote: >> Am I passing the paramters in the anchor >> examples I presented earlier as I should using PerlRun or mod_perl? > > I don't think you ever showed us the code. You just showed the code > where you print the HTML. If you can show us a complete sub and how > you call it, we can tell you if it looks right. > >> 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");)? > > Yes, even if y ou have a scoping problem, code that is in the "main" > part of your script, outside of subs, should be able to see the > correct values. > >> If a subroutine needs many >> parameters, how would you recommend they be passed? > > Use a hash: > > foo(x => 1, y => 2); > > sub foo { > my %args = @_; > print $args{x}, $args{y}; > >> 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? > > You have to use PerlRun or some other mod_perl handler. > > - Perrin > > -- View this message in context: http://www.nabble.com/passing-CGI-paramters-tf4008753.html#a11475056 Sent from the mod_perl - General mailing list archive at Nabble.com.

Re: passing CGI paramters

2007-07-06 Thread Perrin Harkins
On 7/6/07, CraigT <[EMAIL PROTECTED]> wrote: Am I passing the paramters in the anchor examples I presented earlier as I should using PerlRun or mod_perl? I don't think you ever showed us the code. You just showed the code where you print the HTML. If you can show us a complete sub and how you

Re: passing CGI paramters

2007-07-06 Thread Perrin Harkins
On 7/5/07, CraigT <[EMAIL PROTECTED]> wrote: 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.

Re: passing CGI paramters

2007-07-06 Thread CraigT
/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.

Re: passing CGI paramters

2007-07-05 Thread Michael Peters
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

Re: passing CGI paramters

2007-07-05 Thread CraigT
essage that you get when you have closure problem. It means > the variable will be cached the first time through and never change > again. > > All that you need to do to fix this problem is to pass all of the > variables that your sub needs to the sub when you call it. If you &

Re: passing CGI paramters

2007-07-04 Thread Perrin Harkins
On 7/4/07, CraigT <[EMAIL PROTECTED]> wrote: In each of the modules, I bring 'str' across with something like my $somevar = $page->param("str") assigning the paramter values to a declared Perl variable. Okay, but do you pass $page explicitly to the sub, or do you just define it outside the sub

Re: passing CGI paramters

2007-07-04 Thread CraigT
ions on how I might >> proceed >> here. The Apache 'ab' modules tells me I can improve the # of request >> per >> second that my server can server by a facor of 3 and I would like to do >> it >> if I can. >> >> CraigT >> >> >> >> >> >> Perrin Harkins wrote: >> >>> [Please keep it on the list] >>> >>> On 7/3/07, Craig Tussey <[EMAIL PROTECTED]> wrote: >>> >>>> Thanks again for responding. Here is the link to my >>>> scratchpad. Keep in mind that I was making entries >>>> to the scratchpad in response to Clintons questions. >>>> >>>> http://www.perlmonks.org/?viewmode=public;node_id=624649 >>>> >>> Okay, you really aren't showing much code here. From what you did >>> show, I'm guessing you're doing this: >>> >>> my $govlevel = $page->param("str"); >>> print_html(); >>> >>> sub print_html { >>> print "blah blah $govlevel blah blah"; >>> } >>> >>> That doesn't work because the sub becomes a closure and never notices >>> when you create new versions of $govlevel. The fix is to pass >>> $govlevel to the sub as a parameter. >>> >>> - Perrin >>> >>> >>> >> >> > > > -- View this message in context: http://www.nabble.com/passing-CGI-paramters-tf4008753.html#a11433964 Sent from the mod_perl - General mailing list archive at Nabble.com.

Re: passing CGI paramters

2007-07-04 Thread David Scott
Have a look at this: http://www.perl.com/pub/a/2002/05/07/mod_perl.html Perrin is probably right that it's a closure issue. Take a good look at your code. Incidentally, I've found it useful to do a Google search on incomprehensible error messages ..:) d CraigT wrote: Perrin, I'm not su

Re: passing CGI paramters

2007-07-04 Thread CraigT
; > my $govlevel = $page->param("str"); > print_html(); > > sub print_html { > print "blah blah $govlevel blah blah"; > } > > That doesn't work because the sub becomes a closure and never notices > when you create new versions of $govlevel. The fix is to pass > $govlevel to the sub as a parameter. > > - Perrin > > -- View this message in context: http://www.nabble.com/passing-CGI-paramters-tf4008753.html#a11432833 Sent from the mod_perl - General mailing list archive at Nabble.com.

Re: passing CGI paramters

2007-07-03 Thread Perrin Harkins
[Please keep it on the list] On 7/3/07, Craig Tussey <[EMAIL PROTECTED]> wrote: Thanks again for responding. Here is the link to my scratchpad. Keep in mind that I was making entries to the scratchpad in response to Clintons questions. http://www.perlmonks.org/?viewmode=public;node_id=624649

Re: passing CGI paramters

2007-07-03 Thread Perrin Harkins
On 7/3/07, CraigT <[EMAIL PROTECTED]> wrote: I put a lot of stuff in my (cliff) scratchpad like the ENV values, the relevant Apache httpd entries, a dump, the Apache error log, and code examples. Would it be possible for you to review the stuff I put there? Maybe later. Do you have a link fo

Re: passing CGI paramters

2007-07-03 Thread CraigT
anging the data the paramters are composed from between the 2 >> executions, the paramters do not change on the second execution under >> PerlRun but do under CGI. > > It sounds like your code has a scoping bug, probably an unintentional > closure. Can you show us the cod

Re: passing CGI paramters

2007-07-03 Thread Perrin Harkins
Hi, There's no need to post your question four times. I'm trying to bring my application up using ModPerl::PerlRun. I have anchors at places in my code like I can't tell what you're doing from this description. Can you show us some of your code? Additionally, if I execute the same anchor

passing CGI paramters

2007-07-01 Thread CraigT
Hello, I'm trying to bring my application up using ModPerl::PerlRun. I have anchors at places in my code like http://www.nabble.com/passing-CGI-paramters-tf4008753.html#a11384626 Sent from the mod_perl - General mailing list archive at Nabble.com.