On Fri, 28 Sep 2001, Stas Bekman wrote:
> patch:
> - implements Apache::RequestRec::dir_config 1.x compliance + allows:
> $r->dir_config($key => $val); # == set($key, $val)
> $r->dir_config($key => undef); # == unset($key)
> - adds tests for dir_config, PerlSetVar and PerlAddVar
nice.
> the problem I've solved:
> - The use of 'items' in TABLE_GET_SET() macro was for a reason, it's all
> because 'val' can be undef. And if we make it a char* we lose this
> information. Now it's fully 1.x complient.
you can do this:
dir_config(r, key=NULL, sv_val=&PL_sv_no)
Apache::RequestRec r
char *key
SV *sv_val
... (below code would be in the modperl_dir_config function)
if (sv_val == &PL_sv_no) {
/* no val was passed */
}
else if (sv_val == &PL_sv_undef) {
/* val was passed in as undef */
}
else {
char *val = SvPV(sv_val, n_a);
}
> outstanding issues:
> - ALIAS for Apache::Server::dir_config
> Doug said: add the common function to modperl_util.c, then it can be
> called from anywhere.
> Stas replied: can you please be more verbose? what function?
the main body of dir_config, something like:
SV *modperl_dir_config(pTHX_ request_rec *r, server_rec *s,
char *key, SV *sv_val)
{
/* borrow from 1.x's Apache.xs:dir_config() here */
/* adjust to fixed parms based on code above */
}
//Apache__RequestUtil.h
#define mpxs_Apache__RequestRec_dir_config(r, key, sv_val) \
modperl_dir_config(aTHX_ r, r->server, key, sv_val)
//Apache__ServerUtil.h
#define mpxs_Apache__Server_dir_config(s, key, sv_val) \
modperl_dir_config(aTHX_ NULL, s, key, sv_val)
TABLE_GET_SET should also become:
MP_INLINE SV *
modperl_table_get_set(pTHX_ apr_table_t *table, char *key, SV *sv_val)
{
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]