You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Martin Moss <Ma...@btinternet.com> on 2003/04/04 14:08:47 UTC

Subclassed Apache::Request Objects and their creation/destruction

All,

I'm looking for some help with understanding how the Apache::Request objects
are created and destroyed.
I have the following params set in my httpd.conf

KeepAlive Off
PerlChildInitHandler Bficient::Apache::DBload

Which as I understand it should mean that an apache::Request object is
created for each request, and is destroyed at the end of a request.

So if I add 'CREATION and DESTROY' warnings to my Apache::Request code to
log when a request is being created and destroyed I should see the objects
being created and destroyed as they are used.

This would lead me to believe that when I stop apache, the only DESTROY
messages I should see are those belonging to the childInitHandler, e.g. I
should see my database handles being destroyed.

I'm just trying to get an understanding of what 'should' happen, so that I
can work out If I have a problem with my code.

I have subclassed Apache::Request and I'm seeing my subclassed
Apache::Request objects being
'DESTROYED' under an apache stop. AS WELL as after the Request completes,
e.g.

after the request completes I see this:-

$VAR1 = bless( {
                 'r' => bless( do{\(my $o = 145326836)}, 'Apache::Request' )
               }, 'Bficient::Apache::Request' );
DESTROYING Bficient::Apache::Request


But when I stop apache I see this:-
$VAR1 = bless( {
                 'r' => undef
               }, 'Bficient::Apache::Request' );
DESTROYING Bficient::Apache::Request

This doesn't look 'right', but I'm not sure.
Attached is my Bficient::Apache::Request object, If that helps.

Any help, or pointers would be greatly appreciated,

kind regards

Marty

Re: checking what values have been set using pnotes/notes

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

Martin Moss wrote:
> All,
>  
> Is there a way to work out what values have been set using pnotes/notes, 
> So that a cleanup Handler can dynamically clear the values, rather than 
> only clear ones pre-programmed?

both notes and pnotes are guaranteed fresh at the start of each request, so 
there is no need for you to clean them up yourself.

--Geoff


checking what values have been set using pnotes/notes

Posted by Martin Moss <Ma...@btinternet.com>.
All,

Is there a way to work out what values have been set using pnotes/notes, So that a cleanup Handler can dynamically clear the values, rather than only clear ones pre-programmed?

Marty