in reply to Re^2: Subclassing Apache::Request?
in thread Subclassing Apache::Request?
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); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Subclassing Apache::Request?
by tadamec (Beadle) on Aug 11, 2004 at 09:00 UTC | |
by lestrrat (Deacon) on Aug 11, 2004 at 09:16 UTC | |
by tadamec (Beadle) on Aug 11, 2004 at 10:05 UTC |