Yes, I've implemented it also that way. But I thought <Location> acts on the URI and in principle there can be a <Location>-specific transhandler. I'm wondering why it is impossible?
trans handlers are used to map the URI to a filename, the result of which lets Apache know to which <Directory> the URI belongs to. it can also affect which <Location> the URI belongs to if that <Location> is paired with an Alias directive. trying to make a trans handler <Location> specific doesn't really make sense - if you are already in a <Location> section then you should already know which file (or lack thereof) you want to serve. that's just how Apache works.
For now I have implemented that particular case by
PerlTransHandler MyPackage::transhandler <Location ...> PerlHandler MyPackage::handler </Location>
package MyPackage;
sub transhandler {
... return DECLINED
if(grep {$_ eq __PACKAGE__.'::handler'} @{$r->get_handlers('PerlHandler')});
...
}
i.e. if my handler is installed return DECLINED.
I don't think that will work the way you desire - the PerlHandler directive should not be merged into the current configuration for the request until after the trans handler runs, so I wouldn't expect it to be present in get_handlers() yet.
a better way is probably to let your PerlTransHandler run always. then, for requests to <Location> use a PerlHeaderParserHandler to unset $r->filename.
HTH
--Geoff