Hi,
I had strange situation here today. I have added a $r->pool cleanup like:
$r->pool->cleanup_register
(sub {
my ($r)=@_;
use Data::Dumper;
warn Dumper $r->pnotes;
}, $r);
At that time there were no pnotes present.
Later I added pnotes the usual way $r->pnotes->{...}=...
Then I wondered why my pool cleanup function didn't show any notes.
After a few hours it occurred to me. The pnotes cleaner is also a pool
cleanup. So it depends on the registration order. Well almost since elements
in the cleanup queue can become invalid when a cleanup is killed. Later such
elements can be reused. So generally a certain order cannot be assumed.
But in my case, adding a single pnotes() call *before* registering the cleanup
solved the problem:
$r->pnotes;
$r->pool->cleanup_register
(sub {
my ($r)=@_;
use Data::Dumper;
warn Dumper $r->pnotes;
}, $r);
Suddenly, the notes were shown.
Now, this seems like a bug to me.
Modern APR versions know about pre_cleanup functions that are run in the first
place in apr_pool_clear.
Should we support them separately as APR::Pool->pre_cleanup_register or should
we simply move our pool cleanups to the pre_cleanup stage?
I think the former is more appropriate.
In the mean time use $r->notes in such cases or perhaps
$r->connection->pnotes.
Torsten Förtsch
--
Need professional modperl support? Hire me! (http://foertsch.name)
Like fantasy? http://kabatinte.net
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]