Jay Lawrence <[EMAIL PROTECTED]> said something to this effect on 12/11/2001:
> In my development I neglected to supply the Apache request
> object when I called Apache::Request->new( $r ). Actually $r
> was undef. It still works! I am just wondering if this is
> expected behaviour and if it will be supported going forward or
> was this just a fluke?
The Apache instance that gets passed to Apache::Request::new
apepars to not be required:
# From libapreq-0.33/Request/Request.xs:
165 static ApacheRequest *sv_2apreq(SV *sv)
166 {
167 if (SvROK(sv) && sv_derived_from(sv, "Apache::Request")) {
168 SV *obj = sv;
169
*snip*
179 return (ApacheRequest *)SvIV((SV*)SvRV(obj));
180 }
181 else {
182 return ApacheRequest_new(perl_request_rec(NULL));
183 }
184 }
perl_request_rec is defined in mod_perl/src/modules/perl/mod_perl.c
(from the mod_perl distribution); it sets the static IV
mp_request_rec to a request_rec:
# mod_perl/src/modules/perl/mod_perl.c:
66 static IV mp_request_rec;
1685 request_rec *perl_request_rec(request_rec *r)
1686 {
1687 if(r != NULL) {
1688 mp_request_rec = (IV)r;
1689 return NULL;
1690 }
1691 else
1692 return (request_rec *)mp_request_rec;
1693 }
So, at least with the current versions of mod_perl (1.26) and
libapreq (0.33), not passing Apache->request to
Apache::Request::new seems safe.
(darren)
--
Democracy is a form of government that substitutes election by the
incompetent many for appointment by the corrupt few.
-- George Bernard Shaw