How do I get the server to return my new object instead of a generic Apache object. Or, how do I get the server to return my object blessed as an Apache object, instead of returning a generic Apache::Request object?
I think the short answer is, you can't/don't. No matter how hard you try, handler() will always receive a vanilla Apache object
So the next best thing would be to always start out your handlers like so:
sub handler { my $r = shift; my $my_r = My::Apache::Request->new($r); # do interesting things with $my_r }
Or perhaps you can create something like the Apache->instance() method, and do something like:
# somewhere in your code... my $r = My::Apache::Request->instance; # in My::Apache::Request; package My::Apache::Request; use base qw(Apache::Singleton); # or something like it sub _new_instance { my $class = shift; return $class->new(r => Apache::Request->instance); }
In reply to Re^3: Subclassing Apache::Request?
by lestrrat
in thread Subclassing Apache::Request?
by tadamec
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |