Hi, some time ago there was an argument about the "right" behavior of pnotes, see http://www.gossamer-threads.com/lists/modperl/dev/87819.
The question was whether $r->pnotes(key=>value) should do exactly the same as $r->pnotes->{key}=value or for some historical reason not. The problem is that after: my $foo = 123; and storing $foo as a pnote: $r->pnotes('foo' => $foo); any subsequent changes on $foo like $foo=456 affect also the pnote and changes to the pnote like $r->pnotes->{foo}++ affect $foo. Otherwise, if the pnote is stored as: $r->pnotes->{foo}=$foo; subsequent changes to either $foo or $pnotes->{foo} don't affect the other value. Back then one fraction said the behavior is right as it is now because it was so also in mp1 and because such a change is not to be done within a stable release-cycle. The other saw it this way, for the user both ways of setting a pnote look identical, hence they should behave identical. What is the common understanding on this point by now? I think a possible fix is as simple as this: Index: src/modules/perl/modperl_util.c =================================================================== --- src/modules/perl/modperl_util.c (revision 412021) +++ src/modules/perl/modperl_util.c (working copy) @@ -889,7 +889,7 @@ char *k = SvPV(key, len); if (val) { - retval = *hv_store(*pnotes, k, len, SvREFCNT_inc(val), 0); + retval = *hv_store(*pnotes, k, len, newSVsv(val), 0); } else if (hv_exists(*pnotes, k, len)) { retval = *hv_fetch(*pnotes, k, len, FALSE); Torsten
pgpBhMtflCQ3s.pgp
Description: PGP signature