Re: setHandler question
Ryan Gies <[email protected]>
| Newsgroups | gmane.comp.apache.mod-perl |
|---|---|
| Message-ID | <[email protected]> |
On 12/14/2012 8:52 AM, André Warnier wrote:
> I suppose that in the end I will want to do something like this :
>
> my $finfo = $r->finfo();
> # do something to $finfo to set the flag
> $r->finfo($finfo);
> $r->handler('modperl');
> $r->set_handlers(PerlResponseHandler => \&_my_response_handler);
>
> but how do I "do something to $finfo" ?
>
> Or am I totally off-track here ?
>
> TIA
For what it's worth, I have consistent success in using $r->finfo to
tell Apache the final destination. In the case that $you_want_to_hook
(below) is false, Apache will also serve the intended file. The timing
used is:
PerlMapToStorageHandler
$r->filename($path); # where $path is an absolute file-system path
$r->finfo(APR::Finfo::stat($path, APR::Const::FINFO_NORM, $r->pool));
return Apache2::Const::OK;
PerlFixupHandler
if ($you_want_to_hook) {
$r->push_handlers(PerlResponseHandler => \&_response_handler);
$r->handler('modperl');
return Apache2::Const::OK;
}