Hi,
Consider the following code under mod_perl (current CVS 1.25):
# Get the original request object
my $r = Apache->request;
$r->send_http_header('text/html');
# Subclass Apache and install new $r
my $r2 = bless {'_r' => $r}, 'OtherPackage';
@OtherPackage::ISA = ('Apache');
Apache->request($r2);
# Verify that the changes took effect
$r = Apache->request;
print "New \$r: $r<br>\n";
This doesn't work as intended, because Apache->request($r2) extracts the
original request from $r2 and stores that internally.
The thing I can't figure out from the XS code is how/where
Apache->request calls sv2request_rec(), which actually does the
extraction work. Somehow it's automatically converted, because I see no
manual conversion in the Apache->request code below:
void
request(self, r=NULL)
SV *self
Apache r
PPCODE:
self = self;
if(items > 1) perl_request_rec(r);
XPUSHs(perl_bless_request_rec(perl_request_rec(NULL)));
Any pointers?
The reason I'm asking is that the current behavior of
Apache->request($r) makes it really hard to subclass Apache::Registry
and the like, because lots of code (like CGI.pm) call Apache->request to
get the current request object.
------------------- -------------------
Ken Williams Last Bastion of Euclidity
ken@forum.swarthmore.edu The Math Forum
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
|