Perhaps I wasn't being clear.
I want to perform the handler/location mapping at start time, not runtime. I don't want to rewrite URIs. I don't want to add mime-type handlers. I simply wish to mimic the httpd.conf functionality of assigning a Location to a specific module/handler for the response phase. BEFORE a response is available.
please always reply back to the list. Thanks.
You want to use <Perl> sections for that purpose. http://perl.apache.org/docs/2.0/user/config/config.html#C_E_lt_PerlE_gt___Sections
Stas Bekman wrote:
ydnar wrote:
I'm trying to alter the Apache configuration from within a module, in code. Ideally, instead of having a number of these sections in a config file:
<Location /sl/foo> SetHandler perl-script PerlResponseHandler SL::Foo </Location>
I'd like to have code:
set_response_handler( Location => '/sl/foo', PerlResponseHandler => 'SL::Foo' );
or similar.
I've checked the documentation and searched, but nothing seems to demonstrate how to do this. The documentation for Apache::Directive and Apache::CmdParm is woefully incomplete. :)
It's OK if any particular solution requires execution at startup time, as I don't plan on registering any new location response handlers at runtime.
There are tons of examples in the documentation. Nothing has changed in this respect from mp1, so all the existing mp1 docs and books still apply. And mp2 docs document that pretty well. You must have missed this chapter:
http://perl.apache.org/docs/2.0/user/handlers/http.html
http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlTypeHandler $r->handler('perl-script'); $r->set_handlers(PerlResponseHandler => \&handler); http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlFixupHandler
assuming that all you do is sending a response in the response handler, any phase before PerlResponseHandler will do. Otherwise the most suitable place for this kind of operation is in the trans phase:
http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlTransHandler
and finally the API docs:
http://perl.apache.org/docs/2.0/api/Apache/RequestUtil.html#C_set_handlers_
__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
-- __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
-- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html