> Ok. Working through the docs(converting to mp2-API) the following
> question came to my mind:
> 
> Are there any rules, which (response-)method is in which module?
>   - no_cache is found in Apache::RequestUtil
>   - update_mtime/set_last_modified are found in Apache::Response
>   - content_type is found in Apache::RequestRec
>   - headers_out/error_headers_out are found in Apache::RequestRec
> 
> Doesn't they all belong to Apache::Response, they all deal with the
> Response, don't they?

content_type, headers_out, and err_headers_out are all a part of the C
request_rec structure.  for the most part, these accessor methods merely
perform a get/set on the request_rec slot with little or no intervention, so
we put them in the Apache::RequestRec class.  notes, headers_in, and a few
others are also in this class (since they are part of the request_rec
structure also).  think of RequestRec as using the official Apache API to
access the request_rec slots (if you think that way :)

while no_cache is also a slot in the request_rec, as a convenience mod_perl
adds some useful manipulations when calling $r->no_cache - it will also
set/unset the Pragma and Cache-control headers to make no_cache() more
intuitive.  thus it lives in RequestUtil, as a method firmly based in $r
(the request_rec) but with added mod_perl sugar.  other similar methods are
$r->dir_config and $r->as_string.

the rest of the Apache API goes into a bunch of other classes, specific to
the API's task.  so there is Apache::Response for dealing with response-type
things (like caching headers), Apache::Access for dealing with
access/authen/authz things (like get_basic_auth_pw), and so on.

if you kind of get your head around this it does make sense after a while :)
actually, stas and I agreed just last night that Apache::Server and
Apache::Connection should be broken down in the same way, so the next
release of mod_perl will have Apache::ServerRec and Apache::ServerUtil
instead of a global Apache::Server class with everything thrown in.

HTH

--Geoff

-- 
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

Reply via email to