> > > I have built modperl 1.25.
> > >
> > > I could run perl scripts fine.
> > >
> > > How can I send parameters to a perl scripts?
> > >
> > > Using  http://mydomain.com/perl/foreach.pl?200+300 does not seem to
work.
> >
> > you'll need to do it as something like
> > http://mydomain.com/perl/foreach.pl?num1=200&num2=300
> >
> > then do :
> >
> > my $q=new CGI;
> > my $num1=$q->param('num1');
> > my $num2=$q->param('num2');
> >
> > Parameters work a bit different in mod_perl.
> >
> >   Issac
> >
> > PS.  Stas - you DID remember to put this into the book somewhere...
didn't
> > you?  I'm sincerely praying that I just don't remember where... :)
>
> What do you mean? Are you talking about $r->args?
> http://perl.apache.org/guide/snippets.html#CGI_params_in_the_mod_perl_ish_
> If so, yes, it handles empty values differently from CGI::param.
>

No.  Since the book is designed for newbies, as far as I can see anyway, I
think that there should be a section somewhere explaining that parameters in
the CGI world work different from parameters in the command line script
world.  You should explain how the argument array is not used in
CGI/mod_perl, but rather paramters are passed as key/value pairs which are
read from the request.  Explain the basics of it, and maybe give an example
HTML snippet like:

<INPUT TYPE="TEXT" NAME="givenName">
<INPUT TYPE="TEXT" NAME="lastName">
<INPUT TYPE="HIDDEN" NAME="emailAddress" VALUE="[EMAIL PROTECTED]">

And explain that if the user typed in "Issac" in the first box and
"Goldstand" in the second box, his perl script would get these paramters in
a key/pair list (which can be placed into a nice little hash) and then
accessed...

Give a little example:

print "Hello $form{givenName} $form{lastName}.  Your email address is
$form{emailAddress}.\n";

That's what I was referring to.  And I don't _think_ it's in the book.  And
if you'll look at the original question, it apparatly IS a newbie issue.

  Issac

Internet is a wonderful mechanism for making a fool of
yourself in front of a very large audience.
  --Anonymous

Moving the mouse won't get you into trouble...  Clicking it might.
  --Anonymous

PGP Key 0xE0FA561B - Fingerprint:
7E18 C018 D623 A57B 7F37 D902 8C84 7675 E0FA 561B

Reply via email to