On Monday 09 January 2006 20:22, John ORourke wrote: > Torsten - for a workaround try not re-using $ctx until it's gone out of > scope, like this: > > $r->content_type('text/plain'); > { > my $tmp={one=>1,two=>2}; > $r->pnotes('x',$tmp); > } > { > my $tmp='nothing'; > print Dumper($r->pnotes('x'))."\n------------\n"; > } > print Dumper($r->pnotes('x')); # prints the same hash
Another workaround is this: sub Apache2::RequestRec::save_pnotes { my $r=shift; $r->pnotes(@_==2 ? ($_[0], my $x=$_[1]) : @_); } or even this: BEGIN { my $pn=\&Apache2::RequestRec::pnotes; *Apache2::RequestRec::pnotes=sub { my $r=shift; $r->$pn(@_==2 ? ($_[0], my $x=$_[1]) : @_); } } But my intend was to point out what seemed to me like a bug. The only hint I found in the docs for the behavior is the word "Share" in: "Share Perl variables between Perl HTTP handlers" Torsten
pgp9eQHsQseth.pgp
Description: PGP signature