Dorian Taylor wrote:
suppose i wanted the same logic as:

    return Apache::DECLINED unless $r->is_initial_req;

except that sometimes it may be necessary to serve for a subrequest,
just not more than once. the construct i tried is:

for (my $pr = $r; $pr; $pr = $pr->prev) {
if ($pr->notes->get(__PACKAGE__ . '::SEEN')) {
$r->log->debug("We've been seen already.");
return Apache::DECLINED;
} }
$r->notes->set(__PACKAGE__ . '::SEEN', 1);

That's because you are setting that SEEN flag in the subrequest itself, and that subrequest will most likely be short lived. Nobody will see that flag, unless that subrequest fires off another subrequest of it's own.

What you are trying to do is probably :

$r->main->notes->set(__PACKAGE__ . '::SEEN', 1);

And then your check becomes

$r->main->notes->get(__PACKAGE__ . '::SEEN');

Without a need to cycle over the requests list either.

--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/     F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5

Attachment: signature.asc
Description: OpenPGP digital signature



Reply via email to