Torsten, 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.
On Mon, 2006-01-09 at 19:14 +0100, Torsten Foertsch wrote: > Hi, > > consider this handler: > > sub handler { > my $r=shift; > > $r->content_type('text/plain'); > > my $ctx={foo=>1, bar=>2}; > > $r->pnotes(x=>$ctx); > > $r->print( ">>>>>>>>>>>>>>>>\n".Dumper( $r->pnotes('x') ) ); > > undef $ctx; > > $r->print( "<<<<<<<<<<<<<<<<\n".Dumper( $r->pnotes('x') ) ) ; > > return Apache2::Const::OK; > } > > I would expect it to print 2 times the same hash. Undefining $ctx > should not > affect the value saved in pnotes. But here is what is printed: > > $ curl http://localhost:8082/pnotes > >>>>>>>>>>>>>>>> > $VAR1 = { > 'bar' => 2, > 'foo' => 1 > }; > <<<<<<<<<<<<<<<< > $VAR1 = undef; > > If something else is assigned to $ctx instead of undefining it the > pnotes > value also reflects this. > > Is that the intended behavior? > > > Torsten -- Clint Edwards Software Developer McClatchy Interactive 919.861.1265 [EMAIL PROTECTED] http://www.mcclatchyinteractive.com