On Tue, 13 Aug 2002, Michael Drons wrote:

> Date: Tue, 13 Aug 2002 07:46:16 -0700 (PDT)
> From: Michael Drons <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> To: Perrin Harkins <[EMAIL PROTECTED]>,
>      darren chamberlain <[EMAIL PROTECTED]>
> Cc: [EMAIL PROTECTED]
> Subject: Re: variables not changing with modperl??
>
> Sorry,  There is a my in front of the ($cookie,$user)
> code.  I am confused about your second statement about
> parsing the input.  What should I be doing?  Do you
> mean I should use $r->read($content,
> $r->header_in('Content-length'))? to read in the
> variables?

Michael,

In one of your posts, you included the following code:

#!/usr/bin/perl -wT
use strict;
print "<body>";
my $r = Apache->request;
$r->content_type("text/html");
$r->status(200);
my $auth_type = $r->auth_type;
$cookie=$auth_type->key;
($user,$hash)=split(/:/,$cookie);
read(STDIN, my $buffer, $ENV{'CONTENT_LENGTH'});
my @pairs = split(/&/, $buffer);
foreach my $pair (@pairs) {
....
}

There is no "my" in front of $cookie or $user variables.  If you are
lexically scoping them somewhere else in your script, please include
enough of an example for us to help you.

> I use the AuthCookie modules to set the cookies and to
> authenicate.

As for this and Perrin's comment about parsing on your own, the point
is that you've written a lot of code that has already been written and
debugged by a lot of really smart people.  There's no reason for you
to be reading STDIN and spliting and all that.  If you're using
mod_perl, then you really should do yourself a favor and read up on
Apache::Request and Apache::Cookie for doing all this stuff.  It's
much faster (it's written in c), safer (it's been debugged), easier
(just install the module), and standard (i.e., more maintainable).

Of course, some people say that the nice thing about standards is that
there are so many to choose from.  :)

ky

Reply via email to