Re: [mp2] reliable methods to prevent handlers from repeating

[prev] [thread] [next] [Date index for 2005/01/20]

From: Dorian Taylor
Subject: Re: [mp2] reliable methods to prevent handlers from repeating
Date: 22:33 on 20 Jan 2005
On Thu, Jan 20, 2005 at 05:00:32PM -0500, Geoffrey Young wrote:
> 
> > what technique would you use if you had to have a handler work
> > exactly once, even though it may never be invoked as an initial
> > request?
> 
> if you're in prefork, off the top of my head I might set a perl global and
> then reset it using a cleanup handler.  something like
> 
> $My::Foo::seen++;
> $r->register_cleanup(sub { undef $My::Foo::seen });

hm, the reason why i did the thing with the notes is because i've
seen similar constructs in C apache modules to avoid handler looping
(i'm pretty sure mod_rewrite does it).

what about unregistering the handler from the stack? is that possible?

> so, again in prefork only, at the start of any request $My::Foo::seen should
> be false.  all bets are off if you're using threads.

yeah, i'm staging in prefork (doing my best to write code that
*looks* thread-safe) currently but i'm going to be wanting to move
to worker as soon as possible.

just to clarify: what *are* $r->next/prev if not a way to access
the requests that have happened since the main, or is it only those
which have happened via internal_redirect? are the subrequests
generated by lookup_uri exempt from the list?

.d

Re: [mp2] reliable methods to prevent handlers from repeating
Dorian Taylor 22:33 on 20 Jan 2005

Re: [mp2] reliable methods to prevent handlers from repeating
Philippe M. Chiasson 22:32 on 20 Jan 2005

Generated at 17:42 on 27 Jan 2005 by mariachi v0.52