pnotes() expects a reference, it probably should croak if it's passed
something else. it just increments the reference count of the sv, it does
not make a copy. if you don't want to use a reference, you can copy it
yourself:
$r->pnotes(key => "$string")
I think you've made a closure...
my $subref;
{
my $a = "hi!"
$subref = sub { print "$a\n" };
$a = "huh?";
}
&$subref; #prints "huh?"
Is $r->pnotes really making a subref? I'm only starting
to get familiar with Apache.xs but I can tell that
notes is implemented directly on top of an Apache:
I had a situation where a pnotes() key set in one phase had a value I
did not expect in a later phase. Here's a small module that I wrote
as a HeaderParserHandler to illustrate:
package Ii::Apache::pnotes;
use Apache::Constants 'OK';
sub handler {
my $r = shift;
$r->push_handlers('PerlF