I'm having a bit of a problem getting my head around the Apache2::Directive object in mod_perl. But I think I'll be able to understand it once I see an example, so I just want a freelancer to do the basic part of this function.
(and appologies to the guys who bid on my last project ... hopefully I won't get taken to hospital this time, so this one will avoid cancellation)
I need a perl function writing which will find the appropriate bit of the configuration for a request, and setup a PerlResponseHandler. The following is mostly guesswork about how it would work, so I'll accept anything that can give me similar functionality. Just let me know beforehand if you can do what I expected. Thanks.
I'd like to know whether it will be possible for this function to work when called from within the response handler, from within the post config handler, or both. (Or is there some other place to put it?)
My basic concept is a function:
set_response_handler( $handler_object, $hostname, $port, $location );
If $location is specified, it is the start of a URL path. The function should find the most specific <Location>, <Directory> or similar section that would match that URL under the specified hostname. If there isn't one, a new <Location> should be created.
If $hostname is specified and $location isn't, the script should find a VirtualHost section or similar for that hostname. If there isn't one, it should create a <VirtualHost> section with the appropriate servername (and $port if specified), and also version with "www." prepended or removed as an alternate server name.
Having found the appropriate section in the config tree, the function will check if it has a PerlResponseHandler. If it doesn't, or if the response handler is currently 'Hetero::ApacheHandler' or 'Hetero::ApacheHandler->handle_response', the response handler should be set to $handler_object->handle_response
I'm nor sure what a sensible return value for this function would be, so it should probably just be true for success.