The things I'm trying to do seem a little more advanced than general mod_perl stuff, but nothing that should require delving into the C and XS code.
uh, right. you don't need to delve into C/XS. Whatever gave you that idea?
If you want to create objects to handle generating content, just create a handler that instantiates an object:
package My::Handler;
sub handler
{
my $r = shift;
# translate from URL to package name, and the "action"
# that you want to perform
my($pkg, $action) = figure_out_package_name($r->uri);
# instantiate, and call the appropriate handler
my $obj = $pkg->new();
$obj->dispatch($action);
}
Meanwhile, if you still insist on subclassing Apache (which, I'm starting to think could be useful, but is still parallel to what you are trying to solve), you could just add a hook to do so in the dispatch() method above:
sub dispatch
{
my($self, $action) = @_;
my $my_r = My::Apache::Request->new(Apache->request);
$self->do_the_appropriate_thing($action, $my_r);
}
Then when you write code for the actual objects that handle the request, you can safely assume that you will get the appropriate request object. No?