> I'm trying to store data about a user who has authenticated in
> $r->pnotes so that a perl logging phase handler can stick the user_id in
> the db. I call $r->pnotes('keyname' => 'somevalue'); in an apache
> registry script, and then call $r->pnotes('keyname') in the logging
> handler later on during the logging phase, but am getting nothing back.
> No errors, just undef. I've tried notes too, and no luck their either.
> I'm using Apache::Request btw. I've also tried retreiving a tied hash
> using $r->pnotes() and there are no key/values in that either.

the mod_perl API book specifically said pnotes is the way to communicate
between handlers.  As I have hte PDF version, I can't exactly cut & paste it
easily...

pnotes gets cleared after every request, so good thinking on trying notes, as
it apearently doesn't.

the basic usage is this:

$r->pnotes("MY_HANDLER" => [qw(one two)]);
my $val = $r->pnotes("MY_HANDLER");
print $val->[0]; # prints "one"

So basically, $r->pnotes("MY_HANDLER" => [qw(one two)]); will create a hash
where MY_HANDLER is a key to an anonymous array.

my $val = $r->pnotes("MY_HANDLER"); sets $val to be the reference to that
array.

print $val->[0]; dereferences the first spot in the array reference.  The
dereferencing thing is key here.  $val[0] will throw errors about globals not
being declared as arrays or something of that sort.


> Did I forget to compile apache or mod_perl with an option of some sort?
> I can't think of any other explanation. I compiled mod_perl with
> EVERYTHING=1

There is the problem right there.  It needs to be compiled with "EVERYTHING=1
PLUS_THAT_OTHER_LITTLE_THING_NOT_INCLUDED_IN_EVERYTHING=1".

:P

Dennis

Reply via email to