dougm 01/11/13 09:42:49
Modified: t/response/TestAPI request_rec.pm
todo api.txt
xs/Apache/RequestUtil Apache__RequestUtil.h
xs/maps modperl_functions.map
xs/tables/current/ModPerl FunctionTable.pm
Log:
implement $r->pnotes
Submitted by: Philippe M. Chiasson <[EMAIL PROTECTED]>
Reviewed by: dougm
Revision Changes Path
1.10 +11 -1 modperl-2.0/t/response/TestAPI/request_rec.pm
Index: request_rec.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/request_rec.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- request_rec.pm 2001/10/29 01:19:16 1.9
+++ request_rec.pm 2001/11/13 17:42:49 1.10
@@ -11,7 +11,7 @@
sub handler {
my $r = shift;
- plan $r, tests => 49;
+ plan $r, tests => 54;
#Apache->request($r); #PerlOptions +GlobalRequest takes care
my $gr = Apache->request;
@@ -78,6 +78,16 @@
ok $r->subprocess_env;
ok $r->notes;
+
+ ok $r->pnotes;
+
+ ok t_cmp('pnotes_bar', $r->pnotes('pnotes_foo','pnotes_bar'),
qq{\$r->pnotes(key,val)});
+
+ ok t_cmp("pnotes_bar", $r->pnotes('pnotes_foo') , qq{\$r->pnotes(key)});
+
+ ok t_cmp('HASH', ref($r->pnotes), qq{ref($r->pnotes)});
+
+ ok t_cmp('pnotes_bar', $r->pnotes()->{'pnotes_foo'}, qq{\$r->pnotes()->{}});
ok $r->content_type;
1.16 +0 -3 modperl-2.0/todo/api.txt
Index: api.txt
===================================================================
RCS file: /home/cvs/modperl-2.0/todo/api.txt,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- api.txt 2001/11/08 03:19:48 1.15
+++ api.txt 2001/11/13 17:42:49 1.16
@@ -10,9 +10,6 @@
need apr_finfo_t <-> struct stat conversion (might already be there,
haven't looked close enough yet)
-$r->pnotes:
-not yet implemented
-
$r->subprocess_env:
in void context should populate %ENV as 1.x does
1.11 +32 -0 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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Apache__RequestUtil.h 2001/11/07 03:39:08 1.10
+++ Apache__RequestUtil.h 2001/11/13 17:42:49 1.11
@@ -172,6 +172,38 @@
return retval;
}
+static MP_INLINE
+SV *mpxs_Apache__RequestRec_pnotes(pTHX_ request_rec *r, SV *key, SV *val)
+{
+ MP_dRCFG;
+ SV *retval = NULL;
+
+ if (!rcfg) {
+ return &PL_sv_undef;
+ }
+ if (!rcfg->pnotes) {
+ rcfg->pnotes = newHV();
+ }
+
+ if (key) {
+ STRLEN len;
+ char *k = SvPV(key, len);
+
+ if (val) {
+ retval = *hv_store(rcfg->pnotes, k, len,
+ SvREFCNT_inc(val), 0);
+ }
+ else if (hv_exists(rcfg->pnotes, k, len)) {
+ retval = *hv_fetch(rcfg->pnotes, k, len, FALSE);
+ }
+ }
+ else {
+ retval = newRV_inc((SV *)rcfg->pnotes);
+ }
+
+ return retval ? SvREFCNT_inc(retval) : &PL_sv_undef;
+}
+
#define mpxs_Apache__RequestRec_dir_config(r, key, sv_val) \
modperl_dir_config(aTHX_ r, r->server, key, sv_val)
1.28 +1 -0 modperl-2.0/xs/maps/modperl_functions.map
Index: modperl_functions.map
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/maps/modperl_functions.map,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- modperl_functions.map 2001/11/07 04:03:07 1.27
+++ modperl_functions.map 2001/11/13 17:42:49 1.28
@@ -13,6 +13,7 @@
mpxs_Apache__RequestRec_set_handlers
mpxs_Apache__RequestRec_get_handlers
mpxs_Apache__RequestRec_location
+ mpxs_Apache__RequestRec_pnotes | | r, key=Nullsv, val=Nullsv
#protocol module helpers
mpxs_Apache__RequestRec_location_merge
1.48 +23 -1 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.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- FunctionTable.pm 2001/11/12 22:38:27 1.47
+++ FunctionTable.pm 2001/11/13 17:42:49 1.48
@@ -2,7 +2,7 @@
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# ! WARNING: generated by ModPerl::ParseSource/0.01
-# ! Mon Nov 12 14:44:40 2001
+# ! Tue Nov 13 09:47:37 2001
# ! do NOT edit, any changes will be lost !
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -4207,6 +4207,28 @@
{
'type' => 'request_rec *',
'name' => 'r'
+ }
+ ]
+ },
+ {
+ 'return_type' => 'SV *',
+ 'name' => 'mpxs_Apache__RequestRec_pnotes',
+ 'args' => [
+ {
+ 'type' => 'PerlInterpreter *',
+ 'name' => 'my_perl'
+ },
+ {
+ 'type' => 'request_rec *',
+ 'name' => 'r'
+ },
+ {
+ 'type' => 'SV *',
+ 'name' => 'key'
+ },
+ {
+ 'type' => 'SV *',
+ 'name' => 'val'
}
]
},