perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John ORourke <>
Subject Re: [MP2] possible pnotes bug?
Date Mon, 09 Jan 2006 19:22:02 GMT
Torsten wasn't changing the value pointed to by $ctx, he was changing 
$ctx - therefore it looks like pnotes actually stores a reference to the 
scalar you give it, instead of the actual scalar itself as the docs 
imply.  So I'd say it's a doc bug, but I'd prefer pnotes to store the 
actual scalar instead.

Torsten - for a workaround try not re-using $ctx until it's gone out of 
scope, like this:

                        my $tmp={one=>1,two=>2};
                        my $tmp='nothing';
                        print Dumper($r->pnotes('x'))."\n------------\n";
                print Dumper($r->pnotes('x')); # prints the same hash

Clint Edwards wrote:

>Yes this is expected, $ctx contains a reference to an anonymous hash,
>and when you store the value of $ctx in your pnotes, you are merely
>storing another reference, therefore whenever the values pointed to by
>$ctx change, you effectively change what is seen in pnotes.

View raw message