stas 2003/01/30 20:20:20
Modified: src/modules/perl modperl_global.c modperl_global.h
xs/Apache/RequestUtil Apache__RequestUtil.h
xs/tables/current/ModPerl FunctionTable.pm
Log:
expose modperl_global_request (needed in external apps written in XS )
Revision Changes Path
1.7 +24 -0 modperl-2.0/src/modules/perl/modperl_global.c
Index: modperl_global.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_global.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- modperl_global.c 22 May 2002 18:53:33 -0000 1.6
+++ modperl_global.c 31 Jan 2003 04:20:20 -0000 1.7
@@ -26,6 +26,30 @@
MpReqSET_GLOBAL_REQUEST_On(rcfg);
}
+/* get/set */
+request_rec *modperl_global_request(pTHX_ SV *svr)
+{
+ request_rec *cur = NULL;
+ apr_status_t status = modperl_tls_get_request_rec(&cur);
+
+ if (status != APR_SUCCESS) {
+ /* an internal problem */
+ Perl_croak(aTHX_ "failed to retrieve the request object");
+ }
+
+ if (!cur) {
+ /* wrong configuration */
+ Perl_croak(aTHX_ "Global $r object is not available. Set:\n"
+ "\tPerlOptions +GlobalRequest\nin httpd.conf");
+ }
+
+ if (svr) {
+ modperl_global_request_obj_set(aTHX_ svr);
+ }
+
+ return cur;
+}
+
void modperl_global_request_obj_set(pTHX_ SV *svr)
{
/* XXX: support sublassing */
1.4 +2 -0 modperl-2.0/src/modules/perl/modperl_global.h
Index: modperl_global.h
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_global.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- modperl_global.h 4 May 2001 05:49:19 -0000 1.3
+++ modperl_global.h 31 Jan 2003 04:20:20 -0000 1.4
@@ -18,6 +18,8 @@
void modperl_global_request_cfg_set(request_rec *r);
+request_rec *modperl_global_request(pTHX_ SV *svr);
+
void modperl_global_request_set(request_rec *r);
void modperl_global_request_obj_set(pTHX_ SV *svr);
1.17 +2 -19 modperl-2.0/xs/Apache/RequestUtil/Apache__RequestUtil.h
Index: Apache__RequestUtil.h
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/Apache/RequestUtil/Apache__RequestUtil.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- Apache__RequestUtil.h 31 Jan 2003 03:15:23 -0000 1.16
+++ Apache__RequestUtil.h 31 Jan 2003 04:20:20 -0000 1.17
@@ -85,25 +85,8 @@
static MP_INLINE
request_rec *mpxs_Apache_request(pTHX_ SV *classname, SV *svr)
{
- request_rec *cur = NULL;
- apr_status_t status = modperl_tls_get_request_rec(&cur);
-
- if (status != APR_SUCCESS) {
- /* an internal problem */
- Perl_croak(aTHX_ "failed to retrieve the request object");
- }
-
- if (!cur) {
- /* wrong configuration */
- Perl_croak(aTHX_ "Global $r object is not available. Set:\n"
- "\tPerlOptions +GlobalRequest\nin httpd.conf");
- }
-
- if (svr) {
- modperl_global_request_obj_set(aTHX_ svr);
- }
-
- return cur;
+ /* ignore classname */
+ return modperl_global_request(aTHX_ svr);
}
static MP_INLINE
1.104 +14 -0 modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm
Index: FunctionTable.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -r1.103 -r1.104
--- FunctionTable.pm 29 Jan 2003 03:56:00 -0000 1.103
+++ FunctionTable.pm 31 Jan 2003 04:20:20 -0000 1.104
@@ -1494,6 +1494,20 @@
'args' => []
},
{
+ 'return_type' => 'request_rec *',
+ 'name' => 'modperl_global_request',
+ 'args' => [
+ {
+ 'type' => 'PerlInterpreter *',
+ 'name' => 'my_perl'
+ },
+ {
+ 'type' => 'SV *',
+ 'name' => 'svr'
+ }
+ ]
+ },
+ {
'return_type' => 'SV *',
'name' => 'modperl_dir_config',
'attr' => [